mirror of
https://github.com/godotengine/godot.git
synced 2026-01-03 18:11:19 +03:00
Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks
This commit is contained in:
@@ -35,12 +35,10 @@
|
||||
#include "skeleton.h"
|
||||
|
||||
AABB VisualInstance::get_transformed_aabb() const {
|
||||
|
||||
return get_global_transform().xform(get_aabb());
|
||||
}
|
||||
|
||||
void VisualInstance::_update_visibility() {
|
||||
|
||||
if (!is_inside_tree()) {
|
||||
return;
|
||||
}
|
||||
@@ -64,11 +62,8 @@ void VisualInstance::_update_visibility() {
|
||||
}
|
||||
|
||||
void VisualInstance::_notification(int p_what) {
|
||||
|
||||
switch (p_what) {
|
||||
|
||||
case NOTIFICATION_ENTER_WORLD: {
|
||||
|
||||
// CHECK SKELETON => moving skeleton attaching logic to MeshInstance
|
||||
/*
|
||||
Skeleton *skeleton=Object::cast_to<Skeleton>(get_parent());
|
||||
@@ -81,14 +76,12 @@ void VisualInstance::_notification(int p_what) {
|
||||
|
||||
} break;
|
||||
case NOTIFICATION_TRANSFORM_CHANGED: {
|
||||
|
||||
if (_get_spatial_flags() & SPATIAL_FLAG_VI_VISIBLE) {
|
||||
Transform gt = get_global_transform();
|
||||
VisualServer::get_singleton()->instance_set_transform(instance, gt);
|
||||
}
|
||||
} break;
|
||||
case NOTIFICATION_EXIT_WORLD: {
|
||||
|
||||
VisualServer::get_singleton()->instance_set_scenario(instance, RID());
|
||||
VisualServer::get_singleton()->instance_attach_skeleton(instance, RID());
|
||||
//VS::get_singleton()->instance_geometry_set_baked_light_sampler(instance, RID() );
|
||||
@@ -99,30 +92,25 @@ void VisualInstance::_notification(int p_what) {
|
||||
_set_spatial_flag(SPATIAL_FLAG_VI_VISIBLE, false);
|
||||
} break;
|
||||
case NOTIFICATION_VISIBILITY_CHANGED: {
|
||||
|
||||
_update_visibility();
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
||||
RID VisualInstance::get_instance() const {
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
RID VisualInstance::_get_visual_instance_rid() const {
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
void VisualInstance::set_layer_mask(uint32_t p_mask) {
|
||||
|
||||
layers = p_mask;
|
||||
VisualServer::get_singleton()->instance_set_layer_mask(instance, p_mask);
|
||||
}
|
||||
|
||||
uint32_t VisualInstance::get_layer_mask() const {
|
||||
|
||||
return layers;
|
||||
}
|
||||
|
||||
@@ -141,7 +129,6 @@ bool VisualInstance::get_layer_mask_bit(int p_layer) const {
|
||||
}
|
||||
|
||||
void VisualInstance::_bind_methods() {
|
||||
|
||||
ClassDB::bind_method(D_METHOD("_get_visual_instance_rid"), &VisualInstance::_get_visual_instance_rid);
|
||||
ClassDB::bind_method(D_METHOD("set_base", "base"), &VisualInstance::set_base);
|
||||
ClassDB::bind_method(D_METHOD("get_base"), &VisualInstance::get_base);
|
||||
@@ -157,18 +144,15 @@ void VisualInstance::_bind_methods() {
|
||||
}
|
||||
|
||||
void VisualInstance::set_base(const RID &p_base) {
|
||||
|
||||
VisualServer::get_singleton()->instance_set_base(instance, p_base);
|
||||
base = p_base;
|
||||
}
|
||||
|
||||
RID VisualInstance::get_base() const {
|
||||
|
||||
return base;
|
||||
}
|
||||
|
||||
VisualInstance::VisualInstance() {
|
||||
|
||||
instance = VisualServer::get_singleton()->instance_create();
|
||||
VisualServer::get_singleton()->instance_attach_object_instance_id(instance, get_instance_id());
|
||||
layers = 1;
|
||||
@@ -176,18 +160,15 @@ VisualInstance::VisualInstance() {
|
||||
}
|
||||
|
||||
VisualInstance::~VisualInstance() {
|
||||
|
||||
VisualServer::get_singleton()->free(instance);
|
||||
}
|
||||
|
||||
void GeometryInstance::set_material_override(const Ref<Material> &p_material) {
|
||||
|
||||
material_override = p_material;
|
||||
VS::get_singleton()->instance_geometry_set_material_override(get_instance(), p_material.is_valid() ? p_material->get_rid() : RID());
|
||||
}
|
||||
|
||||
Ref<Material> GeometryInstance::get_material_override() const {
|
||||
|
||||
return material_override;
|
||||
}
|
||||
|
||||
@@ -209,46 +190,38 @@ GeometryInstance::LightmapScale GeometryInstance::get_lightmap_scale() const {
|
||||
}
|
||||
|
||||
void GeometryInstance::set_lod_min_distance(float p_dist) {
|
||||
|
||||
lod_min_distance = p_dist;
|
||||
VS::get_singleton()->instance_geometry_set_draw_range(get_instance(), lod_min_distance, lod_max_distance, lod_min_hysteresis, lod_max_hysteresis);
|
||||
}
|
||||
|
||||
float GeometryInstance::get_lod_min_distance() const {
|
||||
|
||||
return lod_min_distance;
|
||||
}
|
||||
|
||||
void GeometryInstance::set_lod_max_distance(float p_dist) {
|
||||
|
||||
lod_max_distance = p_dist;
|
||||
VS::get_singleton()->instance_geometry_set_draw_range(get_instance(), lod_min_distance, lod_max_distance, lod_min_hysteresis, lod_max_hysteresis);
|
||||
}
|
||||
|
||||
float GeometryInstance::get_lod_max_distance() const {
|
||||
|
||||
return lod_max_distance;
|
||||
}
|
||||
|
||||
void GeometryInstance::set_lod_min_hysteresis(float p_dist) {
|
||||
|
||||
lod_min_hysteresis = p_dist;
|
||||
VS::get_singleton()->instance_geometry_set_draw_range(get_instance(), lod_min_distance, lod_max_distance, lod_min_hysteresis, lod_max_hysteresis);
|
||||
}
|
||||
|
||||
float GeometryInstance::get_lod_min_hysteresis() const {
|
||||
|
||||
return lod_min_hysteresis;
|
||||
}
|
||||
|
||||
void GeometryInstance::set_lod_max_hysteresis(float p_dist) {
|
||||
|
||||
lod_max_hysteresis = p_dist;
|
||||
VS::get_singleton()->instance_geometry_set_draw_range(get_instance(), lod_min_distance, lod_max_distance, lod_min_hysteresis, lod_max_hysteresis);
|
||||
}
|
||||
|
||||
float GeometryInstance::get_lod_max_hysteresis() const {
|
||||
|
||||
return lod_max_hysteresis;
|
||||
}
|
||||
|
||||
@@ -256,7 +229,6 @@ void GeometryInstance::_notification(int p_what) {
|
||||
}
|
||||
|
||||
void GeometryInstance::set_flag(Flags p_flag, bool p_value) {
|
||||
|
||||
ERR_FAIL_INDEX(p_flag, FLAG_MAX);
|
||||
if (flags[p_flag] == p_value)
|
||||
return;
|
||||
@@ -266,43 +238,36 @@ void GeometryInstance::set_flag(Flags p_flag, bool p_value) {
|
||||
}
|
||||
|
||||
bool GeometryInstance::get_flag(Flags p_flag) const {
|
||||
|
||||
ERR_FAIL_INDEX_V(p_flag, FLAG_MAX, false);
|
||||
|
||||
return flags[p_flag];
|
||||
}
|
||||
|
||||
void GeometryInstance::set_cast_shadows_setting(ShadowCastingSetting p_shadow_casting_setting) {
|
||||
|
||||
shadow_casting_setting = p_shadow_casting_setting;
|
||||
|
||||
VS::get_singleton()->instance_geometry_set_cast_shadows_setting(get_instance(), (VS::ShadowCastingSetting)p_shadow_casting_setting);
|
||||
}
|
||||
|
||||
GeometryInstance::ShadowCastingSetting GeometryInstance::get_cast_shadows_setting() const {
|
||||
|
||||
return shadow_casting_setting;
|
||||
}
|
||||
|
||||
void GeometryInstance::set_extra_cull_margin(float p_margin) {
|
||||
|
||||
ERR_FAIL_COND(p_margin < 0);
|
||||
extra_cull_margin = p_margin;
|
||||
VS::get_singleton()->instance_set_extra_visibility_margin(get_instance(), extra_cull_margin);
|
||||
}
|
||||
|
||||
float GeometryInstance::get_extra_cull_margin() const {
|
||||
|
||||
return extra_cull_margin;
|
||||
}
|
||||
|
||||
void GeometryInstance::set_custom_aabb(AABB aabb) {
|
||||
|
||||
VS::get_singleton()->instance_set_custom_aabb(get_instance(), aabb);
|
||||
}
|
||||
|
||||
void GeometryInstance::_bind_methods() {
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_material_override", "material"), &GeometryInstance::set_material_override);
|
||||
ClassDB::bind_method(D_METHOD("get_material_override"), &GeometryInstance::get_material_override);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user