git-svn-id: svn://db.shs.com.ru/libs@57 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
*/
|
||||
|
||||
#include "globject.h"
|
||||
#include "glcamera.h"
|
||||
|
||||
|
||||
GLObjectBase::GLObjectBase() {
|
||||
@@ -26,7 +27,7 @@ GLObjectBase::GLObjectBase() {
|
||||
geom_prim = Triangles;
|
||||
scale_ = QVector3D(1., 1., 1.);
|
||||
parent_ = 0;
|
||||
is_init = is_tex_loaded = selected_ = false;
|
||||
is_root = is_init = is_tex_loaded = selected_ = false;
|
||||
visible_ = accept_fog = accept_light = cast_shadow = rec_shadow = select_ = true;
|
||||
line_width = -1.;
|
||||
blend_src = GL_SRC_ALPHA;
|
||||
@@ -149,7 +150,7 @@ void GLObjectBase::buildTransform() {
|
||||
if (p != 0)
|
||||
itransform_ = p->itransform_;
|
||||
if (raw_matrix) {
|
||||
itransform_.translate(pos_);
|
||||
itransform_.translate(is_root ? dcam_pos_ : pos_);
|
||||
itransform_ *= mat_;
|
||||
//qDebug() << "raw_matrix" << itransform_;
|
||||
} else
|
||||
@@ -161,7 +162,7 @@ void GLObjectBase::buildTransform() {
|
||||
|
||||
|
||||
void GLObjectBase::localTransform(QMatrix4x4 & m) {
|
||||
m.translate(pos_);
|
||||
m.translate(is_root ? dcam_pos_ : pos_);
|
||||
m.rotate(angles_.z(), 0., 0., 1.);
|
||||
m.rotate(angles_.y(), 0., 1., 0.);
|
||||
m.rotate(angles_.x(), 1., 0., 0.);
|
||||
@@ -175,6 +176,12 @@ void GLObjectBase::checkPass() {
|
||||
}
|
||||
|
||||
|
||||
void GLObjectBase::preparePos(const Camera & cam) {
|
||||
dcam_pos_ = pos_ - cam.aim();
|
||||
buildTransform();
|
||||
}
|
||||
|
||||
|
||||
QMatrix4x4 GLObjectBase::worldMatrix(QMatrix4x4 parent) const {
|
||||
QMatrix4x4 mat;
|
||||
mat.translate(pos_);
|
||||
|
||||
Reference in New Issue
Block a user