Subversion Repository Public Repository

Divide-Framework

This repository has no backups
This repository's network speed is throttled to 100KB/sec

Diff Revisions 948 vs 949 for /trunk/Source Code/Geometry/Shapes/Object3D.cpp

Diff revisions: vs.
  @@ -28,7 +28,7 @@
28 28 Object3D::Object3D(GFXDevice& context, ResourceCache& parentCache, size_t descriptorHash, const stringImpl& name, const stringImpl& resourceName, const stringImpl& resourceLocation, ObjectType type, U32 flagMask)
29 29 : SceneNode(parentCache, descriptorHash, name, resourceName, resourceLocation, SceneNodeType::TYPE_OBJECT3D),
30 30 _context(context),
31 - _update(false),
31 + _geometryDirty(false),
32 32 _buffer(nullptr),
33 33 _playAnimations(true),
34 34 _geometryType(type),
  @@ -89,6 +89,17 @@
89 89 SceneNode::postLoad(sgn);
90 90 }
91 91
92 + void Object3D::rebuildVB() {
93 + }
94 +
95 + void Object3D::rebuild() {
96 + if (_geometryDirty) {
97 + rebuildVB();
98 + computeTriangleList(true);
99 + _geometryDirty = false;
100 + }
101 + }
102 +
92 103 void Object3D::setGeometryVB(VertexBuffer* const vb) {
93 104 DIVIDE_ASSERT(_buffer == nullptr,
94 105 "Object3D error: Please remove the previous vertex buffer of "
  @@ -103,7 +114,7 @@
103 114 bool Object3D::onRender(SceneGraphNode& sgn,
104 115 const SceneRenderState& sceneRenderState,
105 116 const RenderStagePass& renderStagePass) {
106 -
117 + rebuild();
107 118 if (getState() == ResourceState::RES_LOADED) {
108 119 return SceneNode::onRender(sgn, sceneRenderState, renderStagePass);
109 120 }
  @@ -112,8 +123,8 @@
112 123 }
113 124
114 125 void Object3D::buildDrawCommands(SceneGraphNode& sgn,
115 - const RenderStagePass& renderStagePass,
116 - RenderPackage& pkgInOut) {
126 + const RenderStagePass& renderStagePass,
127 + RenderPackage& pkgInOut) {
117 128 if (pkgInOut.drawCommandCount() == 0) {
118 129 GenericDrawCommand cmd;
119 130 VertexBuffer* const vb = getGeometryVB();
  @@ -128,8 +139,7 @@
128 139 SceneNode::buildDrawCommands(sgn, renderStagePass, pkgInOut);
129 140 }
130 141
131 - // Create a list of triangles from the vertices + indices lists based on
132 - // primitive type
142 + // Create a list of triangles from the vertices + indices lists based on primitive type
133 143 bool Object3D::computeTriangleList(bool force) {
134 144 if (!_geometryTriangles.empty() && !force) {
135 145 return true;