git-svn-id: svn://db.shs.com.ru/libs@639 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
@@ -36,7 +36,7 @@ ObjectBase::ObjectBase(Mesh * geom, Material * mat) {
|
||||
blend_src = GL_SRC_ALPHA;
|
||||
blend_dest = GL_ONE_MINUS_SRC_ALPHA;
|
||||
type_ = glMesh;
|
||||
raw_matrix = false;
|
||||
raw_matrix = selected_aim = false;
|
||||
mat_.setToIdentity();
|
||||
scene_ = nullptr;
|
||||
mesh_ = geom;
|
||||
@@ -329,6 +329,8 @@ void ObjectBase::setSelected(bool yes) {
|
||||
//qDebug() << "select" << name() << view_;
|
||||
if (select_)
|
||||
selected_ = yes;
|
||||
if (!selected_)
|
||||
selected_aim = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -450,11 +452,10 @@ QVector3D AimedObject::worldAim() const {
|
||||
|
||||
|
||||
void AimedObject::setAim(const QVector3D & p) {
|
||||
QVector3D dir = inParentSpace(p) - pos(), up;
|
||||
if (!QVector3D::crossProduct(QVector3D(0,0,1), dir).isNull())
|
||||
up = QVector3D(0,0,1);
|
||||
QVector3D dir = p - pos();
|
||||
trans.setRotation(Transform::fromDirection(dir));
|
||||
aim_dist = dir.length();
|
||||
buildTransform();
|
||||
//qDebug() << "setAim" << p << aim();
|
||||
}
|
||||
|
||||
@@ -467,6 +468,7 @@ QVector3D AimedObject::direction() const {
|
||||
void AimedObject::setDirection(const QVector3D & d) {
|
||||
//double len = qMax(aim_.length(), 0.001f);
|
||||
//aim_ = d.normalized() * len;
|
||||
buildTransform();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user