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

Function SetupAttribPointers

Source/Objects/envobject.cpp:263–451  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

261static int attrib_ids[kAttribIdCountVboInstancing];
262
263static void SetupAttribPointers(bool shader_changed, bool shader_is_v1_5_or_greater, Model* model, VBORingContainer& env_object_model_translation_instance_vbo, VBORingContainer& env_object_model_scale_instance_vbo, VBORingContainer& env_object_model_rotation_quat_instance_vbo, VBORingContainer& env_object_color_tint_instance_vbo, VBORingContainer& env_object_detail_scale_instance_vbo, Shaders* shaders, int the_shader, Graphics* graphics) {
264 bool attrib_envobj_instancing = g_attrib_envobj_instancing_support && g_attrib_envobj_instancing_enabled;
265 int attrib_count = shader_is_v1_5_or_greater
266 ? (attrib_envobj_instancing ? kAttribIdCountVboInstancing : kAttribIdCountUboInstancing)
267 : kAttribIdCountLegacyShader;
268 if (shader_changed) {
269 for (int i = 0; i < attrib_count; ++i) {
270 const char* attrib_str;
271 int num_el;
272 VBOContainer* vbo = NULL;
273 VBORingContainer* vboRing = NULL;
274 bool instanced;
275 switch (i) {
276 case 0:
277 attrib_str = "vertex_attrib";
278 num_el = 3;
279 vbo = &model->VBO_vertices;
280 instanced = false;
281 break;
282 case 1:
283 attrib_str = "tangent_attrib";
284 num_el = 3;
285 vbo = &model->VBO_tangents;
286 instanced = false;
287 break;
288 case 2:
289 attrib_str = "bitangent_attrib";
290 num_el = 3;
291 vbo = &model->VBO_bitangents;
292 instanced = false;
293 break;
294 case 3:
295 attrib_str = "normal_attrib";
296 num_el = 3;
297 vbo = &model->VBO_normals;
298 instanced = false;
299 break;
300 case 4:
301 attrib_str = "tex_coord_attrib";
302 num_el = 2;
303 vbo = &model->VBO_tex_coords;
304 instanced = false;
305 break;
306 case 5:
307 attrib_str = "plant_stability_attrib";
308 num_el = 3;
309 vbo = &model->VBO_aux;
310 instanced = false;
311 break;
312 case 6:
313 attrib_str = "model_translation_attrib";
314 num_el = 3;
315 vboRing = &env_object_model_translation_instance_vbo;
316 instanced = true;
317 break;
318 case 7:
319 attrib_str = "model_scale_attrib";
320 num_el = 3;

Callers 1

DrawInstancesMethod · 0.85

Calls 5

returnShaderAttribMethod · 0.80
validMethod · 0.45
BindMethod · 0.45
offsetMethod · 0.45

Tested by

no test coverage detected