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/Headers/Predefined/Sphere3D.h

Diff revisions: vs.
  @@ -45,14 +45,13 @@
45 45 _radius(radius),
46 46 _resolution(resolution)
47 47 {
48 - _dirty = true;
49 48 _vertexCount = resolution * resolution;
50 49 getGeometryVB()->setVertexCount(_vertexCount);
51 50 getGeometryVB()->reserveIndexCount(_vertexCount);
52 51 if (_vertexCount + 1 > std::numeric_limits<U16>::max()) {
53 52 getGeometryVB()->useLargeIndices(true);
54 53 }
55 - clean();
54 + rebuild();
56 55 }
57 56
58 57 virtual ~Sphere3D() {}
  @@ -60,32 +59,20 @@
60 59 inline U32 getResolution() { return _resolution; }
61 60 inline void setRadius(F32 radius) {
62 61 _radius = radius;
63 - _dirty = true;
62 + _geometryDirty = true;
64 63 }
65 64
66 65 inline void setResolution(U32 resolution) {
67 66 _resolution = resolution;
68 - _dirty = true;
69 - }
70 -
71 - bool onRender(SceneGraphNode& sgn,
72 - const SceneRenderState& sceneRenderState,
73 - const RenderStagePass& renderStagePass) {
74 - clean();
75 - return Object3D::onRender(sgn, sceneRenderState, renderStagePass);
76 - }
77 -
78 - protected:
79 - void clean() {
80 - if (_dirty) {
81 - createSphere(_resolution, _resolution);
82 - _dirty = false;
83 - }
67 + _geometryDirty = true;
84 68 }
85 69
86 70 private:
87 71 // SuperBible stuff
88 - void createSphere(U32 slices, U32 stacks) {
72 + void rebuildVB() override {
73 + U32 slices = _resolution;
74 + U32 stacks = _resolution;
75 +
89 76 VertexBuffer* const vb = getGeometryVB();
90 77
91 78 vb->reset();
  @@ -153,7 +140,6 @@
153 140 F32 _radius;
154 141 U32 _resolution;
155 142 U32 _vertexCount;
156 - bool _dirty;
157 143 };
158 144
159 145 TYPEDEF_SMART_POINTERS_FOR_CLASS(Sphere3D);