git-svn-id: svn://db.shs.com.ru/libs@665 a8b55f48-bf90-11e4-a774-851b48703e85

This commit is contained in:
2019-12-10 10:22:09 +00:00
parent 86f4e0ad78
commit 9d05dbe6da
24 changed files with 186 additions and 137 deletions

View File

@@ -38,7 +38,6 @@ class ObjectBase
friend QDataStream & operator >>(QDataStream & s, Scene *& p);
public:
enum Type {glMesh, glLight, glCamera, glParticlesSystem};
enum Pass {Solid, Transparent, Reflection, User};
enum RenderMode {View = 0, Point = GL_POINT, Line = GL_LINE, Fill = GL_FILL};
explicit ObjectBase(Mesh * geom = 0, Material * mat = 0);
@@ -49,12 +48,11 @@ public:
QString name() const {return name_;}
void setName(const QString & name) {name_ = name;}
//virtual GLuint hList() {return list;}
virtual void init();
virtual void update() {}
bool isInit() const {return is_init;}
bool isTexturesLoaded() const {return is_tex_loaded;}
Type type() const {return type_;}
RenderPass pass() const;
RenderMode renderMode() const {return render_mode;}
void setRenderMode(RenderMode mode) {render_mode = mode;}
@@ -77,7 +75,7 @@ public:
ObjectBase * child(const QString & name);
const ObjectBase * child(int index) const;
const ObjectBase * child(const QString & name) const;
QList<ObjectBase * > children(bool all_ = false);
ObjectBaseList children(bool all_ = false);
bool isVisible(bool check_parents = false) const;
bool isHidden(bool check_parents = false) const {return !isVisible(check_parents);}
@@ -196,19 +194,16 @@ public:
protected:
virtual void transformChanged() {}
void addChildren(QList<ObjectBase * > & list, ObjectBase * where);
void loadTextures(bool with_children = false);
//void deleteTextures() {foreach (GLuint i, textures) currentQGLView->deleteTexture(i); textures.clear();}
void addChildren(ObjectBaseList & list, ObjectBase * where);
void buildTransform();
void initInternal();
void checkPass();
void setSceneTreeChanged();
void setMeshChanged();
void setObjectsChanged();
virtual void localTransform(QMatrix4x4 & m);
QMatrix4x4 worldMatrix(QMatrix4x4 parent) const;
int pass_; // Pass
bool is_init, is_tex_loaded, accept_light, accept_fog, /*write_depth_,*/ visible_, cast_shadow, rec_shadow, select_, selected_, raw_matrix;
int prev_pass; // Pass
bool is_init, accept_light, accept_fog, visible_, cast_shadow, rec_shadow, select_, selected_, raw_matrix;
bool is_root, selected_aim;
float line_width;
QColor color_;
@@ -217,7 +212,7 @@ protected:
RenderMode render_mode;
Box3D bound;
Transform trans;
QList<ObjectBase * > children_;
ObjectBaseList children_;
QMatrix4x4 itransform_, mat_;
QString name_;
GLenum blend_src, blend_dest;
@@ -309,6 +304,6 @@ inline T globject_cast(const ObjectBase * object) {return reinterpret_cast<T>(ob
QDataStream & operator <<(QDataStream & s, const ObjectBase * p);
QDataStream & operator >>(QDataStream & s, ObjectBase *& p);
inline QList<ObjectBase*> light2objectList(const QList<Light*> & v) {QList<ObjectBase*> ret; foreach (Light*i, v) ret << (ObjectBase*)i; return ret;}
inline ObjectBaseList light2objectList(const QList<Light*> & v) {ObjectBaseList ret; foreach (Light*i, v) ret << (ObjectBase*)i; return ret;}
#endif // GLOBJECT_H