diff options
Diffstat (limited to 'servers/visual')
-rw-r--r-- | servers/visual/rasterizer.h | 17 | ||||
-rw-r--r-- | servers/visual/shader_language.cpp | 174 | ||||
-rw-r--r-- | servers/visual/shader_language.h | 2 | ||||
-rw-r--r-- | servers/visual/shader_types.cpp | 9 | ||||
-rw-r--r-- | servers/visual/visual_server_canvas.cpp | 41 | ||||
-rw-r--r-- | servers/visual/visual_server_canvas.h | 7 | ||||
-rw-r--r-- | servers/visual/visual_server_raster.cpp | 1 | ||||
-rw-r--r-- | servers/visual/visual_server_raster.h | 10 | ||||
-rw-r--r-- | servers/visual/visual_server_scene.cpp | 6 | ||||
-rw-r--r-- | servers/visual/visual_server_scene.h | 2 | ||||
-rw-r--r-- | servers/visual/visual_server_viewport.cpp | 46 | ||||
-rw-r--r-- | servers/visual/visual_server_viewport.h | 3 | ||||
-rw-r--r-- | servers/visual/visual_server_wrap_mt.h | 10 |
13 files changed, 235 insertions, 93 deletions
diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h index f2bb853a3b..8d8e9e693e 100644 --- a/servers/visual/rasterizer.h +++ b/servers/visual/rasterizer.h @@ -175,6 +175,7 @@ public: virtual RID texture_create() = 0; virtual void texture_allocate(RID p_texture, int p_width, int p_height, Image::Format p_format, uint32_t p_flags = VS::TEXTURE_FLAGS_DEFAULT) = 0; virtual void texture_set_data(RID p_texture, const Ref<Image> &p_image, VS::CubeMapSide p_cube_side = VS::CUBEMAP_LEFT) = 0; + virtual void texture_set_data_partial(RID p_texture, const Ref<Image> &p_image, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int p_dst_mip, VS::CubeMapSide p_cube_side = VS::CUBEMAP_LEFT) = 0; virtual Ref<Image> texture_get_data(RID p_texture, VS::CubeMapSide p_cube_side = VS::CUBEMAP_LEFT) const = 0; virtual void texture_set_flags(RID p_texture, uint32_t p_flags) = 0; virtual uint32_t texture_get_flags(RID p_texture) const = 0; @@ -325,6 +326,7 @@ public: virtual Transform skeleton_bone_get_transform(RID p_skeleton, int p_bone) const = 0; virtual void skeleton_bone_set_transform_2d(RID p_skeleton, int p_bone, const Transform2D &p_transform) = 0; virtual Transform2D skeleton_bone_get_transform_2d(RID p_skeleton, int p_bone) const = 0; + virtual void skeleton_set_base_transform_2d(RID p_skeleton, const Transform2D &p_base_transform) = 0; /* Light API */ @@ -513,6 +515,7 @@ public: RENDER_TARGET_NO_3D, RENDER_TARGET_NO_SAMPLING, RENDER_TARGET_HDR, + RENDER_TARGET_KEEP_3D_LINEAR, RENDER_TARGET_FLAG_MAX }; @@ -735,6 +738,8 @@ public: Vector<Point2> points; Vector<Point2> uvs; Vector<Color> colors; + Vector<int> bones; + Vector<float> weights; RID texture; RID normal_map; int count; @@ -749,14 +754,16 @@ public: struct CommandMesh : public Command { RID mesh; - RID skeleton; + RID texture; + RID normal_map; CommandMesh() { type = TYPE_MESH; } }; struct CommandMultiMesh : public Command { RID multimesh; - RID skeleton; + RID texture; + RID normal_map; CommandMultiMesh() { type = TYPE_MULTIMESH; } }; @@ -810,6 +817,8 @@ public: mutable bool rect_dirty; mutable Rect2 rect; RID material; + RID skeleton; + Item *next; struct CopyBackBuffer { @@ -920,7 +929,7 @@ public: case Item::Command::TYPE_MESH: { const Item::CommandMesh *mesh = static_cast<const Item::CommandMesh *>(c); - AABB aabb = RasterizerStorage::base_singleton->mesh_get_aabb(mesh->mesh, mesh->skeleton); + AABB aabb = RasterizerStorage::base_singleton->mesh_get_aabb(mesh->mesh, RID()); r = Rect2(aabb.position.x, aabb.position.y, aabb.size.x, aabb.size.y); @@ -1012,7 +1021,7 @@ public: virtual void canvas_begin() = 0; virtual void canvas_end() = 0; - virtual void canvas_render_items(Item *p_item_list, int p_z, const Color &p_modulate, Light *p_light) = 0; + virtual void canvas_render_items(Item *p_item_list, int p_z, const Color &p_modulate, Light *p_light, const Transform2D &p_base_transform) = 0; virtual void canvas_debug_viewport_shadows(Light *p_lights_with_shadow) = 0; struct LightOccluderInstance : public RID_Data { diff --git a/servers/visual/shader_language.cpp b/servers/visual/shader_language.cpp index 29c27eee85..d399c548f3 100644 --- a/servers/visual/shader_language.cpp +++ b/servers/visual/shader_language.cpp @@ -124,6 +124,9 @@ const char *ShaderLanguage::token_names[TK_MAX] = { "TYPE_ISAMPLER2D", "TYPE_USAMPLER2D", "TYPE_SAMPLERCUBE", + "INTERPOLATION_FLAT", + "INTERPOLATION_NO_PERSPECTIVE", + "INTERPOLATION_SMOOTH", "PRECISION_LOW", "PRECISION_MID", "PRECISION_HIGH", @@ -1374,6 +1377,17 @@ const ShaderLanguage::BuiltinFuncDef ShaderLanguage::builtin_func_defs[] = { { "bvec4", TYPE_BVEC4, { TYPE_VEC4, TYPE_VOID } }, //builtins - trigonometry + + { "radians", TYPE_FLOAT, { TYPE_FLOAT, TYPE_VOID } }, + { "radians", TYPE_VEC2, { TYPE_VEC2, TYPE_VOID } }, + { "radians", TYPE_VEC3, { TYPE_VEC3, TYPE_VOID } }, + { "radians", TYPE_VEC4, { TYPE_VEC4, TYPE_VOID } }, + + { "degrees", TYPE_FLOAT, { TYPE_FLOAT, TYPE_VOID } }, + { "degrees", TYPE_VEC2, { TYPE_VEC2, TYPE_VOID } }, + { "degrees", TYPE_VEC3, { TYPE_VEC3, TYPE_VOID } }, + { "degrees", TYPE_VEC4, { TYPE_VEC4, TYPE_VOID } }, + { "sin", TYPE_FLOAT, { TYPE_FLOAT, TYPE_VOID } }, { "sin", TYPE_VEC2, { TYPE_VEC2, TYPE_VOID } }, { "sin", TYPE_VEC3, { TYPE_VEC3, TYPE_VOID } }, @@ -1423,6 +1437,21 @@ const ShaderLanguage::BuiltinFuncDef ShaderLanguage::builtin_func_defs[] = { { "tanh", TYPE_VEC3, { TYPE_VEC3, TYPE_VOID } }, { "tanh", TYPE_VEC4, { TYPE_VEC4, TYPE_VOID } }, + { "asinh", TYPE_FLOAT, { TYPE_FLOAT, TYPE_VOID } }, + { "asinh", TYPE_VEC2, { TYPE_VEC2, TYPE_VOID } }, + { "asinh", TYPE_VEC3, { TYPE_VEC3, TYPE_VOID } }, + { "asinh", TYPE_VEC4, { TYPE_VEC4, TYPE_VOID } }, + + { "acosh", TYPE_FLOAT, { TYPE_FLOAT, TYPE_VOID } }, + { "acosh", TYPE_VEC2, { TYPE_VEC2, TYPE_VOID } }, + { "acosh", TYPE_VEC3, { TYPE_VEC3, TYPE_VOID } }, + { "acosh", TYPE_VEC4, { TYPE_VEC4, TYPE_VOID } }, + + { "atanh", TYPE_FLOAT, { TYPE_FLOAT, TYPE_VOID } }, + { "atanh", TYPE_VEC2, { TYPE_VEC2, TYPE_VOID } }, + { "atanh", TYPE_VEC3, { TYPE_VEC3, TYPE_VOID } }, + { "atanh", TYPE_VEC4, { TYPE_VEC4, TYPE_VOID } }, + //builtins - exponential { "pow", TYPE_FLOAT, { TYPE_FLOAT, TYPE_FLOAT, TYPE_VOID } }, { "pow", TYPE_VEC2, { TYPE_VEC2, TYPE_VEC2, TYPE_VOID } }, @@ -1436,6 +1465,14 @@ const ShaderLanguage::BuiltinFuncDef ShaderLanguage::builtin_func_defs[] = { { "log", TYPE_VEC2, { TYPE_VEC2, TYPE_VOID } }, { "log", TYPE_VEC3, { TYPE_VEC3, TYPE_VOID } }, { "log", TYPE_VEC4, { TYPE_VEC4, TYPE_VOID } }, + { "exp2", TYPE_FLOAT, { TYPE_FLOAT, TYPE_VOID } }, + { "exp2", TYPE_VEC2, { TYPE_VEC2, TYPE_VOID } }, + { "exp2", TYPE_VEC3, { TYPE_VEC3, TYPE_VOID } }, + { "exp2", TYPE_VEC4, { TYPE_VEC4, TYPE_VOID } }, + { "log2", TYPE_FLOAT, { TYPE_FLOAT, TYPE_VOID } }, + { "log2", TYPE_VEC2, { TYPE_VEC2, TYPE_VOID } }, + { "log2", TYPE_VEC3, { TYPE_VEC3, TYPE_VOID } }, + { "log2", TYPE_VEC4, { TYPE_VEC4, TYPE_VOID } }, { "sqrt", TYPE_FLOAT, { TYPE_FLOAT, TYPE_VOID } }, { "sqrt", TYPE_VEC2, { TYPE_VEC2, TYPE_VOID } }, { "sqrt", TYPE_VEC3, { TYPE_VEC3, TYPE_VOID } }, @@ -1455,11 +1492,6 @@ const ShaderLanguage::BuiltinFuncDef ShaderLanguage::builtin_func_defs[] = { { "abs", TYPE_IVEC3, { TYPE_IVEC3, TYPE_VOID } }, { "abs", TYPE_IVEC4, { TYPE_IVEC4, TYPE_VOID } }, - { "abs", TYPE_UINT, { TYPE_UINT, TYPE_VOID } }, - { "abs", TYPE_UVEC2, { TYPE_UVEC2, TYPE_VOID } }, - { "abs", TYPE_UVEC3, { TYPE_UVEC3, TYPE_VOID } }, - { "abs", TYPE_UVEC4, { TYPE_UVEC4, TYPE_VOID } }, - { "sign", TYPE_FLOAT, { TYPE_FLOAT, TYPE_VOID } }, { "sign", TYPE_VEC2, { TYPE_VEC2, TYPE_VOID } }, { "sign", TYPE_VEC3, { TYPE_VEC3, TYPE_VOID } }, @@ -1482,6 +1514,10 @@ const ShaderLanguage::BuiltinFuncDef ShaderLanguage::builtin_func_defs[] = { { "round", TYPE_VEC2, { TYPE_VEC2, TYPE_VOID } }, { "round", TYPE_VEC3, { TYPE_VEC3, TYPE_VOID } }, { "round", TYPE_VEC4, { TYPE_VEC4, TYPE_VOID } }, + { "roundEven", TYPE_FLOAT, { TYPE_FLOAT, TYPE_VOID } }, + { "roundEven", TYPE_VEC2, { TYPE_VEC2, TYPE_VOID } }, + { "roundEven", TYPE_VEC3, { TYPE_VEC3, TYPE_VOID } }, + { "roundEven", TYPE_VEC4, { TYPE_VEC4, TYPE_VOID } }, { "ceil", TYPE_FLOAT, { TYPE_FLOAT, TYPE_VOID } }, { "ceil", TYPE_VEC2, { TYPE_VEC2, TYPE_VOID } }, { "ceil", TYPE_VEC3, { TYPE_VEC3, TYPE_VOID } }, @@ -1570,7 +1606,7 @@ const ShaderLanguage::BuiltinFuncDef ShaderLanguage::builtin_func_defs[] = { { "mix", TYPE_VEC3, { TYPE_VEC3, TYPE_VEC3, TYPE_VEC3, TYPE_VOID } }, { "mix", TYPE_VEC4, { TYPE_VEC4, TYPE_VEC4, TYPE_FLOAT, TYPE_VOID } }, { "mix", TYPE_VEC4, { TYPE_VEC4, TYPE_VEC4, TYPE_BOOL, TYPE_VOID } }, - { "mix", TYPE_VEC4, { TYPE_VEC4, TYPE_VEC4, TYPE_BVEC3, TYPE_VOID } }, + { "mix", TYPE_VEC4, { TYPE_VEC4, TYPE_VEC4, TYPE_BVEC4, TYPE_VOID } }, { "mix", TYPE_VEC4, { TYPE_VEC4, TYPE_VEC4, TYPE_VEC4, TYPE_VOID } }, { "step", TYPE_FLOAT, { TYPE_FLOAT, TYPE_FLOAT, TYPE_VOID } }, @@ -1603,10 +1639,10 @@ const ShaderLanguage::BuiltinFuncDef ShaderLanguage::builtin_func_defs[] = { { "floatBitsToInt", TYPE_IVEC3, { TYPE_VEC3, TYPE_VOID } }, { "floatBitsToInt", TYPE_IVEC4, { TYPE_VEC4, TYPE_VOID } }, - { "floatBitsToUInt", TYPE_UINT, { TYPE_FLOAT, TYPE_VOID } }, - { "floatBitsToUInt", TYPE_UVEC2, { TYPE_VEC2, TYPE_VOID } }, - { "floatBitsToUInt", TYPE_UVEC3, { TYPE_VEC3, TYPE_VOID } }, - { "floatBitsToUInt", TYPE_UVEC4, { TYPE_VEC4, TYPE_VOID } }, + { "floatBitsToUint", TYPE_UINT, { TYPE_FLOAT, TYPE_VOID } }, + { "floatBitsToUint", TYPE_UVEC2, { TYPE_VEC2, TYPE_VOID } }, + { "floatBitsToUint", TYPE_UVEC3, { TYPE_VEC3, TYPE_VOID } }, + { "floatBitsToUint", TYPE_UVEC4, { TYPE_VEC4, TYPE_VOID } }, { "intBitsToFloat", TYPE_FLOAT, { TYPE_INT, TYPE_VOID } }, { "intBitsToFloat", TYPE_VEC2, { TYPE_IVEC2, TYPE_VOID } }, @@ -2171,6 +2207,37 @@ ShaderLanguage::DataType ShaderLanguage::get_scalar_type(DataType p_type) { return scalar_types[p_type]; } +int ShaderLanguage::get_cardinality(DataType p_type) { + static const int cardinality_table[] = { + 0, + 1, + 2, + 3, + 4, + 1, + 2, + 3, + 4, + 1, + 2, + 3, + 4, + 1, + 2, + 3, + 4, + 2, + 3, + 4, + 1, + 1, + 1, + 1, + }; + + return cardinality_table[p_type]; +} + bool ShaderLanguage::_get_completable_identifier(BlockNode *p_block, CompletionType p_type, StringName &identifier) { identifier = StringName(); @@ -2641,7 +2708,6 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons return NULL; } - bool index_valid = false; DataType member_type = TYPE_VOID; switch (expr->get_datatype()) { @@ -2660,7 +2726,7 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons _set_error("Only integer constants are allowed as index at the moment"); return NULL; } - index_valid = true; + switch (expr->get_datatype()) { case TYPE_BVEC2: member_type = TYPE_BOOL; break; case TYPE_VEC2: member_type = TYPE_FLOAT; break; @@ -2685,7 +2751,7 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons _set_error("Only integer constants are allowed as index at the moment"); return NULL; } - index_valid = true; + switch (expr->get_datatype()) { case TYPE_BVEC3: member_type = TYPE_BOOL; break; case TYPE_VEC3: member_type = TYPE_FLOAT; break; @@ -2709,7 +2775,7 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons _set_error("Only integer constants are allowed as index at the moment"); return NULL; } - index_valid = true; + switch (expr->get_datatype()) { case TYPE_BVEC4: member_type = TYPE_BOOL; break; case TYPE_VEC4: member_type = TYPE_FLOAT; break; @@ -2724,11 +2790,6 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons } } - if (!index_valid) { - _set_error("Invalid index"); - return NULL; - } - OperatorNode *op = alloc_node<OperatorNode>(); op->op = OP_INDEX; op->return_cache = member_type; @@ -2930,7 +2991,7 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons expr_pos++; if (expr_pos == expression.size()) { //can happen.. - _set_error("Unexpected end of expression.."); + _set_error("Unexpected end of expression..."); return NULL; } } @@ -2967,12 +3028,12 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons } else if (is_ternary) { if (next_op < 1 || next_op >= (expression.size() - 1)) { - _set_error("Parser bug.."); + _set_error("Parser bug..."); ERR_FAIL_V(NULL); } if (next_op + 2 >= expression.size() || !expression[next_op + 2].is_op || expression[next_op + 2].op != OP_SELECT_ELSE) { - _set_error("Mising matching ':' for select operator"); + _set_error("Missing matching ':' for select operator"); return NULL; } @@ -3003,7 +3064,7 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons } else { if (next_op < 1 || next_op >= (expression.size() - 1)) { - _set_error("Parser bug.."); + _set_error("Parser bug..."); ERR_FAIL_V(NULL); } @@ -3012,7 +3073,7 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons if (expression[next_op - 1].is_op) { - _set_error("Parser bug.."); + _set_error("Parser bug..."); ERR_FAIL_V(NULL); } @@ -3028,7 +3089,7 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons // can be followed by a unary op in a valid combination, // due to how precedence works, unaries will always disappear first - _set_error("Parser bug.."); + _set_error("Parser bug..."); } op->arguments.push_back(expression[next_op - 1].node); //expression goes as left @@ -3081,9 +3142,18 @@ ShaderLanguage::Node *ShaderLanguage::_reduce_expression(BlockNode *p_block, Sha if (get_scalar_type(cn->datatype) == base) { - for (int j = 0; j < cn->values.size(); j++) { - values.push_back(cn->values[j]); - } + int cardinality = get_cardinality(op->arguments[i]->get_datatype()); + if (cn->values.size() == cardinality) { + + for (int j = 0; j < cn->values.size(); j++) { + values.push_back(cn->values[j]); + } + } else if (cn->values.size() == 1) { + + for (int j = 0; j < cardinality; j++) { + values.push_back(cn->values[0]); + } + } // else: should be filtered by the parser as it's an invalid constructor } else if (get_scalar_type(cn->datatype) == cn->datatype) { ConstantNode::Value v; @@ -3177,7 +3247,7 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const Map<StringName, Bui precision = get_token_precision(tk.type); tk = _get_token(); if (!is_token_nonvoid_datatype(tk.type)) { - _set_error("Expected datatype after precission"); + _set_error("Expected datatype after precision"); return ERR_PARSE_ERROR; } } @@ -3475,7 +3545,7 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const Map<StringName, Bui if (!p_can_break) { //all is good - _set_error("Contiuning is not allowed here"); + _set_error("Continuing is not allowed here"); } ControlFlowNode *flow = alloc_node<ControlFlowNode>(); @@ -3626,7 +3696,8 @@ Error ShaderLanguage::_parse_shader(const Map<StringName, FunctionInfo> &p_funct _set_error("void datatype not allowed here"); return ERR_PARSE_ERROR; } - if (!uniform && type < TYPE_FLOAT && type > TYPE_VEC4) { // FIXME: always false! should it be || instead? + + if (!uniform && (type < TYPE_FLOAT || type > TYPE_VEC4)) { _set_error("Invalid type for varying, only float,vec2,vec3,vec4 allowed."); return ERR_PARSE_ERROR; } @@ -3661,26 +3732,6 @@ Error ShaderLanguage::_parse_shader(const Map<StringName, FunctionInfo> &p_funct //todo parse default value tk = _get_token(); - if (tk.type == TK_OP_ASSIGN) { - - Node *expr = _parse_and_reduce_expression(NULL, Map<StringName, BuiltInInfo>()); - if (!expr) - return ERR_PARSE_ERROR; - if (expr->type != Node::TYPE_CONSTANT) { - _set_error("Expected constant expression after '='"); - return ERR_PARSE_ERROR; - } - - ConstantNode *cn = static_cast<ConstantNode *>(expr); - - uniform.default_value.resize(cn->values.size()); - - if (!convert_constant(cn, uniform.type, uniform.default_value.ptrw())) { - _set_error("Can't convert constant to " + get_datatype_name(uniform.type)); - return ERR_PARSE_ERROR; - } - tk = _get_token(); - } if (tk.type == TK_COLON) { //hint @@ -3796,6 +3847,27 @@ Error ShaderLanguage::_parse_shader(const Map<StringName, FunctionInfo> &p_funct tk = _get_token(); } + if (tk.type == TK_OP_ASSIGN) { + + Node *expr = _parse_and_reduce_expression(NULL, Map<StringName, BuiltInInfo>()); + if (!expr) + return ERR_PARSE_ERROR; + if (expr->type != Node::TYPE_CONSTANT) { + _set_error("Expected constant expression after '='"); + return ERR_PARSE_ERROR; + } + + ConstantNode *cn = static_cast<ConstantNode *>(expr); + + uniform.default_value.resize(cn->values.size()); + + if (!convert_constant(cn, uniform.type, uniform.default_value.ptrw())) { + _set_error("Can't convert constant to " + get_datatype_name(uniform.type)); + return ERR_PARSE_ERROR; + } + tk = _get_token(); + } + shader->uniforms[name] = uniform; if (tk.type != TK_SEMICOLON) { diff --git a/servers/visual/shader_language.h b/servers/visual/shader_language.h index e8cdf1f897..720511e18d 100644 --- a/servers/visual/shader_language.h +++ b/servers/visual/shader_language.h @@ -425,6 +425,7 @@ public: FunctionNode() { type = TYPE_FUNCTION; + return_type = TYPE_VOID; return_precision = PRECISION_DEFAULT; can_discard = false; } @@ -532,6 +533,7 @@ public: static bool convert_constant(ConstantNode *p_constant, DataType p_to_type, ConstantNode::Value *p_value = NULL); static DataType get_scalar_type(DataType p_type); + static int get_cardinality(DataType p_type); static bool is_scalar_type(DataType p_type); static bool is_sampler_type(DataType p_type); diff --git a/servers/visual/shader_types.cpp b/servers/visual/shader_types.cpp index 9042649337..95193f7a8f 100644 --- a/servers/visual/shader_types.cpp +++ b/servers/visual/shader_types.cpp @@ -173,6 +173,8 @@ ShaderTypes::ShaderTypes() { shader_modes[VS::SHADER_SPATIAL].modes.insert("skip_vertex_transform"); shader_modes[VS::SHADER_SPATIAL].modes.insert("world_vertex_coords"); + shader_modes[VS::SHADER_SPATIAL].modes.insert("shadows_disabled"); + shader_modes[VS::SHADER_SPATIAL].modes.insert("vertex_lighting"); /************ CANVAS ITEM **************************/ @@ -207,7 +209,7 @@ ShaderTypes::ShaderTypes() { shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"].built_ins["SCREEN_TEXTURE"] = constt(ShaderLanguage::TYPE_SAMPLER2D); shader_modes[VS::SHADER_CANVAS_ITEM].functions["fragment"].can_discard = true; - shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"].built_ins["POSITION"] = constt(ShaderLanguage::TYPE_VEC2); + shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"].built_ins["FRAGCOORD"] = constt(ShaderLanguage::TYPE_VEC4); shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"].built_ins["NORMAL"] = constt(ShaderLanguage::TYPE_VEC3); shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"].built_ins["UV"] = constt(ShaderLanguage::TYPE_VEC2); shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"].built_ins["COLOR"] = constt(ShaderLanguage::TYPE_VEC4); @@ -218,9 +220,8 @@ ShaderTypes::ShaderTypes() { shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"].built_ins["LIGHT_HEIGHT"] = ShaderLanguage::TYPE_FLOAT; shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"].built_ins["LIGHT_COLOR"] = ShaderLanguage::TYPE_VEC4; shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"].built_ins["LIGHT_UV"] = ShaderLanguage::TYPE_VEC2; - shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"].built_ins["LIGHT_SHADOW"] = ShaderLanguage::TYPE_VEC4; shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"].built_ins["LIGHT"] = ShaderLanguage::TYPE_VEC4; - shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"].built_ins["SHADOW"] = ShaderLanguage::TYPE_VEC4; + shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"].built_ins["SHADOW_COLOR"] = ShaderLanguage::TYPE_VEC4; shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"].built_ins["POINT_COORD"] = constt(ShaderLanguage::TYPE_VEC2); shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"].built_ins["TIME"] = constt(ShaderLanguage::TYPE_FLOAT); shader_modes[VS::SHADER_CANVAS_ITEM].functions["light"].can_discard = true; @@ -232,6 +233,7 @@ ShaderTypes::ShaderTypes() { shader_modes[VS::SHADER_CANVAS_ITEM].modes.insert("blend_sub"); shader_modes[VS::SHADER_CANVAS_ITEM].modes.insert("blend_mul"); shader_modes[VS::SHADER_CANVAS_ITEM].modes.insert("blend_premul_alpha"); + shader_modes[VS::SHADER_CANVAS_ITEM].modes.insert("blend_disabled"); shader_modes[VS::SHADER_CANVAS_ITEM].modes.insert("unshaded"); shader_modes[VS::SHADER_CANVAS_ITEM].modes.insert("light_only"); @@ -254,7 +256,6 @@ ShaderTypes::ShaderTypes() { shader_modes[VS::SHADER_PARTICLES].functions["vertex"].built_ins["RANDOM_SEED"] = constt(ShaderLanguage::TYPE_UINT); shader_modes[VS::SHADER_PARTICLES].functions["vertex"].can_discard = false; - shader_modes[VS::SHADER_PARTICLES].modes.insert("billboard"); shader_modes[VS::SHADER_PARTICLES].modes.insert("disable_force"); shader_modes[VS::SHADER_PARTICLES].modes.insert("disable_velocity"); shader_modes[VS::SHADER_PARTICLES].modes.insert("keep_data"); diff --git a/servers/visual/visual_server_canvas.cpp b/servers/visual/visual_server_canvas.cpp index d82d93a59d..6439ba8509 100644 --- a/servers/visual/visual_server_canvas.cpp +++ b/servers/visual/visual_server_canvas.cpp @@ -46,7 +46,7 @@ void VisualServerCanvas::_render_canvas_item_tree(Item *p_canvas_item, const Tra for (int i = 0; i < z_range; i++) { if (!z_list[i]) continue; - VSG::canvas_render->canvas_render_items(z_list[i], VS::CANVAS_ITEM_Z_MIN + i, p_modulate, p_lights); + VSG::canvas_render->canvas_render_items(z_list[i], VS::CANVAS_ITEM_Z_MIN + i, p_modulate, p_lights, p_transform); } } @@ -214,7 +214,7 @@ void VisualServerCanvas::render_canvas(Canvas *p_canvas, const Transform2D &p_tr _light_mask_canvas_items(VS::CANVAS_ITEM_Z_MIN + i, z_list[i], p_masked_lights); } - VSG::canvas_render->canvas_render_items(z_list[i], VS::CANVAS_ITEM_Z_MIN + i, p_canvas->modulate, p_lights); + VSG::canvas_render->canvas_render_items(z_list[i], VS::CANVAS_ITEM_Z_MIN + i, p_canvas->modulate, p_lights, p_transform); } } else { @@ -440,13 +440,17 @@ void VisualServerCanvas::canvas_item_add_polyline(RID p_item, const Vector<Point if (p_antialiased) { pline->line_colors.push_back(Color(1, 1, 1, 1)); } - } - if (p_colors.size() == 1) { + } else if (p_colors.size() == 1) { pline->triangle_colors = p_colors; pline->line_colors = p_colors; } else { - pline->triangle_colors.resize(pline->triangles.size()); - pline->line_colors.resize(pline->lines.size()); + if (p_colors.size() != p_points.size()) { + pline->triangle_colors.push_back(p_colors[0]); + pline->line_colors.push_back(p_colors[0]); + } else { + pline->triangle_colors.resize(pline->triangles.size()); + pline->line_colors.resize(pline->lines.size()); + } } for (int i = 0; i < p_points.size(); i++) { @@ -690,7 +694,7 @@ void VisualServerCanvas::canvas_item_add_polygon(RID p_item, const Vector<Point2 canvas_item->commands.push_back(polygon); } -void VisualServerCanvas::canvas_item_add_triangle_array(RID p_item, const Vector<int> &p_indices, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs, RID p_texture, int p_count, RID p_normal_map) { +void VisualServerCanvas::canvas_item_add_triangle_array(RID p_item, const Vector<int> &p_indices, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs, const Vector<int> &p_bones, const Vector<float> &p_weights, RID p_texture, int p_count, RID p_normal_map) { Item *canvas_item = canvas_item_owner.getornull(p_item); ERR_FAIL_COND(!canvas_item); @@ -698,6 +702,8 @@ void VisualServerCanvas::canvas_item_add_triangle_array(RID p_item, const Vector int ps = p_points.size(); ERR_FAIL_COND(!p_colors.empty() && p_colors.size() != ps && p_colors.size() != 1); ERR_FAIL_COND(!p_uvs.empty() && p_uvs.size() != ps); + ERR_FAIL_COND(!p_bones.empty() && p_bones.size() != ps * 4); + ERR_FAIL_COND(!p_weights.empty() && p_weights.size() != ps * 4); Vector<int> indices = p_indices; @@ -722,6 +728,8 @@ void VisualServerCanvas::canvas_item_add_triangle_array(RID p_item, const Vector polygon->points = p_points; polygon->uvs = p_uvs; polygon->colors = p_colors; + polygon->bones = p_bones; + polygon->weights = p_weights; polygon->indices = indices; polygon->count = count; polygon->antialiased = false; @@ -742,7 +750,7 @@ void VisualServerCanvas::canvas_item_add_set_transform(RID p_item, const Transfo canvas_item->commands.push_back(tr); } -void VisualServerCanvas::canvas_item_add_mesh(RID p_item, const RID &p_mesh, RID p_skeleton) { +void VisualServerCanvas::canvas_item_add_mesh(RID p_item, const RID &p_mesh, RID p_texture, RID p_normal_map) { Item *canvas_item = canvas_item_owner.getornull(p_item); ERR_FAIL_COND(!canvas_item); @@ -750,7 +758,8 @@ void VisualServerCanvas::canvas_item_add_mesh(RID p_item, const RID &p_mesh, RID Item::CommandMesh *m = memnew(Item::CommandMesh); ERR_FAIL_COND(!m); m->mesh = p_mesh; - m->skeleton = p_skeleton; + m->texture = p_texture; + m->normal_map = p_normal_map; canvas_item->commands.push_back(m); } @@ -774,7 +783,7 @@ void VisualServerCanvas::canvas_item_add_particles(RID p_item, RID p_particles, canvas_item->commands.push_back(part); } -void VisualServerCanvas::canvas_item_add_multimesh(RID p_item, RID p_mesh, RID p_skeleton) { +void VisualServerCanvas::canvas_item_add_multimesh(RID p_item, RID p_mesh, RID p_texture, RID p_normal_map) { Item *canvas_item = canvas_item_owner.getornull(p_item); ERR_FAIL_COND(!canvas_item); @@ -782,7 +791,8 @@ void VisualServerCanvas::canvas_item_add_multimesh(RID p_item, RID p_mesh, RID p Item::CommandMultiMesh *mm = memnew(Item::CommandMultiMesh); ERR_FAIL_COND(!mm); mm->multimesh = p_mesh; - mm->skeleton = p_skeleton; + mm->texture = p_texture; + mm->normal_map = p_normal_map; canvas_item->rect_dirty = true; canvas_item->commands.push_back(mm); @@ -822,6 +832,15 @@ void VisualServerCanvas::canvas_item_set_z_as_relative_to_parent(RID p_item, boo canvas_item->z_relative = p_enable; } + +void VisualServerCanvas::canvas_item_attach_skeleton(RID p_item, RID p_skeleton) { + + Item *canvas_item = canvas_item_owner.getornull(p_item); + ERR_FAIL_COND(!canvas_item); + + canvas_item->skeleton = p_skeleton; +} + void VisualServerCanvas::canvas_item_set_copy_to_backbuffer(RID p_item, bool p_enable, const Rect2 &p_rect) { Item *canvas_item = canvas_item_owner.getornull(p_item); diff --git a/servers/visual/visual_server_canvas.h b/servers/visual/visual_server_canvas.h index f4331ad291..4d9398a17e 100644 --- a/servers/visual/visual_server_canvas.h +++ b/servers/visual/visual_server_canvas.h @@ -181,9 +181,9 @@ public: void canvas_item_add_nine_patch(RID p_item, const Rect2 &p_rect, const Rect2 &p_source, RID p_texture, const Vector2 &p_topleft, const Vector2 &p_bottomright, VS::NinePatchAxisMode p_x_axis_mode = VS::NINE_PATCH_STRETCH, VS::NinePatchAxisMode p_y_axis_mode = VS::NINE_PATCH_STRETCH, bool p_draw_center = true, const Color &p_modulate = Color(1, 1, 1), RID p_normal_map = RID()); void canvas_item_add_primitive(RID p_item, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs, RID p_texture, float p_width = 1.0, RID p_normal_map = RID()); void canvas_item_add_polygon(RID p_item, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs = Vector<Point2>(), RID p_texture = RID(), RID p_normal_map = RID(), bool p_antialiased = false); - void canvas_item_add_triangle_array(RID p_item, const Vector<int> &p_indices, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs = Vector<Point2>(), RID p_texture = RID(), int p_count = -1, RID p_normal_map = RID()); - void canvas_item_add_mesh(RID p_item, const RID &p_mesh, RID p_skeleton = RID()); - void canvas_item_add_multimesh(RID p_item, RID p_mesh, RID p_skeleton = RID()); + void canvas_item_add_triangle_array(RID p_item, const Vector<int> &p_indices, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs = Vector<Point2>(), const Vector<int> &p_bones = Vector<int>(), const Vector<float> &p_weights = Vector<float>(), RID p_texture = RID(), int p_count = -1, RID p_normal_map = RID()); + void canvas_item_add_mesh(RID p_item, const RID &p_mesh, RID p_texture = RID(), RID p_normal_map = RID()); + void canvas_item_add_multimesh(RID p_item, RID p_mesh, RID p_texture = RID(), RID p_normal_map = RID()); void canvas_item_add_particles(RID p_item, RID p_particles, RID p_texture, RID p_normal, int p_h_frames, int p_v_frames); void canvas_item_add_set_transform(RID p_item, const Transform2D &p_transform); void canvas_item_add_clip_ignore(RID p_item, bool p_ignore); @@ -191,6 +191,7 @@ public: void canvas_item_set_z_index(RID p_item, int p_z); void canvas_item_set_z_as_relative_to_parent(RID p_item, bool p_enable); void canvas_item_set_copy_to_backbuffer(RID p_item, bool p_enable, const Rect2 &p_rect); + void canvas_item_attach_skeleton(RID p_item, RID p_skeleton); void canvas_item_clear(RID p_item); void canvas_item_set_draw_index(RID p_item, int p_index); diff --git a/servers/visual/visual_server_raster.cpp b/servers/visual/visual_server_raster.cpp index 64a3502e40..fca3126604 100644 --- a/servers/visual/visual_server_raster.cpp +++ b/servers/visual/visual_server_raster.cpp @@ -205,4 +205,5 @@ VisualServerRaster::~VisualServerRaster() { memdelete(VSG::canvas); memdelete(VSG::viewport); memdelete(VSG::rasterizer); + memdelete(VSG::scene); } diff --git a/servers/visual/visual_server_raster.h b/servers/visual/visual_server_raster.h index 106b84a6ff..8f19de9f8b 100644 --- a/servers/visual/visual_server_raster.h +++ b/servers/visual/visual_server_raster.h @@ -148,6 +148,7 @@ public: BIND0R(RID, texture_create) BIND5(texture_allocate, RID, int, int, Image::Format, uint32_t) BIND3(texture_set_data, RID, const Ref<Image> &, CubeMapSide) + BIND10(texture_set_data_partial, RID, const Ref<Image> &, int, int, int, int, int, int, int, CubeMapSide) BIND2RC(Ref<Image>, texture_get_data, RID, CubeMapSide) BIND2(texture_set_flags, RID, uint32_t) BIND1RC(uint32_t, texture_get_flags, RID) @@ -285,6 +286,7 @@ public: BIND2RC(Transform, skeleton_bone_get_transform, RID, int) BIND3(skeleton_bone_set_transform_2d, RID, int, const Transform2D &) BIND2RC(Transform2D, skeleton_bone_get_transform_2d, RID, int) + BIND2(skeleton_set_base_transform_2d, RID, const Transform2D &) /* Light API */ @@ -450,6 +452,7 @@ public: BIND2(viewport_set_hide_canvas, RID, bool) BIND2(viewport_set_disable_environment, RID, bool) BIND2(viewport_set_disable_3d, RID, bool) + BIND2(viewport_set_keep_3d_linear, RID, bool) BIND2(viewport_attach_camera, RID, RID) BIND2(viewport_set_scenario, RID, RID) @@ -580,9 +583,9 @@ public: BIND11(canvas_item_add_nine_patch, RID, const Rect2 &, const Rect2 &, RID, const Vector2 &, const Vector2 &, NinePatchAxisMode, NinePatchAxisMode, bool, const Color &, RID) BIND7(canvas_item_add_primitive, RID, const Vector<Point2> &, const Vector<Color> &, const Vector<Point2> &, RID, float, RID) BIND7(canvas_item_add_polygon, RID, const Vector<Point2> &, const Vector<Color> &, const Vector<Point2> &, RID, RID, bool) - BIND8(canvas_item_add_triangle_array, RID, const Vector<int> &, const Vector<Point2> &, const Vector<Color> &, const Vector<Point2> &, RID, int, RID) - BIND3(canvas_item_add_mesh, RID, const RID &, RID) - BIND3(canvas_item_add_multimesh, RID, RID, RID) + BIND10(canvas_item_add_triangle_array, RID, const Vector<int> &, const Vector<Point2> &, const Vector<Color> &, const Vector<Point2> &, const Vector<int> &, const Vector<float> &, RID, int, RID) + BIND4(canvas_item_add_mesh, RID, const RID &, RID, RID) + BIND4(canvas_item_add_multimesh, RID, RID, RID, RID) BIND6(canvas_item_add_particles, RID, RID, RID, RID, int, int) BIND2(canvas_item_add_set_transform, RID, const Transform2D &) BIND2(canvas_item_add_clip_ignore, RID, bool) @@ -590,6 +593,7 @@ public: BIND2(canvas_item_set_z_index, RID, int) BIND2(canvas_item_set_z_as_relative_to_parent, RID, bool) BIND3(canvas_item_set_copy_to_backbuffer, RID, bool, const Rect2 &) + BIND2(canvas_item_attach_skeleton, RID, RID) BIND1(canvas_item_clear, RID) BIND2(canvas_item_set_draw_index, RID, int) diff --git a/servers/visual/visual_server_scene.cpp b/servers/visual/visual_server_scene.cpp index 0920fa748b..04dcde1365 100644 --- a/servers/visual/visual_server_scene.cpp +++ b/servers/visual/visual_server_scene.cpp @@ -730,6 +730,11 @@ void VisualServerScene::instance_set_exterior(RID p_instance, bool p_enabled) { } void VisualServerScene::instance_set_extra_visibility_margin(RID p_instance, real_t p_margin) { + Instance *instance = instance_owner.get(p_instance); + ERR_FAIL_COND(!instance); + + instance->extra_margin = p_margin; + _instance_queue_update(instance, true, false); } Vector<ObjectID> VisualServerScene::instances_cull_aabb(const AABB &p_aabb, RID p_scenario) const { @@ -3333,6 +3338,7 @@ VisualServerScene::~VisualServerScene() { #ifndef NO_THREADS probe_bake_thread_exit = true; + probe_bake_sem->post(); Thread::wait_to_finish(probe_bake_thread); memdelete(probe_bake_thread); memdelete(probe_bake_sem); diff --git a/servers/visual/visual_server_scene.h b/servers/visual/visual_server_scene.h index 206503e643..109cdf711c 100644 --- a/servers/visual/visual_server_scene.h +++ b/servers/visual/visual_server_scene.h @@ -457,7 +457,7 @@ public: virtual void instance_set_visible(RID p_instance, bool p_visible); virtual void instance_set_use_lightmap(RID p_instance, RID p_lightmap_instance, RID p_lightmap); - virtual void instance_set_custom_aabb(RID p_insatnce, AABB aabb); + virtual void instance_set_custom_aabb(RID p_instance, AABB p_aabb); virtual void instance_attach_skeleton(RID p_instance, RID p_skeleton); virtual void instance_set_exterior(RID p_instance, bool p_enabled); diff --git a/servers/visual/visual_server_viewport.cpp b/servers/visual/visual_server_viewport.cpp index 3eb8953c1f..dcc270ca5e 100644 --- a/servers/visual/visual_server_viewport.cpp +++ b/servers/visual/visual_server_viewport.cpp @@ -178,11 +178,14 @@ void VisualServerViewport::_draw_viewport(Viewport *p_viewport, ARVRInterface::E VSG::rasterizer->restore_render_target(); if (scenario_draw_canvas_bg && canvas_map.front() && canvas_map.front()->key().layer > scenario_canvas_max_layer) { + Ref<ARVRInterface> arvr_interface = ARVRServer::get_singleton()->get_primary_interface(); - if (can_draw_3d) { - VSG::scene->render_camera(p_viewport->camera, p_viewport->scenario, p_viewport->size, p_viewport->shadow_atlas); - } else { + if (!can_draw_3d) { VSG::scene->render_empty_scene(p_viewport->scenario, p_viewport->shadow_atlas); + } else if (p_viewport->use_arvr && arvr_interface.is_valid()) { + VSG::scene->render_camera(arvr_interface, p_eye, p_viewport->camera, p_viewport->scenario, p_viewport->size, p_viewport->shadow_atlas); + } else { + VSG::scene->render_camera(p_viewport->camera, p_viewport->scenario, p_viewport->size, p_viewport->shadow_atlas); } scenario_draw_canvas_bg = false; } @@ -210,11 +213,14 @@ void VisualServerViewport::_draw_viewport(Viewport *p_viewport, ARVRInterface::E i++; if (scenario_draw_canvas_bg && E->key().layer >= scenario_canvas_max_layer) { + Ref<ARVRInterface> arvr_interface = ARVRServer::get_singleton()->get_primary_interface(); - if (can_draw_3d) { - VSG::scene->render_camera(p_viewport->camera, p_viewport->scenario, p_viewport->size, p_viewport->shadow_atlas); - } else { + if (!can_draw_3d) { VSG::scene->render_empty_scene(p_viewport->scenario, p_viewport->shadow_atlas); + } else if (p_viewport->use_arvr && arvr_interface.is_valid()) { + VSG::scene->render_camera(arvr_interface, p_eye, p_viewport->camera, p_viewport->scenario, p_viewport->size, p_viewport->shadow_atlas); + } else { + VSG::scene->render_camera(p_viewport->camera, p_viewport->scenario, p_viewport->size, p_viewport->shadow_atlas); } scenario_draw_canvas_bg = false; @@ -222,11 +228,14 @@ void VisualServerViewport::_draw_viewport(Viewport *p_viewport, ARVRInterface::E } if (scenario_draw_canvas_bg) { + Ref<ARVRInterface> arvr_interface = ARVRServer::get_singleton()->get_primary_interface(); - if (can_draw_3d) { - VSG::scene->render_camera(p_viewport->camera, p_viewport->scenario, p_viewport->size, p_viewport->shadow_atlas); - } else { + if (!can_draw_3d) { VSG::scene->render_empty_scene(p_viewport->scenario, p_viewport->shadow_atlas); + } else if (p_viewport->use_arvr && arvr_interface.is_valid()) { + VSG::scene->render_camera(arvr_interface, p_eye, p_viewport->camera, p_viewport->scenario, p_viewport->size, p_viewport->shadow_atlas); + } else { + VSG::scene->render_camera(p_viewport->camera, p_viewport->scenario, p_viewport->size, p_viewport->shadow_atlas); } scenario_draw_canvas_bg = false; @@ -239,10 +248,9 @@ void VisualServerViewport::_draw_viewport(Viewport *p_viewport, ARVRInterface::E void VisualServerViewport::draw_viewports() { // get our arvr interface in case we need it Ref<ARVRInterface> arvr_interface = ARVRServer::get_singleton()->get_primary_interface(); - if (arvr_interface.is_valid()) { - // update our positioning information as late as possible... - arvr_interface->process(); - } + + // process all our active interfaces + ARVRServer::get_singleton()->_process(); clear_color = GLOBAL_GET("rendering/environment/default_clear_color"); @@ -286,6 +294,9 @@ void VisualServerViewport::draw_viewports() { _draw_viewport(vp, ARVRInterface::EYE_RIGHT); arvr_interface->commit_for_eye(ARVRInterface::EYE_RIGHT, vp->render_target, vp->viewport_to_screen_rect); } + + // and for our frame timing, mark when we've finished commiting our eyes + ARVRServer::get_singleton()->_mark_commit(); } else { VSG::rasterizer->set_current_render_target(vp->render_target); @@ -451,6 +462,15 @@ void VisualServerViewport::viewport_set_disable_3d(RID p_viewport, bool p_disabl //this should be just for disabling rendering of 3D, to actually disable it, set usage } +void VisualServerViewport::viewport_set_keep_3d_linear(RID p_viewport, bool p_keep_3d_linear) { + + Viewport *viewport = viewport_owner.getornull(p_viewport); + ERR_FAIL_COND(!viewport); + + viewport->keep_3d_linear = p_keep_3d_linear; + VSG::storage->render_target_set_flag(viewport->render_target, RasterizerStorage::RENDER_TARGET_KEEP_3D_LINEAR, p_keep_3d_linear); +} + void VisualServerViewport::viewport_attach_camera(RID p_viewport, RID p_camera) { Viewport *viewport = viewport_owner.getornull(p_viewport); diff --git a/servers/visual/visual_server_viewport.h b/servers/visual/visual_server_viewport.h index 1d28cf22a3..c0c83c0450 100644 --- a/servers/visual/visual_server_viewport.h +++ b/servers/visual/visual_server_viewport.h @@ -64,6 +64,7 @@ public: bool disable_environment; bool disable_3d; bool disable_3d_by_usage; + bool keep_3d_linear; RID shadow_atlas; int shadow_atlas_size; @@ -110,6 +111,7 @@ public: shadow_atlas_size = 0; disable_3d = false; disable_3d_by_usage = false; + keep_3d_linear = false; debug_draw = VS::VIEWPORT_DEBUG_DRAW_DISABLED; for (int i = 0; i < VS::VIEWPORT_RENDER_INFO_MAX; i++) { render_info[i] = 0; @@ -164,6 +166,7 @@ public: void viewport_set_hide_canvas(RID p_viewport, bool p_hide); void viewport_set_disable_environment(RID p_viewport, bool p_disable); void viewport_set_disable_3d(RID p_viewport, bool p_disable); + void viewport_set_keep_3d_linear(RID p_viewport, bool p_keep_3d_linear); void viewport_attach_camera(RID p_viewport, RID p_camera); void viewport_set_scenario(RID p_viewport, RID p_scenario); diff --git a/servers/visual/visual_server_wrap_mt.h b/servers/visual/visual_server_wrap_mt.h index c86a8164ce..19bb58f3ad 100644 --- a/servers/visual/visual_server_wrap_mt.h +++ b/servers/visual/visual_server_wrap_mt.h @@ -84,6 +84,7 @@ public: FUNCRID(texture) FUNC5(texture_allocate, RID, int, int, Image::Format, uint32_t) FUNC3(texture_set_data, RID, const Ref<Image> &, CubeMapSide) + FUNC10(texture_set_data_partial, RID, const Ref<Image> &, int, int, int, int, int, int, int, CubeMapSide) FUNC2RC(Ref<Image>, texture_get_data, RID, CubeMapSide) FUNC2(texture_set_flags, RID, uint32_t) FUNC1RC(uint32_t, texture_get_flags, RID) @@ -221,6 +222,7 @@ public: FUNC2RC(Transform, skeleton_bone_get_transform, RID, int) FUNC3(skeleton_bone_set_transform_2d, RID, int, const Transform2D &) FUNC2RC(Transform2D, skeleton_bone_get_transform_2d, RID, int) + FUNC2(skeleton_set_base_transform_2d, RID, const Transform2D &) /* Light API */ @@ -377,6 +379,7 @@ public: FUNC2(viewport_set_hide_canvas, RID, bool) FUNC2(viewport_set_disable_environment, RID, bool) FUNC2(viewport_set_disable_3d, RID, bool) + FUNC2(viewport_set_keep_3d_linear, RID, bool) FUNC2(viewport_attach_camera, RID, RID) FUNC2(viewport_set_scenario, RID, RID) @@ -498,9 +501,9 @@ public: FUNC11(canvas_item_add_nine_patch, RID, const Rect2 &, const Rect2 &, RID, const Vector2 &, const Vector2 &, NinePatchAxisMode, NinePatchAxisMode, bool, const Color &, RID) FUNC7(canvas_item_add_primitive, RID, const Vector<Point2> &, const Vector<Color> &, const Vector<Point2> &, RID, float, RID) FUNC7(canvas_item_add_polygon, RID, const Vector<Point2> &, const Vector<Color> &, const Vector<Point2> &, RID, RID, bool) - FUNC8(canvas_item_add_triangle_array, RID, const Vector<int> &, const Vector<Point2> &, const Vector<Color> &, const Vector<Point2> &, RID, int, RID) - FUNC3(canvas_item_add_mesh, RID, const RID &, RID) - FUNC3(canvas_item_add_multimesh, RID, RID, RID) + FUNC10(canvas_item_add_triangle_array, RID, const Vector<int> &, const Vector<Point2> &, const Vector<Color> &, const Vector<Point2> &, const Vector<int> &, const Vector<float> &, RID, int, RID) + FUNC4(canvas_item_add_mesh, RID, const RID &, RID, RID) + FUNC4(canvas_item_add_multimesh, RID, RID, RID, RID) FUNC6(canvas_item_add_particles, RID, RID, RID, RID, int, int) FUNC2(canvas_item_add_set_transform, RID, const Transform2D &) FUNC2(canvas_item_add_clip_ignore, RID, bool) @@ -508,6 +511,7 @@ public: FUNC2(canvas_item_set_z_index, RID, int) FUNC2(canvas_item_set_z_as_relative_to_parent, RID, bool) FUNC3(canvas_item_set_copy_to_backbuffer, RID, bool, const Rect2 &) + FUNC2(canvas_item_attach_skeleton, RID, RID) FUNC1(canvas_item_clear, RID) FUNC2(canvas_item_set_draw_index, RID, int) |