| 1175 | } |
| 1176 | |
| 1177 | static void draw_mesh(RenderWorld::MeshManager &mesh |
| 1178 | , u32 object_id |
| 1179 | , Pipeline *pipeline |
| 1180 | , const Vector4 &texel_sizes |
| 1181 | , const FogDesc &fog_desc |
| 1182 | , GlobalLightingDesc &global_lighting_desc |
| 1183 | , SceneGraph *scene_graph |
| 1184 | , Matrix4x4 *cascaded_lights |
| 1185 | ) |
| 1186 | { |
| 1187 | #if CROWN_PLATFORM_EMSCRIPTEN |
| 1188 | bgfx::setTexture(0, pipeline->_html5_default_sampler, pipeline->_html5_default_texture); |
| 1189 | #endif |
| 1190 | bgfx::setTexture(LIGHTS_DATA_SLOT, pipeline->_lights_data, pipeline->_lights_data_texture); |
| 1191 | bgfx::setTexture(CASCADED_SHADOW_MAP_SLOT, pipeline->_u_cascaded_shadow_map, pipeline->_sun_shadow_map_texture); |
| 1192 | bgfx::setUniform(pipeline->_u_cascaded_lights, &cascaded_lights[0], MAX_NUM_CASCADES); |
| 1193 | bgfx::setUniform(pipeline->_u_shadow_maps_texel_sizes, &texel_sizes); |
| 1194 | bgfx::setUniform(pipeline->_fog_data, (char *)&fog_desc, sizeof(fog_desc) / sizeof(Vector4)); |
| 1195 | pipeline->set_local_lights_params_uniform(); |
| 1196 | pipeline->set_global_lighting_params(&global_lighting_desc); |
| 1197 | bgfx::setTexture(LOCAL_LIGHTS_SHADOW_MAP_SLOT, pipeline->_u_local_lights_shadow_map, pipeline->_local_lights_shadow_map_texture); |
| 1198 | |
| 1199 | mesh.set_instance_data(object_id, *scene_graph); |
| 1200 | mesh._data.material[object_id]->bind(View::MESH); |
| 1201 | } |
| 1202 | |
| 1203 | void RenderWorld::render(f32 dt, const Matrix4x4 &view, const Matrix4x4 &proj, const Matrix4x4 &persp, UnitId skydome_unit, DebugLine &dl) |
| 1204 | { |
no test coverage detected