MCPcopy Create free account
hub / github.com/WolfireGames/overgrowth / Draw

Method Draw

Source/Graphics/drawbatch.cpp:106–148  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

104}
105
106void DrawBatch::Draw() {
107 if (to_delete || vertices.empty()) {
108 return;
109 }
110
111 if (!vbo_vertices->valid() && draw_times > _vbo_threshold && !no_vbo) {
112 CreateVBO(DrawBatch::FACE_VBO);
113 }
114
115 if (added_batches.empty()) {
116 SetStartState();
117 SetupVertexArrays();
118
119 Graphics::Instance()->SetModelMatrix(transform, inv_transpose_transform);
120
121 DrawVertexArrays();
122 SetEndState();
123 EndVertexArrays();
124 } else {
125 const Camera &camera = (*ActiveCameras::Get());
126 SetupVertexArrays();
127 for (auto &added_batche : added_batches) {
128 if (camera.checkSphereInFrustum(added_batche.batch->bounding_sphere_center,
129 added_batche.batch->bounding_sphere_radius)) {
130 added_batche.batch->SetStartState();
131 // glPushMatrix();
132 // glMultMatrixf(added_batches[i].batch->transform);
133
134 Graphics::Instance()->SetModelMatrix(added_batche.batch->transform, added_batche.batch->inv_transpose_transform);
135
136 DrawVertexArrayRange(added_batche.start_face,
137 added_batche.end_face,
138 added_batche.start_vertex,
139 added_batche.end_vertex);
140 // glPopMatrix();
141 added_batche.batch->SetEndState();
142 }
143 }
144 EndVertexArrays();
145 }
146
147 draw_times++;
148}
149
150void DrawBatch::CreateVBO(CreateVBOParam create_vbo_param) {
151 if (create_vbo_param == FACE_VBO) {

Callers

nothing calls this directly

Calls 7

SetModelMatrixMethod · 0.80
checkSphereInFrustumMethod · 0.80
SetStartStateMethod · 0.80
SetEndStateMethod · 0.80
GetFunction · 0.50
emptyMethod · 0.45
validMethod · 0.45

Tested by

no test coverage detected