- Timestamp:
- 06/01/08 14:45:49 (7 months ago)
- Files:
-
- trunk/src/defend/sim/Core.d (modified) (1 diff)
- trunk/src/defend/terrain/Terrain.d (modified) (1 diff)
- trunk/src/engine/math/Frustum.d (modified) (2 diffs)
- trunk/src/engine/model/ModelMD2.d (modified) (2 diffs)
- trunk/src/engine/rend/opengl/Renderer.d (modified) (3 diffs)
- trunk/src/engine/rend/opengl/VertexArray.d (modified) (1 diff)
- trunk/src/engine/rend/opengl/VertexBuffer.d (modified) (3 diffs)
- trunk/src/engine/rend/opengl/VertexFormat.d (modified) (2 diffs)
- trunk/src/engine/util/Statistics.d (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/defend/sim/Core.d
r590 r594 935 935 { 936 936 logger = Log.getLogger("sim.object." ~ Integer.toString(id)); 937 //logger.level = LogLevel.Info;937 logger.level = LogLevel.Info; 938 938 } 939 939 } trunk/src/defend/terrain/Terrain.d
r592 r594 381 381 { 382 382 if(!texture) continue; 383 384 383 Texture.release(texture); 384 } 385 386 foreach(texture; alphaMaps) 387 { 388 if(!texture) continue; 389 delete texture; 385 390 } 386 391 } trunk/src/engine/math/Frustum.d
r583 r594 63 63 bool sphereVisible(Vec3!(T) v, T radius) 64 64 { 65 statistics.frustum_bsphere_checks++;66 67 65 foreach(index, plane; frustum) 68 66 { … … 91 89 { 92 90 statistics.frustum_bbox_checks++; 93 //return true; 94 91 95 92 with(bbox) 96 93 { trunk/src/engine/model/ModelMD2.d
r593 r594 166 166 void render(MD2ModelInstance state) 167 167 { 168 BoundingBox!(float) bbox;169 170 168 auto currFrame = &frames[state.currentFrame]; 171 169 auto nextFrame = &frames[state.nextFrame]; … … 177 175 for(uint i = 0; i < header.numTriangles * 3; i++) 178 176 { 177 statistics.vertices_animated++; 178 179 179 target.position.x = currPos.x + state.interp * (nextPos.x - currPos.x); 180 180 target.position.y = currPos.y + state.interp * (nextPos.y - currPos.y); trunk/src/engine/rend/opengl/Renderer.d
r592 r594 99 99 Texture[9] currentTexture; 100 100 101 OGLVertexArrayBase currentArray; 102 OGLVertexFormat currentFormat; 103 101 104 version(UseSDL) 102 105 { … … 428 431 auto array = cast(OGLVertexArrayBase)a; 429 432 assert(array !is null); 430 431 array.bind(); 432 433 433 434 debug statistics.triangles_rendered += (indices ? indices.length : array.length) / 3; 434 435 435 array.format.set(array.offset()); 436 if(array !is currentArray) 437 { 438 statistics.array_format_changes++; 439 440 if(currentFormat !is null) 441 currentFormat.unset(); 442 443 if(currentArray !is null) 444 currentArray.unbind(); 445 446 array.bind(); 447 array.format.set(array.offset()); 448 } 449 450 currentArray = array; 451 currentFormat = currentArray.format; 436 452 437 453 if(!indices) … … 440 456 glDrawElements(primitiveMap[type], count == 0 ? indices.length : count, 441 457 GL_UNSIGNED_SHORT, (cast(OGLIndexBuffer)indices).buffer.ptr); 442 443 array.format.unset();444 array.unbind();445 458 } 446 459 trunk/src/engine/rend/opengl/VertexArray.d
r593 r594 14 14 uint count; 15 15 uint size; 16 17 ~this() 18 { 19 assert(format !is null); 20 delete format; 21 } 22 16 23 17 uint numberVertices() 24 18 { trunk/src/engine/rend/opengl/VertexBuffer.d
r593 r594 3 3 import tango.io.Stdout; 4 4 5 import engine.util.Profiler; 5 6 import engine.util.Memory; 6 7 import engine.rend.VertexArray; … … 80 81 bind(); 81 82 82 /+if(!initialSet)83 if(!initialSet) 83 84 { 84 initialSet = true;+/ 85 86 //if(firstSet == 0 && lastSet == count * size) 87 //{ 88 glBufferDataARB(GL_ARRAY_BUFFER_ARB, count * size, copy.ptr, 89 vertexArrayUsageMap[usage]); 90 91 return; 92 //} 93 //else 94 // glBufferDataARB(GL_ARRAY_BUFFER_ARB, count * size, null, 95 // vertexArrayUsageMap[usage]); 96 //} 97 /+ 98 if(glBufferSubData !is null && false) 85 initialSet = true; 86 87 glBufferDataARB(GL_ARRAY_BUFFER_ARB, count * size, copy.ptr, 88 vertexArrayUsageMap[usage]); 89 return; 90 } 91 92 if(GL_VBO.glBufferSubDataARB !is null) 93 { 99 94 glBufferSubDataARB(GL_ARRAY_BUFFER, firstSet, lastSet - firstSet, 100 copy[firstSet .. lastSet].ptr); 95 copy[firstSet .. lastSet].ptr); 96 } 101 97 else 102 98 { … … 105 101 buffer[firstSet .. lastSet] = copy[firstSet .. lastSet][]; 106 102 glUnmapBufferARB(GL_ARRAY_BUFFER_ARB); 107 } +/103 } 108 104 } 109 105 trunk/src/engine/rend/opengl/VertexFormat.d
r583 r594 23 23 24 24 public: 25 mixin MAllocator;26 27 25 this(VertexFormat format) 28 26 { 29 _elements. alloc(format.elements.length);27 _elements.length = format.elements.length; 30 28 31 29 foreach(i, element; format.elements) … … 66 64 assert(_stride == format.vsize); 67 65 } 68 69 ~this() 70 { 71 _elements.free(); 72 } 73 66 74 67 VertexElement[] elements() 75 68 { trunk/src/engine/util/Statistics.d
r583 r594 52 52 mixin(generateEntries("triangles rendered"[], 53 53 "frustum bbox checks"[], 54 "frustum bsphere checks"[],55 54 "texture changes"[], 56 55 "shader changes"[], 57 "vertices skinned"[])); 56 "vertices animated"[], 57 "array format changes"[])); 58 58 59 59 void render(GuiRenderer renderer, vec2i pos, Font font)
