1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-12 13:20:55 +00:00

Begining of GLES3 renderer:

-Most 2D drawing is implemented
-Missing shaders
-Missing all 3D
-Editor needs to be set on update always to be used, otherwise it does not refresh
-Large parts of editor not working
This commit is contained in:
Juan Linietsky
2016-10-03 16:33:42 -03:00
parent 78d97b060a
commit 22d83bc9f6
211 changed files with 15188 additions and 14195 deletions

View File

@@ -39,16 +39,6 @@ VisualServer *VisualServer::get_singleton() {
}
void VisualServer::set_mipmap_policy(MipMapPolicy p_policy) {
mm_policy=p_policy;
}
VisualServer::MipMapPolicy VisualServer::get_mipmap_policy() const {
return (VisualServer::MipMapPolicy)mm_policy;
}
DVector<String> VisualServer::_shader_get_param_list(RID p_shader) const {
@@ -93,38 +83,48 @@ RID VisualServer::texture_create_from_image(const Image& p_image,uint32_t p_flag
RID VisualServer::get_test_texture() {
if (test_texture) {
if (test_texture.is_valid()) {
return test_texture;
};
#define TEST_TEXTURE_SIZE 256
Image data(TEST_TEXTURE_SIZE,TEST_TEXTURE_SIZE,0,Image::FORMAT_RGB);
for (int x=0;x<TEST_TEXTURE_SIZE;x++) {
DVector<uint8_t> test_data;
test_data.resize(TEST_TEXTURE_SIZE*TEST_TEXTURE_SIZE*3);
for (int y=0;y<TEST_TEXTURE_SIZE;y++) {
{
DVector<uint8_t>::Write w=test_data.write();
Color c;
int r=255-(x+y)/2;
for (int x=0;x<TEST_TEXTURE_SIZE;x++) {
if ((x%(TEST_TEXTURE_SIZE/8))<2 ||(y%(TEST_TEXTURE_SIZE/8))<2) {
for (int y=0;y<TEST_TEXTURE_SIZE;y++) {
c.r=y;
c.g=r;
c.b=x;
Color c;
int r=255-(x+y)/2;
} else {
if ((x%(TEST_TEXTURE_SIZE/8))<2 ||(y%(TEST_TEXTURE_SIZE/8))<2) {
c.r=r;
c.g=x;
c.b=y;
c.r=y;
c.g=r;
c.b=x;
} else {
c.r=r;
c.g=x;
c.b=y;
}
w[(y*TEST_TEXTURE_SIZE+x)*3+0]=uint8_t(CLAMP(c.r*255,0,255));
w[(y*TEST_TEXTURE_SIZE+x)*3+1]=uint8_t(CLAMP(c.g*255,0,255));
w[(y*TEST_TEXTURE_SIZE+x)*3+2]=uint8_t(CLAMP(c.b*255,0,255));
}
data.put_pixel(x, y, c);
}
}
Image data(TEST_TEXTURE_SIZE,TEST_TEXTURE_SIZE,false,Image::FORMAT_RGB8,test_data);
test_texture = texture_create_from_image(data);
return test_texture;
@@ -217,10 +217,10 @@ RID VisualServer::_make_test_cube() {
indices.set(i,i);
d[VisualServer::ARRAY_INDEX]=indices;
mesh_add_surface( test_cube, PRIMITIVE_TRIANGLES,d );
mesh_add_surface_from_arrays( test_cube, PRIMITIVE_TRIANGLES,d );
/*
test_material = fixed_material_create();
//material_set_flag(material, MATERIAL_FLAG_BILLBOARD_TOGGLE,true);
fixed_material_set_texture( test_material, FIXED_MATERIAL_PARAM_DIFFUSE, get_test_texture() );
@@ -229,7 +229,7 @@ RID VisualServer::_make_test_cube() {
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, test_material );
return test_cube;
@@ -289,7 +289,7 @@ RID VisualServer::make_sphere_mesh(int p_lats,int p_lons,float p_radius) {
d[ARRAY_VERTEX]=vertices;
d[ARRAY_NORMAL]=normals;
mesh_add_surface(mesh,PRIMITIVE_TRIANGLES,d);
mesh_add_surface_from_arrays(mesh,PRIMITIVE_TRIANGLES,d);
return mesh;
}
@@ -311,7 +311,7 @@ RID VisualServer::material_2d_get(bool p_shaded, bool p_transparent, bool p_cut_
//not valid, make
material_2d[version]=fixed_material_create();
/* material_2d[version]=fixed_material_create();
fixed_material_set_flag(material_2d[version],FIXED_MATERIAL_FLAG_USE_ALPHA,p_transparent);
fixed_material_set_flag(material_2d[version],FIXED_MATERIAL_FLAG_USE_COLOR_ARRAY,true);
fixed_material_set_flag(material_2d[version],FIXED_MATERIAL_FLAG_DISCARD_ALPHA,p_cut_alpha);
@@ -319,7 +319,8 @@ RID VisualServer::material_2d_get(bool p_shaded, bool p_transparent, bool p_cut_
material_set_flag(material_2d[version],MATERIAL_FLAG_DOUBLE_SIDED,true);
material_set_depth_draw_mode(material_2d[version],p_opaque_prepass?MATERIAL_DEPTH_DRAW_OPAQUE_PRE_PASS_ALPHA:MATERIAL_DEPTH_DRAW_OPAQUE_ONLY);
fixed_material_set_texture(material_2d[version],FIXED_MATERIAL_PARAM_DIFFUSE,get_white_texture());
//material cut alpha?
//material cut alpha?*/
return material_2d[version];
}
@@ -335,14 +336,20 @@ RID VisualServer::get_white_texture() {
for(int i=0;i<16*3;i++)
w[i]=255;
}
Image white(4,4,0,Image::FORMAT_RGB,wt);
Image white(4,4,0,Image::FORMAT_RGB8,wt);
white_texture=texture_create();
texture_allocate(white_texture,4,4,Image::FORMAT_RGB);
texture_allocate(white_texture,4,4,Image::FORMAT_RGB8);
texture_set_data(white_texture,white);
return white_texture;
}
void VisualServer::mesh_add_surface_from_arrays(RID p_mesh,PrimitiveType p_primitive,const Array& p_arrays,const Array& p_blend_shapes,uint32_t p_compress_format) {
}
void VisualServer::_bind_methods() {
@@ -358,357 +365,15 @@ void VisualServer::_bind_methods() {
ObjectTypeDB::bind_method(_MD("texture_set_shrink_all_x2_on_set_data","shrink"),&VisualServer::texture_set_shrink_all_x2_on_set_data );
#ifndef _3D_DISABLED
ObjectTypeDB::bind_method(_MD("shader_create","mode"),&VisualServer::shader_create,DEFVAL(SHADER_MATERIAL));
ObjectTypeDB::bind_method(_MD("shader_set_mode","shader","mode"),&VisualServer::shader_set_mode);
ObjectTypeDB::bind_method(_MD("material_create"),&VisualServer::material_create);
ObjectTypeDB::bind_method(_MD("material_set_shader","shader"),&VisualServer::material_set_shader);
ObjectTypeDB::bind_method(_MD("material_get_shader"),&VisualServer::material_get_shader);
ObjectTypeDB::bind_method(_MD("material_set_param"),&VisualServer::material_set_param);
ObjectTypeDB::bind_method(_MD("material_get_param"),&VisualServer::material_get_param);
ObjectTypeDB::bind_method(_MD("material_set_flag"),&VisualServer::material_set_flag);
ObjectTypeDB::bind_method(_MD("material_get_flag"),&VisualServer::material_get_flag);
ObjectTypeDB::bind_method(_MD("material_set_blend_mode"),&VisualServer::material_set_blend_mode);
ObjectTypeDB::bind_method(_MD("material_get_blend_mode"),&VisualServer::material_get_blend_mode);
ObjectTypeDB::bind_method(_MD("material_set_line_width"),&VisualServer::material_set_line_width);
ObjectTypeDB::bind_method(_MD("material_get_line_width"),&VisualServer::material_get_line_width);
ObjectTypeDB::bind_method(_MD("mesh_create"),&VisualServer::mesh_create);
ObjectTypeDB::bind_method(_MD("mesh_add_surface"),&VisualServer::mesh_add_surface, DEFVAL(NO_INDEX_ARRAY));
ObjectTypeDB::bind_method(_MD("mesh_surface_set_material"),&VisualServer::mesh_surface_set_material,DEFVAL(false));
ObjectTypeDB::bind_method(_MD("mesh_surface_get_material"),&VisualServer::mesh_surface_get_material);
ObjectTypeDB::bind_method(_MD("mesh_surface_get_array_len"),&VisualServer::mesh_surface_get_array_len);
ObjectTypeDB::bind_method(_MD("mesh_surface_get_array_index_len"),&VisualServer::mesh_surface_get_array_index_len);
ObjectTypeDB::bind_method(_MD("mesh_surface_get_format"),&VisualServer::mesh_surface_get_format);
ObjectTypeDB::bind_method(_MD("mesh_surface_get_primitive_type"),&VisualServer::mesh_surface_get_primitive_type);
ObjectTypeDB::bind_method(_MD("mesh_remove_surface"),&VisualServer::mesh_remove_surface);
ObjectTypeDB::bind_method(_MD("mesh_get_surface_count"),&VisualServer::mesh_get_surface_count);
ObjectTypeDB::bind_method(_MD("multimesh_create"),&VisualServer::multimesh_create);
ObjectTypeDB::bind_method(_MD("multimesh_set_mesh"),&VisualServer::multimesh_set_mesh);
ObjectTypeDB::bind_method(_MD("multimesh_set_aabb"),&VisualServer::multimesh_set_aabb);
ObjectTypeDB::bind_method(_MD("multimesh_instance_set_transform"),&VisualServer::multimesh_instance_set_transform);
ObjectTypeDB::bind_method(_MD("multimesh_instance_set_color"),&VisualServer::multimesh_instance_set_color);
ObjectTypeDB::bind_method(_MD("multimesh_get_mesh"),&VisualServer::multimesh_get_mesh);
ObjectTypeDB::bind_method(_MD("multimesh_get_aabb"),&VisualServer::multimesh_get_aabb);
ObjectTypeDB::bind_method(_MD("multimesh_instance_get_transform"),&VisualServer::multimesh_instance_get_transform);
ObjectTypeDB::bind_method(_MD("multimesh_instance_get_color"),&VisualServer::multimesh_instance_get_color);
ObjectTypeDB::bind_method(_MD("particles_create"),&VisualServer::particles_create);
ObjectTypeDB::bind_method(_MD("particles_set_amount"),&VisualServer::particles_set_amount);
ObjectTypeDB::bind_method(_MD("particles_get_amount"),&VisualServer::particles_get_amount);
ObjectTypeDB::bind_method(_MD("particles_set_emitting"),&VisualServer::particles_set_emitting);
ObjectTypeDB::bind_method(_MD("particles_is_emitting"),&VisualServer::particles_is_emitting);
ObjectTypeDB::bind_method(_MD("particles_set_visibility_aabb"),&VisualServer::particles_set_visibility_aabb);
ObjectTypeDB::bind_method(_MD("particles_get_visibility_aabb"),&VisualServer::particles_get_visibility_aabb);
ObjectTypeDB::bind_method(_MD("particles_set_variable"),&VisualServer::particles_set_variable);
ObjectTypeDB::bind_method(_MD("particles_get_variable"),&VisualServer::particles_get_variable);
ObjectTypeDB::bind_method(_MD("particles_set_randomness"),&VisualServer::particles_set_randomness);
ObjectTypeDB::bind_method(_MD("particles_get_randomness"),&VisualServer::particles_get_randomness);
ObjectTypeDB::bind_method(_MD("particles_set_color_phases"),&VisualServer::particles_set_color_phases);
ObjectTypeDB::bind_method(_MD("particles_get_color_phases"),&VisualServer::particles_get_color_phases);
ObjectTypeDB::bind_method(_MD("particles_set_color_phase_pos"),&VisualServer::particles_set_color_phase_pos);
ObjectTypeDB::bind_method(_MD("particles_get_color_phase_pos"),&VisualServer::particles_get_color_phase_pos);
ObjectTypeDB::bind_method(_MD("particles_set_color_phase_color"),&VisualServer::particles_set_color_phase_color);
ObjectTypeDB::bind_method(_MD("particles_get_color_phase_color"),&VisualServer::particles_get_color_phase_color);
ObjectTypeDB::bind_method(_MD("particles_set_attractors"),&VisualServer::particles_set_attractors);
ObjectTypeDB::bind_method(_MD("particles_get_attractors"),&VisualServer::particles_get_attractors);
ObjectTypeDB::bind_method(_MD("particles_set_attractor_pos"),&VisualServer::particles_set_attractor_pos);
ObjectTypeDB::bind_method(_MD("particles_get_attractor_pos"),&VisualServer::particles_get_attractor_pos);
ObjectTypeDB::bind_method(_MD("particles_set_attractor_strength"),&VisualServer::particles_set_attractor_strength);
ObjectTypeDB::bind_method(_MD("particles_get_attractor_strength"),&VisualServer::particles_get_attractor_strength);
ObjectTypeDB::bind_method(_MD("particles_set_material"),&VisualServer::particles_set_material,DEFVAL(false));
ObjectTypeDB::bind_method(_MD("particles_set_height_from_velocity"),&VisualServer::particles_set_height_from_velocity);
ObjectTypeDB::bind_method(_MD("particles_has_height_from_velocity"),&VisualServer::particles_has_height_from_velocity);
ObjectTypeDB::bind_method(_MD("light_create"),&VisualServer::light_create);
ObjectTypeDB::bind_method(_MD("light_get_type"),&VisualServer::light_get_type);
ObjectTypeDB::bind_method(_MD("light_set_color"),&VisualServer::light_set_color);
ObjectTypeDB::bind_method(_MD("light_get_color"),&VisualServer::light_get_color);
ObjectTypeDB::bind_method(_MD("light_set_shadow"),&VisualServer::light_set_shadow);
ObjectTypeDB::bind_method(_MD("light_has_shadow"),&VisualServer::light_has_shadow);
ObjectTypeDB::bind_method(_MD("light_set_volumetric"),&VisualServer::light_set_volumetric);
ObjectTypeDB::bind_method(_MD("light_is_volumetric"),&VisualServer::light_is_volumetric);
ObjectTypeDB::bind_method(_MD("light_set_projector"),&VisualServer::light_set_projector);
ObjectTypeDB::bind_method(_MD("light_get_projector"),&VisualServer::light_get_projector);
ObjectTypeDB::bind_method(_MD("light_set_var"),&VisualServer::light_set_param);
ObjectTypeDB::bind_method(_MD("light_get_var"),&VisualServer::light_get_param);
ObjectTypeDB::bind_method(_MD("skeleton_create"),&VisualServer::skeleton_create);
ObjectTypeDB::bind_method(_MD("skeleton_resize"),&VisualServer::skeleton_resize);
ObjectTypeDB::bind_method(_MD("skeleton_get_bone_count"),&VisualServer::skeleton_get_bone_count);
ObjectTypeDB::bind_method(_MD("skeleton_bone_set_transform"),&VisualServer::skeleton_bone_set_transform);
ObjectTypeDB::bind_method(_MD("skeleton_bone_get_transform"),&VisualServer::skeleton_bone_get_transform);
ObjectTypeDB::bind_method(_MD("room_create"),&VisualServer::room_create);
ObjectTypeDB::bind_method(_MD("room_set_bounds"),&VisualServer::room_set_bounds);
ObjectTypeDB::bind_method(_MD("room_get_bounds"),&VisualServer::room_get_bounds);
ObjectTypeDB::bind_method(_MD("portal_create"),&VisualServer::portal_create);
ObjectTypeDB::bind_method(_MD("portal_set_shape"),&VisualServer::portal_set_shape);
ObjectTypeDB::bind_method(_MD("portal_get_shape"),&VisualServer::portal_get_shape);
ObjectTypeDB::bind_method(_MD("portal_set_enabled"),&VisualServer::portal_set_enabled);
ObjectTypeDB::bind_method(_MD("portal_is_enabled"),&VisualServer::portal_is_enabled);
ObjectTypeDB::bind_method(_MD("portal_set_disable_distance"),&VisualServer::portal_set_disable_distance);
ObjectTypeDB::bind_method(_MD("portal_get_disable_distance"),&VisualServer::portal_get_disable_distance);
ObjectTypeDB::bind_method(_MD("portal_set_disabled_color"),&VisualServer::portal_set_disabled_color);
ObjectTypeDB::bind_method(_MD("portal_get_disabled_color"),&VisualServer::portal_get_disabled_color);
ObjectTypeDB::bind_method(_MD("camera_create"),&VisualServer::camera_create);
ObjectTypeDB::bind_method(_MD("camera_set_perspective"),&VisualServer::camera_set_perspective);
ObjectTypeDB::bind_method(_MD("camera_set_orthogonal"),&VisualServer::_camera_set_orthogonal);
ObjectTypeDB::bind_method(_MD("camera_set_transform"),&VisualServer::camera_set_transform);
ObjectTypeDB::bind_method(_MD("viewport_create"),&VisualServer::viewport_create);
ObjectTypeDB::bind_method(_MD("viewport_set_rect"),&VisualServer::_viewport_set_rect);
ObjectTypeDB::bind_method(_MD("viewport_get_rect"),&VisualServer::_viewport_get_rect);
ObjectTypeDB::bind_method(_MD("viewport_attach_camera"),&VisualServer::viewport_attach_camera,DEFVAL(RID()));
ObjectTypeDB::bind_method(_MD("viewport_get_attached_camera"),&VisualServer::viewport_get_attached_camera);
ObjectTypeDB::bind_method(_MD("viewport_get_scenario"),&VisualServer::viewport_get_scenario);
ObjectTypeDB::bind_method(_MD("viewport_attach_canvas"),&VisualServer::viewport_attach_canvas);
ObjectTypeDB::bind_method(_MD("viewport_remove_canvas"),&VisualServer::viewport_remove_canvas);
ObjectTypeDB::bind_method(_MD("viewport_set_global_canvas_transform"),&VisualServer::viewport_set_global_canvas_transform);
ObjectTypeDB::bind_method(_MD("scenario_create"),&VisualServer::scenario_create);
ObjectTypeDB::bind_method(_MD("scenario_set_debug"),&VisualServer::scenario_set_debug);
ObjectTypeDB::bind_method(_MD("instance_create"),&VisualServer::instance_create,DEFVAL(RID()));
ObjectTypeDB::bind_method(_MD("instance_get_base"),&VisualServer::instance_get_base);
ObjectTypeDB::bind_method(_MD("instance_get_base_aabb"),&VisualServer::instance_get_base);
ObjectTypeDB::bind_method(_MD("instance_set_transform"),&VisualServer::instance_set_transform);
ObjectTypeDB::bind_method(_MD("instance_get_transform"),&VisualServer::instance_get_transform);
ObjectTypeDB::bind_method(_MD("instance_attach_object_instance_ID"),&VisualServer::instance_attach_object_instance_ID);
ObjectTypeDB::bind_method(_MD("instance_get_object_instance_ID"),&VisualServer::instance_get_object_instance_ID);
ObjectTypeDB::bind_method(_MD("instance_attach_skeleton"),&VisualServer::instance_attach_skeleton);
ObjectTypeDB::bind_method(_MD("instance_get_skeleton"),&VisualServer::instance_get_skeleton);
ObjectTypeDB::bind_method(_MD("instance_set_room"),&VisualServer::instance_set_room);
ObjectTypeDB::bind_method(_MD("instance_get_room"),&VisualServer::instance_get_room);
ObjectTypeDB::bind_method(_MD("instance_set_exterior"),&VisualServer::instance_set_exterior);
ObjectTypeDB::bind_method(_MD("instance_is_exterior"),&VisualServer::instance_is_exterior);
ObjectTypeDB::bind_method(_MD("instances_cull_aabb"),&VisualServer::instances_cull_aabb);
ObjectTypeDB::bind_method(_MD("instances_cull_ray"),&VisualServer::instances_cull_ray);
ObjectTypeDB::bind_method(_MD("instances_cull_convex"),&VisualServer::instances_cull_convex);
ObjectTypeDB::bind_method(_MD("instance_geometry_override_material_param"),&VisualServer::instance_get_room);
ObjectTypeDB::bind_method(_MD("instance_geometry_get_material_param"),&VisualServer::instance_get_room);
ObjectTypeDB::bind_method(_MD("get_test_cube"),&VisualServer::get_test_cube);
#endif
ObjectTypeDB::bind_method(_MD("canvas_create"),&VisualServer::canvas_create);
ObjectTypeDB::bind_method(_MD("canvas_item_create"),&VisualServer::canvas_item_create);
ObjectTypeDB::bind_method(_MD("canvas_item_set_parent"),&VisualServer::canvas_item_set_parent);
ObjectTypeDB::bind_method(_MD("canvas_item_get_parent"),&VisualServer::canvas_item_get_parent);
ObjectTypeDB::bind_method(_MD("canvas_item_set_transform"),&VisualServer::canvas_item_set_transform);
ObjectTypeDB::bind_method(_MD("canvas_item_set_custom_rect"),&VisualServer::canvas_item_set_custom_rect);
ObjectTypeDB::bind_method(_MD("canvas_item_set_clip"),&VisualServer::canvas_item_set_clip);
ObjectTypeDB::bind_method(_MD("canvas_item_set_opacity"),&VisualServer::canvas_item_set_opacity);
ObjectTypeDB::bind_method(_MD("canvas_item_get_opacity"),&VisualServer::canvas_item_get_opacity);
ObjectTypeDB::bind_method(_MD("canvas_item_set_self_opacity"),&VisualServer::canvas_item_set_self_opacity);
ObjectTypeDB::bind_method(_MD("canvas_item_get_self_opacity"),&VisualServer::canvas_item_get_self_opacity);
ObjectTypeDB::bind_method(_MD("canvas_item_set_z"),&VisualServer::canvas_item_set_z);
ObjectTypeDB::bind_method(_MD("canvas_item_add_line"),&VisualServer::canvas_item_add_line, DEFVAL(1.0), DEFVAL(false));
ObjectTypeDB::bind_method(_MD("canvas_item_add_rect"),&VisualServer::canvas_item_add_rect);
ObjectTypeDB::bind_method(_MD("canvas_item_add_texture_rect"),&VisualServer::canvas_item_add_texture_rect, DEFVAL(Color(1,1,1)), DEFVAL(false));
ObjectTypeDB::bind_method(_MD("canvas_item_add_texture_rect_region"),&VisualServer::canvas_item_add_texture_rect_region, DEFVAL(Color(1,1,1)), DEFVAL(false));
ObjectTypeDB::bind_method(_MD("canvas_item_add_style_box"),&VisualServer::_canvas_item_add_style_box, DEFVAL(Color(1,1,1)));
// ObjectTypeDB::bind_method(_MD("canvas_item_add_primitive"),&VisualServer::canvas_item_add_primitive,DEFVAL(Vector<Vector2>()),DEFVAL(RID()));
ObjectTypeDB::bind_method(_MD("canvas_item_add_circle"),&VisualServer::canvas_item_add_circle);
ObjectTypeDB::bind_method(_MD("viewport_set_canvas_transform"),&VisualServer::viewport_set_canvas_transform);
ObjectTypeDB::bind_method(_MD("canvas_item_clear"),&VisualServer::canvas_item_clear);
ObjectTypeDB::bind_method(_MD("canvas_item_raise"),&VisualServer::canvas_item_raise);
ObjectTypeDB::bind_method(_MD("cursor_set_rotation"),&VisualServer::cursor_set_rotation);
ObjectTypeDB::bind_method(_MD("cursor_set_texture"),&VisualServer::cursor_set_texture);
ObjectTypeDB::bind_method(_MD("cursor_set_visible"),&VisualServer::cursor_set_visible);
ObjectTypeDB::bind_method(_MD("cursor_set_pos"),&VisualServer::cursor_set_pos);
ObjectTypeDB::bind_method(_MD("black_bars_set_margins","left","top","right","bottom"),&VisualServer::black_bars_set_margins);
ObjectTypeDB::bind_method(_MD("black_bars_set_images","left","top","right","bottom"),&VisualServer::black_bars_set_images);
ObjectTypeDB::bind_method(_MD("make_sphere_mesh"),&VisualServer::make_sphere_mesh);
ObjectTypeDB::bind_method(_MD("mesh_add_surface_from_planes"),&VisualServer::mesh_add_surface_from_planes);
ObjectTypeDB::bind_method(_MD("draw"),&VisualServer::draw);
ObjectTypeDB::bind_method(_MD("sync"),&VisualServer::sync);
ObjectTypeDB::bind_method(_MD("free_rid"),&VisualServer::free);
ObjectTypeDB::bind_method(_MD("set_default_clear_color"),&VisualServer::set_default_clear_color);
ObjectTypeDB::bind_method(_MD("get_render_info"),&VisualServer::get_render_info);
BIND_CONSTANT( NO_INDEX_ARRAY );
BIND_CONSTANT( CUSTOM_ARRAY_SIZE );
BIND_CONSTANT( ARRAY_WEIGHTS_SIZE );
BIND_CONSTANT( MAX_PARTICLE_COLOR_PHASES );
BIND_CONSTANT( MAX_PARTICLE_ATTRACTORS );
BIND_CONSTANT( MAX_CURSORS );
BIND_CONSTANT( TEXTURE_FLAG_MIPMAPS );
BIND_CONSTANT( TEXTURE_FLAG_REPEAT );
BIND_CONSTANT( TEXTURE_FLAG_FILTER );
BIND_CONSTANT( TEXTURE_FLAG_CUBEMAP );
BIND_CONSTANT( TEXTURE_FLAGS_DEFAULT );
BIND_CONSTANT( CUBEMAP_LEFT );
BIND_CONSTANT( CUBEMAP_RIGHT );
BIND_CONSTANT( CUBEMAP_BOTTOM );
BIND_CONSTANT( CUBEMAP_TOP );
BIND_CONSTANT( CUBEMAP_FRONT );
BIND_CONSTANT( CUBEMAP_BACK );
BIND_CONSTANT( SHADER_MATERIAL ); ///< param 0: name
BIND_CONSTANT( SHADER_POST_PROCESS ); ///< param 0: name
BIND_CONSTANT( MATERIAL_FLAG_VISIBLE );
BIND_CONSTANT( MATERIAL_FLAG_DOUBLE_SIDED );
BIND_CONSTANT( MATERIAL_FLAG_INVERT_FACES );
BIND_CONSTANT( MATERIAL_FLAG_UNSHADED );
BIND_CONSTANT( MATERIAL_FLAG_ONTOP );
BIND_CONSTANT( MATERIAL_FLAG_MAX );
BIND_CONSTANT( MATERIAL_BLEND_MODE_MIX );
BIND_CONSTANT( MATERIAL_BLEND_MODE_ADD );
BIND_CONSTANT( MATERIAL_BLEND_MODE_SUB );
BIND_CONSTANT( MATERIAL_BLEND_MODE_MUL );
BIND_CONSTANT( FIXED_MATERIAL_PARAM_DIFFUSE );
BIND_CONSTANT( FIXED_MATERIAL_PARAM_DETAIL );
BIND_CONSTANT( FIXED_MATERIAL_PARAM_SPECULAR );
BIND_CONSTANT( FIXED_MATERIAL_PARAM_EMISSION );
BIND_CONSTANT( FIXED_MATERIAL_PARAM_SPECULAR_EXP );
BIND_CONSTANT( FIXED_MATERIAL_PARAM_GLOW );
BIND_CONSTANT( FIXED_MATERIAL_PARAM_NORMAL );
BIND_CONSTANT( FIXED_MATERIAL_PARAM_SHADE_PARAM );
BIND_CONSTANT( FIXED_MATERIAL_PARAM_MAX );
BIND_CONSTANT( FIXED_MATERIAL_TEXCOORD_SPHERE );
BIND_CONSTANT( FIXED_MATERIAL_TEXCOORD_UV );
BIND_CONSTANT( FIXED_MATERIAL_TEXCOORD_UV_TRANSFORM );
BIND_CONSTANT( FIXED_MATERIAL_TEXCOORD_UV2 );
BIND_CONSTANT( ARRAY_VERTEX );
BIND_CONSTANT( ARRAY_NORMAL );
BIND_CONSTANT( ARRAY_TANGENT );
BIND_CONSTANT( ARRAY_COLOR );
BIND_CONSTANT( ARRAY_TEX_UV );
BIND_CONSTANT( ARRAY_BONES );
BIND_CONSTANT( ARRAY_WEIGHTS );
BIND_CONSTANT( ARRAY_INDEX );
BIND_CONSTANT( ARRAY_MAX );
BIND_CONSTANT( ARRAY_FORMAT_VERTEX );
BIND_CONSTANT( ARRAY_FORMAT_NORMAL );
BIND_CONSTANT( ARRAY_FORMAT_TANGENT );
BIND_CONSTANT( ARRAY_FORMAT_COLOR );
BIND_CONSTANT( ARRAY_FORMAT_TEX_UV );
BIND_CONSTANT( ARRAY_FORMAT_BONES );
BIND_CONSTANT( ARRAY_FORMAT_WEIGHTS );
BIND_CONSTANT( ARRAY_FORMAT_INDEX );
BIND_CONSTANT( PRIMITIVE_POINTS );
BIND_CONSTANT( PRIMITIVE_LINES );
BIND_CONSTANT( PRIMITIVE_LINE_STRIP );
BIND_CONSTANT( PRIMITIVE_LINE_LOOP );
BIND_CONSTANT( PRIMITIVE_TRIANGLES );
BIND_CONSTANT( PRIMITIVE_TRIANGLE_STRIP );
BIND_CONSTANT( PRIMITIVE_TRIANGLE_FAN );
BIND_CONSTANT( PRIMITIVE_MAX );
BIND_CONSTANT( PARTICLE_LIFETIME );
BIND_CONSTANT( PARTICLE_SPREAD );
BIND_CONSTANT( PARTICLE_GRAVITY );
BIND_CONSTANT( PARTICLE_LINEAR_VELOCITY );
BIND_CONSTANT( PARTICLE_ANGULAR_VELOCITY );
BIND_CONSTANT( PARTICLE_LINEAR_ACCELERATION );
BIND_CONSTANT( PARTICLE_RADIAL_ACCELERATION );
BIND_CONSTANT( PARTICLE_TANGENTIAL_ACCELERATION );
BIND_CONSTANT( PARTICLE_INITIAL_SIZE );
BIND_CONSTANT( PARTICLE_FINAL_SIZE );
BIND_CONSTANT( PARTICLE_INITIAL_ANGLE );
BIND_CONSTANT( PARTICLE_HEIGHT );
BIND_CONSTANT( PARTICLE_HEIGHT_SPEED_SCALE );
BIND_CONSTANT( PARTICLE_VAR_MAX );
BIND_CONSTANT( LIGHT_DIRECTIONAL );
BIND_CONSTANT( LIGHT_OMNI );
BIND_CONSTANT( LIGHT_SPOT );
BIND_CONSTANT( LIGHT_COLOR_DIFFUSE );
BIND_CONSTANT( LIGHT_COLOR_SPECULAR );
BIND_CONSTANT( LIGHT_PARAM_SPOT_ATTENUATION );
BIND_CONSTANT( LIGHT_PARAM_SPOT_ANGLE );
BIND_CONSTANT( LIGHT_PARAM_RADIUS );
BIND_CONSTANT( LIGHT_PARAM_ENERGY );
BIND_CONSTANT( LIGHT_PARAM_ATTENUATION );
BIND_CONSTANT( LIGHT_PARAM_MAX );
BIND_CONSTANT( SCENARIO_DEBUG_DISABLED );
BIND_CONSTANT( SCENARIO_DEBUG_WIREFRAME );
BIND_CONSTANT( SCENARIO_DEBUG_OVERDRAW );
BIND_CONSTANT( INSTANCE_MESH );
BIND_CONSTANT( INSTANCE_MULTIMESH );
BIND_CONSTANT( INSTANCE_PARTICLES );
BIND_CONSTANT( INSTANCE_LIGHT );
BIND_CONSTANT( INSTANCE_ROOM );
BIND_CONSTANT( INSTANCE_PORTAL );
BIND_CONSTANT( INSTANCE_GEOMETRY_MASK );
BIND_CONSTANT( INFO_OBJECTS_IN_FRAME );
BIND_CONSTANT( INFO_VERTICES_IN_FRAME );
BIND_CONSTANT( INFO_MATERIAL_CHANGES_IN_FRAME );
BIND_CONSTANT( INFO_SHADER_CHANGES_IN_FRAME );
BIND_CONSTANT( INFO_SURFACE_CHANGES_IN_FRAME );
BIND_CONSTANT( INFO_DRAW_CALLS_IN_FRAME );
BIND_CONSTANT( INFO_USAGE_VIDEO_MEM_TOTAL );
BIND_CONSTANT( INFO_VIDEO_MEM_USED );
BIND_CONSTANT( INFO_TEXTURE_MEM_USED );
BIND_CONSTANT( INFO_VERTEX_MEM_USED );
}
void VisualServer::_canvas_item_add_style_box(RID p_item, const Rect2& p_rect, const Rect2& p_source, RID p_texture,const Vector<float>& p_margins, const Color& p_modulate) {
ERR_FAIL_COND(p_margins.size()!=4);
canvas_item_add_style_box(p_item,p_rect,p_source,p_texture,Vector2(p_margins[0],p_margins[1]),Vector2(p_margins[2],p_margins[3]),true,p_modulate);
//canvas_item_add_style_box(p_item,p_rect,p_source,p_texture,Vector2(p_margins[0],p_margins[1]),Vector2(p_margins[2],p_margins[3]),true,p_modulate);
}
void VisualServer::_camera_set_orthogonal(RID p_camera,float p_size,float p_z_near,float p_z_far) {
@@ -716,21 +381,6 @@ void VisualServer::_camera_set_orthogonal(RID p_camera,float p_size,float p_z_ne
camera_set_orthogonal(p_camera,p_size,p_z_near,p_z_far);
}
void VisualServer::_viewport_set_rect(RID p_viewport,const Rect2& p_rect) {
ViewportRect r;
r.x=p_rect.pos.x;
r.y=p_rect.pos.y;
r.width=p_rect.size.x;
r.height=p_rect.size.y;
viewport_set_rect(p_viewport,r);
}
Rect2 VisualServer::_viewport_get_rect(RID p_viewport) const {
ViewportRect r=viewport_get_rect(p_viewport);
return Rect2(r.x,r.y,r.width,r.height);
}
@@ -761,7 +411,7 @@ void VisualServer::mesh_add_surface_from_mesh_data( RID p_mesh, const Geometry::
d.resize(VS::ARRAY_MAX);
d[ARRAY_VERTEX]=vertices;
d[ARRAY_NORMAL]=normals;
mesh_add_surface(p_mesh,PRIMITIVE_TRIANGLES, d);
mesh_add_surface_from_arrays(p_mesh,PRIMITIVE_TRIANGLES, d);
#else
@@ -810,9 +460,6 @@ VisualServer::VisualServer() {
// ERR_FAIL_COND(singleton);
singleton=this;
mm_policy=GLOBAL_DEF("render/mipmap_policy",0);
if (mm_policy<0 || mm_policy>2)
mm_policy=0;
}