diff options
Diffstat (limited to 'servers/visual_server.cpp')
-rw-r--r-- | servers/visual_server.cpp | 33 |
1 files changed, 26 insertions, 7 deletions
diff --git a/servers/visual_server.cpp b/servers/visual_server.cpp index a49b3eca32..78320f277e 100644 --- a/servers/visual_server.cpp +++ b/servers/visual_server.cpp @@ -130,6 +130,24 @@ RID VisualServer::get_test_texture() { return test_texture; }; +void VisualServer::_free_internal_rids() { + + if (test_texture.is_valid()) + free(test_texture); + if (white_texture.is_valid()) + free(white_texture); + if (test_material.is_valid()) + free(test_material); + + for(int i=0;i<16;i++) { + if (material_2d[i].is_valid()) + free(material_2d[i]); + } + + + +} + RID VisualServer::_make_test_cube() { DVector<Vector3> vertices; @@ -202,16 +220,17 @@ RID VisualServer::_make_test_cube() { mesh_add_surface( test_cube, PRIMITIVE_TRIANGLES,d ); - RID material = fixed_material_create(); + + test_material = fixed_material_create(); //material_set_flag(material, MATERIAL_FLAG_BILLBOARD_TOGGLE,true); - fixed_material_set_texture( material, FIXED_MATERIAL_PARAM_DIFFUSE, get_test_texture() ); - fixed_material_set_param( material, FIXED_MATERIAL_PARAM_SPECULAR_EXP, 70 ); - fixed_material_set_param( material, FIXED_MATERIAL_PARAM_EMISSION, Color(0.2,0.2,0.2) ); + fixed_material_set_texture( test_material, FIXED_MATERIAL_PARAM_DIFFUSE, get_test_texture() ); + fixed_material_set_param( test_material, FIXED_MATERIAL_PARAM_SPECULAR_EXP, 70 ); + fixed_material_set_param( test_material, FIXED_MATERIAL_PARAM_EMISSION, Color(0.2,0.2,0.2) ); - fixed_material_set_param( material, FIXED_MATERIAL_PARAM_DIFFUSE, Color(1, 1, 1) ); - fixed_material_set_param( material, FIXED_MATERIAL_PARAM_SPECULAR, Color(1,1,1) ); + fixed_material_set_param( test_material, FIXED_MATERIAL_PARAM_DIFFUSE, Color(1, 1, 1) ); + fixed_material_set_param( test_material, FIXED_MATERIAL_PARAM_SPECULAR, Color(1,1,1) ); - mesh_surface_set_material(test_cube, 0, material ); + mesh_surface_set_material(test_cube, 0, test_material ); return test_cube; } |