primitive_batch* batching_find_batch(int texture, batch_info::material_type material_id, primitive_type prim_type, bool thruster) { batch_info query(material_id, texture, prim_type, thruster); SCP_map<batch_info, primitive_batch>::iterator iter = Batching_primitives.find(query); if ( iter == Batching_primitives.end() ) { primitive_batch* batch = &Batching_primitives[query]; *batch = primitive_batch(query); return batch; } else { return &iter->second; } }
primitive_batch* batching_find_batch(int texture, batch_info::material_type material_id, primitive_type prim_type, bool thruster) { // Use the base texture for finding the batch item since all items can reuse the same texture array auto base_tex = bm_get_base_frame(texture); batch_info query(material_id, base_tex, prim_type, thruster); SCP_map<batch_info, primitive_batch>::iterator iter = Batching_primitives.find(query); if ( iter == Batching_primitives.end() ) { primitive_batch* batch = &Batching_primitives[query]; *batch = primitive_batch(query); return batch; } else { return &iter->second; } }