From 4811defca2eeea69e40346be6b1647f276db8c76 Mon Sep 17 00:00:00 2001 From: Piotr Dziwinski Date: Fri, 14 Dec 2012 21:30:35 +0100 Subject: Static objects using OpenGL VBOs and display lists --- src/graphics/engine/engine.h | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'src/graphics/engine/engine.h') diff --git a/src/graphics/engine/engine.h b/src/graphics/engine/engine.h index d127e74..de57e4d 100644 --- a/src/graphics/engine/engine.h +++ b/src/graphics/engine/engine.h @@ -195,7 +195,9 @@ struct EngineObject //! Number of triangles int totalTriangles; //! Type of object - EngineObjectType type; + EngineObjectType type; + //! Whether the object is stored and rendered as static buffer + bool staticBuffer; //! Transformation matrix Math::Matrix transform; //! Distance to object from eye point @@ -225,6 +227,7 @@ struct EngineObject drawWorld = false; drawFront = false; totalTriangles = 0; + staticBuffer = false; type = ENG_OBJTYPE_NULL; transform.LoadIdentity(); bboxMax.LoadZero(); @@ -252,6 +255,7 @@ struct EngineObjLevel4 Material material; int state; std::vector vertices; + unsigned int staticBufferId; EngineObjLevel4(bool used = false, EngineTriangleType type = ENG_TRIANGLE_TYPE_TRIANGLES, @@ -760,6 +764,12 @@ public: bool GetObjectTransform(int objRank, Math::Matrix& transform); //@} + //@{ + //! Management of object static drawing flag + void SetObjectStatic(int objRank, bool staticBuffer); + bool GetObjectStatic(int objRank); + //@} + //! Sets drawWorld for given object bool SetObjectDrawWorld(int objRank, bool draw); //! Sets drawFront for given object @@ -1151,6 +1161,8 @@ public: protected: //! Prepares the interface for 3D scene void Draw3DScene(); + //! Draw 3D object + void DrawObject(const EngineObjLevel4& obj, bool staticBuffer); //! Draws the user interface over the scene void DrawInterface(); @@ -1215,6 +1227,9 @@ protected: //! Updates geometric parameters of objects (bounding box and radius) void UpdateGeometry(); + //! Updates static buffers of changed objects + void UpdateStaticObjects(); + protected: CInstanceManager* m_iMan; CApplication* m_app; @@ -1293,6 +1308,7 @@ protected: Color m_waterAddColor; int m_statisticTriangle; bool m_updateGeometry; + bool m_updateStaticObjects; int m_alphaMode; bool m_groundSpotVisible; bool m_shadowVisible; -- cgit v1.2.3-1-g7c22