2017-03-05 15:47:28 +01:00
|
|
|
/*************************************************************************/
|
|
|
|
/* visual_server_scene.h */
|
|
|
|
/*************************************************************************/
|
|
|
|
/* This file is part of: */
|
|
|
|
/* GODOT ENGINE */
|
2017-08-27 14:16:55 +02:00
|
|
|
/* https://godotengine.org */
|
2017-03-05 15:47:28 +01:00
|
|
|
/*************************************************************************/
|
2020-01-01 11:16:22 +01:00
|
|
|
/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
|
|
|
|
/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
|
2017-03-05 15:47:28 +01:00
|
|
|
/* */
|
|
|
|
/* Permission is hereby granted, free of charge, to any person obtaining */
|
|
|
|
/* a copy of this software and associated documentation files (the */
|
|
|
|
/* "Software"), to deal in the Software without restriction, including */
|
|
|
|
/* without limitation the rights to use, copy, modify, merge, publish, */
|
|
|
|
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
|
|
|
/* permit persons to whom the Software is furnished to do so, subject to */
|
|
|
|
/* the following conditions: */
|
|
|
|
/* */
|
|
|
|
/* The above copyright notice and this permission notice shall be */
|
|
|
|
/* included in all copies or substantial portions of the Software. */
|
|
|
|
/* */
|
|
|
|
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
|
|
|
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
|
|
|
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
|
|
|
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
|
|
|
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
|
|
|
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
|
|
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
|
|
/*************************************************************************/
|
2018-01-05 00:50:27 +01:00
|
|
|
|
2016-10-19 16:14:41 +02:00
|
|
|
#ifndef VISUALSERVERSCENE_H
|
|
|
|
#define VISUALSERVERSCENE_H
|
|
|
|
|
2019-07-27 15:23:24 +02:00
|
|
|
#include "servers/visual/rasterizer.h"
|
2016-10-19 16:14:41 +02:00
|
|
|
|
2018-09-11 18:13:45 +02:00
|
|
|
#include "core/math/geometry.h"
|
|
|
|
#include "core/math/octree.h"
|
|
|
|
#include "core/os/semaphore.h"
|
|
|
|
#include "core/os/thread.h"
|
2019-06-10 17:38:51 +02:00
|
|
|
#include "core/rid_owner.h"
|
2018-09-11 18:13:45 +02:00
|
|
|
#include "core/self_list.h"
|
2017-04-23 14:10:41 +02:00
|
|
|
#include "servers/arvr/arvr_interface.h"
|
2016-10-19 16:14:41 +02:00
|
|
|
|
|
|
|
class VisualServerScene {
|
|
|
|
public:
|
|
|
|
enum {
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
MAX_INSTANCE_CULL = 65536,
|
|
|
|
MAX_LIGHTS_CULLED = 4096,
|
|
|
|
MAX_REFLECTION_PROBES_CULLED = 4096,
|
2019-10-03 22:39:08 +02:00
|
|
|
MAX_GI_PROBES_CULLED = 4096,
|
2017-03-05 16:44:50 +01:00
|
|
|
MAX_ROOM_CULL = 32,
|
|
|
|
MAX_EXTERIOR_PORTALS = 128,
|
2016-10-19 16:14:41 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
uint64_t render_pass;
|
|
|
|
|
|
|
|
static VisualServerScene *singleton;
|
2017-08-27 21:07:15 +02:00
|
|
|
|
2016-12-20 04:21:07 +01:00
|
|
|
/* CAMERA API */
|
|
|
|
|
2019-06-10 17:38:51 +02:00
|
|
|
struct Camera {
|
2016-10-19 16:14:41 +02:00
|
|
|
|
|
|
|
enum Type {
|
|
|
|
PERSPECTIVE,
|
2019-02-19 17:17:02 +01:00
|
|
|
ORTHOGONAL,
|
|
|
|
FRUSTUM
|
2016-10-19 16:14:41 +02:00
|
|
|
};
|
|
|
|
Type type;
|
|
|
|
float fov;
|
2017-03-05 16:44:50 +01:00
|
|
|
float znear, zfar;
|
2016-10-19 16:14:41 +02:00
|
|
|
float size;
|
2019-02-19 17:17:02 +01:00
|
|
|
Vector2 offset;
|
2016-10-19 16:14:41 +02:00
|
|
|
uint32_t visible_layers;
|
|
|
|
bool vaspect;
|
|
|
|
RID env;
|
2020-01-13 19:37:24 +01:00
|
|
|
RID effects;
|
2016-10-19 16:14:41 +02:00
|
|
|
|
|
|
|
Transform transform;
|
|
|
|
|
|
|
|
Camera() {
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
visible_layers = 0xFFFFFFFF;
|
2017-11-25 23:48:30 +01:00
|
|
|
fov = 70;
|
2017-03-05 16:44:50 +01:00
|
|
|
type = PERSPECTIVE;
|
2017-11-25 23:48:30 +01:00
|
|
|
znear = 0.05;
|
2017-03-05 16:44:50 +01:00
|
|
|
zfar = 100;
|
|
|
|
size = 1.0;
|
2019-02-19 17:17:02 +01:00
|
|
|
offset = Vector2();
|
2017-03-05 16:44:50 +01:00
|
|
|
vaspect = false;
|
2016-10-19 16:14:41 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2019-06-10 17:38:51 +02:00
|
|
|
mutable RID_PtrOwner<Camera> camera_owner;
|
2016-10-19 16:14:41 +02:00
|
|
|
|
|
|
|
virtual RID camera_create();
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void camera_set_perspective(RID p_camera, float p_fovy_degrees, float p_z_near, float p_z_far);
|
|
|
|
virtual void camera_set_orthogonal(RID p_camera, float p_size, float p_z_near, float p_z_far);
|
2019-02-19 17:17:02 +01:00
|
|
|
virtual void camera_set_frustum(RID p_camera, float p_size, Vector2 p_offset, float p_z_near, float p_z_far);
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void camera_set_transform(RID p_camera, const Transform &p_transform);
|
|
|
|
virtual void camera_set_cull_mask(RID p_camera, uint32_t p_layers);
|
|
|
|
virtual void camera_set_environment(RID p_camera, RID p_env);
|
2020-01-13 19:37:24 +01:00
|
|
|
virtual void camera_set_camera_effects(RID p_camera, RID p_fx);
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void camera_set_use_vertical_aspect(RID p_camera, bool p_enable);
|
2016-10-19 16:14:41 +02:00
|
|
|
|
|
|
|
/* SCENARIO API */
|
|
|
|
|
|
|
|
struct Instance;
|
|
|
|
|
2019-06-10 17:38:51 +02:00
|
|
|
struct Scenario {
|
2016-10-19 16:14:41 +02:00
|
|
|
|
|
|
|
VS::ScenarioDebugMode debug;
|
|
|
|
RID self;
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
Octree<Instance, true> octree;
|
2016-10-19 16:14:41 +02:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
List<Instance *> directional_lights;
|
2016-10-19 16:14:41 +02:00
|
|
|
RID environment;
|
|
|
|
RID fallback_environment;
|
2020-01-13 19:37:24 +01:00
|
|
|
RID camera_effects;
|
2016-11-19 17:23:37 +01:00
|
|
|
RID reflection_probe_shadow_atlas;
|
2019-09-09 22:50:51 +02:00
|
|
|
RID reflection_atlas;
|
2016-11-19 17:23:37 +01:00
|
|
|
|
2016-10-19 16:14:41 +02:00
|
|
|
SelfList<Instance>::List instances;
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
Scenario() { debug = VS::SCENARIO_DEBUG_DISABLED; }
|
2016-10-19 16:14:41 +02:00
|
|
|
};
|
|
|
|
|
2019-06-10 17:38:51 +02:00
|
|
|
mutable RID_PtrOwner<Scenario> scenario_owner;
|
2016-10-19 16:14:41 +02:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
static void *_instance_pair(void *p_self, OctreeElementID, Instance *p_A, int, OctreeElementID, Instance *p_B, int);
|
|
|
|
static void _instance_unpair(void *p_self, OctreeElementID, Instance *p_A, int, OctreeElementID, Instance *p_B, int, void *);
|
2016-10-19 16:14:41 +02:00
|
|
|
|
|
|
|
virtual RID scenario_create();
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void scenario_set_debug(RID p_scenario, VS::ScenarioDebugMode p_debug_mode);
|
2016-10-19 16:14:41 +02:00
|
|
|
virtual void scenario_set_environment(RID p_scenario, RID p_environment);
|
2020-01-13 19:37:24 +01:00
|
|
|
virtual void scenario_set_camera_effects(RID p_scenario, RID p_fx);
|
2016-10-19 16:14:41 +02:00
|
|
|
virtual void scenario_set_fallback_environment(RID p_scenario, RID p_environment);
|
2019-09-09 22:50:51 +02:00
|
|
|
virtual void scenario_set_reflection_atlas_size(RID p_scenario, int p_reflection_size, int p_reflection_count);
|
2016-10-19 16:14:41 +02:00
|
|
|
|
|
|
|
/* INSTANCING API */
|
|
|
|
|
|
|
|
struct InstanceBaseData {
|
|
|
|
|
|
|
|
virtual ~InstanceBaseData() {}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Instance : RasterizerScene::InstanceBase {
|
|
|
|
|
|
|
|
RID self;
|
|
|
|
//scenario stuff
|
|
|
|
OctreeElementID octree_id;
|
|
|
|
Scenario *scenario;
|
|
|
|
SelfList<Instance> scenario_item;
|
|
|
|
|
|
|
|
//aabb stuff
|
|
|
|
bool update_aabb;
|
2019-07-21 16:31:30 +02:00
|
|
|
bool update_dependencies;
|
2016-11-10 03:55:06 +01:00
|
|
|
|
2016-10-19 16:14:41 +02:00
|
|
|
SelfList<Instance> update_item;
|
|
|
|
|
2017-11-20 20:54:26 +01:00
|
|
|
AABB *custom_aabb; // <Zylann> would using aabb directly with a bool be better?
|
2016-10-19 16:14:41 +02:00
|
|
|
float extra_margin;
|
2019-05-09 11:21:49 +02:00
|
|
|
uint32_t object_id;
|
2016-10-19 16:14:41 +02:00
|
|
|
|
|
|
|
float lod_begin;
|
|
|
|
float lod_end;
|
|
|
|
float lod_begin_hysteresis;
|
|
|
|
float lod_end_hysteresis;
|
|
|
|
RID lod_instance;
|
|
|
|
|
|
|
|
uint64_t last_render_pass;
|
|
|
|
uint64_t last_frame_pass;
|
|
|
|
|
|
|
|
uint64_t version; // changes to this, and changes to base increase version
|
|
|
|
|
|
|
|
InstanceBaseData *base_data;
|
|
|
|
|
2019-07-21 16:31:30 +02:00
|
|
|
virtual void dependency_deleted(RID p_dependency) {
|
|
|
|
if (p_dependency == base) {
|
|
|
|
singleton->instance_set_base(self, RID());
|
|
|
|
} else if (p_dependency == skeleton) {
|
|
|
|
singleton->instance_attach_skeleton(self, RID());
|
|
|
|
} else {
|
|
|
|
singleton->_instance_queue_update(this, false, true);
|
|
|
|
}
|
2016-10-19 16:14:41 +02:00
|
|
|
}
|
|
|
|
|
2019-07-21 16:31:30 +02:00
|
|
|
virtual void dependency_changed(bool p_aabb, bool p_dependencies) {
|
|
|
|
singleton->_instance_queue_update(this, p_aabb, p_dependencies);
|
2016-11-10 03:55:06 +01:00
|
|
|
}
|
|
|
|
|
2017-12-06 21:36:34 +01:00
|
|
|
Instance() :
|
|
|
|
scenario_item(this),
|
|
|
|
update_item(this) {
|
2016-10-19 16:14:41 +02:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
octree_id = 0;
|
|
|
|
scenario = NULL;
|
2016-10-19 16:14:41 +02:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
update_aabb = false;
|
2019-07-21 16:31:30 +02:00
|
|
|
update_dependencies = false;
|
2016-10-19 16:14:41 +02:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
extra_margin = 0;
|
2016-10-19 16:14:41 +02:00
|
|
|
|
2019-05-09 11:21:49 +02:00
|
|
|
object_id = 0;
|
2017-03-05 16:44:50 +01:00
|
|
|
visible = true;
|
2016-10-19 16:14:41 +02:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
lod_begin = 0;
|
|
|
|
lod_end = 0;
|
|
|
|
lod_begin_hysteresis = 0;
|
|
|
|
lod_end_hysteresis = 0;
|
2016-10-19 16:14:41 +02:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
last_render_pass = 0;
|
|
|
|
last_frame_pass = 0;
|
|
|
|
version = 1;
|
|
|
|
base_data = NULL;
|
2017-11-20 20:54:26 +01:00
|
|
|
|
|
|
|
custom_aabb = NULL;
|
2016-10-19 16:14:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
~Instance() {
|
|
|
|
|
|
|
|
if (base_data)
|
|
|
|
memdelete(base_data);
|
2017-11-20 20:54:26 +01:00
|
|
|
if (custom_aabb)
|
|
|
|
memdelete(custom_aabb);
|
2016-10-19 16:14:41 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
SelfList<Instance>::List _instance_update_list;
|
2019-07-21 16:31:30 +02:00
|
|
|
void _instance_queue_update(Instance *p_instance, bool p_update_aabb, bool p_update_dependencies = false);
|
2016-10-19 16:14:41 +02:00
|
|
|
|
|
|
|
struct InstanceGeometryData : public InstanceBaseData {
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
List<Instance *> lighting;
|
2016-10-19 16:14:41 +02:00
|
|
|
bool lighting_dirty;
|
2016-11-10 03:55:06 +01:00
|
|
|
bool can_cast_shadows;
|
2018-11-14 13:32:39 +01:00
|
|
|
bool material_is_animated;
|
2016-10-19 16:14:41 +02:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
List<Instance *> reflection_probes;
|
2016-11-19 17:23:37 +01:00
|
|
|
bool reflection_dirty;
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
List<Instance *> gi_probes;
|
2016-12-20 04:21:07 +01:00
|
|
|
bool gi_probes_dirty;
|
|
|
|
|
2017-12-14 12:59:46 +01:00
|
|
|
List<Instance *> lightmap_captures;
|
|
|
|
|
2016-10-19 16:14:41 +02:00
|
|
|
InstanceGeometryData() {
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
lighting_dirty = false;
|
|
|
|
reflection_dirty = true;
|
|
|
|
can_cast_shadows = true;
|
2018-11-14 13:32:39 +01:00
|
|
|
material_is_animated = true;
|
2017-03-05 16:44:50 +01:00
|
|
|
gi_probes_dirty = true;
|
2016-10-19 16:14:41 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2016-11-19 17:23:37 +01:00
|
|
|
struct InstanceReflectionProbeData : public InstanceBaseData {
|
|
|
|
|
|
|
|
Instance *owner;
|
|
|
|
|
|
|
|
struct PairInfo {
|
2017-03-05 16:44:50 +01:00
|
|
|
List<Instance *>::Element *L; //reflection iterator in geometry
|
2016-11-19 17:23:37 +01:00
|
|
|
Instance *geometry;
|
|
|
|
};
|
|
|
|
List<PairInfo> geometries;
|
|
|
|
|
|
|
|
RID instance;
|
|
|
|
bool reflection_dirty;
|
|
|
|
SelfList<InstanceReflectionProbeData> update_list;
|
|
|
|
|
|
|
|
int render_step;
|
|
|
|
|
2017-12-06 21:36:34 +01:00
|
|
|
InstanceReflectionProbeData() :
|
|
|
|
update_list(this) {
|
2016-11-19 17:23:37 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
reflection_dirty = true;
|
|
|
|
render_step = -1;
|
2016-11-19 17:23:37 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
SelfList<InstanceReflectionProbeData>::List reflection_probe_render_list;
|
2016-10-19 16:14:41 +02:00
|
|
|
|
|
|
|
struct InstanceLightData : public InstanceBaseData {
|
|
|
|
|
|
|
|
struct PairInfo {
|
2017-03-05 16:44:50 +01:00
|
|
|
List<Instance *>::Element *L; //light iterator in geometry
|
2016-10-19 16:14:41 +02:00
|
|
|
Instance *geometry;
|
|
|
|
};
|
|
|
|
|
|
|
|
RID instance;
|
2016-11-10 03:55:06 +01:00
|
|
|
uint64_t last_version;
|
2017-03-05 16:44:50 +01:00
|
|
|
List<Instance *>::Element *D; // directional light in scenario
|
2016-10-19 16:14:41 +02:00
|
|
|
|
2016-11-10 03:55:06 +01:00
|
|
|
bool shadow_dirty;
|
2016-10-19 16:14:41 +02:00
|
|
|
|
|
|
|
List<PairInfo> geometries;
|
|
|
|
|
2016-12-20 04:21:07 +01:00
|
|
|
Instance *baked_light;
|
|
|
|
|
2016-10-19 16:14:41 +02:00
|
|
|
InstanceLightData() {
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
shadow_dirty = true;
|
|
|
|
D = NULL;
|
|
|
|
last_version = 0;
|
|
|
|
baked_light = NULL;
|
2016-10-19 16:14:41 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2016-12-20 04:21:07 +01:00
|
|
|
struct InstanceGIProbeData : public InstanceBaseData {
|
|
|
|
|
|
|
|
Instance *owner;
|
|
|
|
|
|
|
|
struct PairInfo {
|
2017-03-05 16:44:50 +01:00
|
|
|
List<Instance *>::Element *L; //gi probe iterator in geometry
|
2016-12-20 04:21:07 +01:00
|
|
|
Instance *geometry;
|
|
|
|
};
|
|
|
|
|
|
|
|
List<PairInfo> geometries;
|
2019-10-11 04:14:56 +02:00
|
|
|
List<PairInfo> dynamic_geometries;
|
2016-12-20 04:21:07 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
Set<Instance *> lights;
|
2016-12-20 04:21:07 +01:00
|
|
|
|
|
|
|
struct LightCache {
|
|
|
|
|
|
|
|
VS::LightType type;
|
|
|
|
Transform transform;
|
|
|
|
Color color;
|
|
|
|
float energy;
|
2019-10-03 22:39:08 +02:00
|
|
|
float bake_energy;
|
2016-12-20 04:21:07 +01:00
|
|
|
float radius;
|
|
|
|
float attenuation;
|
|
|
|
float spot_angle;
|
|
|
|
float spot_attenuation;
|
2019-10-03 22:39:08 +02:00
|
|
|
bool has_shadow;
|
2016-12-30 12:35:54 +01:00
|
|
|
};
|
|
|
|
|
2019-10-03 22:39:08 +02:00
|
|
|
Vector<LightCache> light_cache;
|
|
|
|
Vector<RID> light_instances;
|
2016-12-20 04:21:07 +01:00
|
|
|
|
|
|
|
RID probe_instance;
|
|
|
|
|
|
|
|
bool invalid;
|
|
|
|
uint32_t base_version;
|
|
|
|
|
|
|
|
SelfList<InstanceGIProbeData> update_element;
|
|
|
|
|
2017-12-06 21:36:34 +01:00
|
|
|
InstanceGIProbeData() :
|
|
|
|
update_element(this) {
|
2017-03-05 16:44:50 +01:00
|
|
|
invalid = true;
|
|
|
|
base_version = 0;
|
2016-12-20 04:21:07 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
SelfList<InstanceGIProbeData>::List gi_probe_update_list;
|
|
|
|
|
2017-12-14 12:59:46 +01:00
|
|
|
struct InstanceLightmapCaptureData : public InstanceBaseData {
|
|
|
|
|
|
|
|
struct PairInfo {
|
|
|
|
List<Instance *>::Element *L; //iterator in geometry
|
|
|
|
Instance *geometry;
|
|
|
|
};
|
|
|
|
List<PairInfo> geometries;
|
|
|
|
|
|
|
|
Set<Instance *> users;
|
|
|
|
|
|
|
|
InstanceLightmapCaptureData() {
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2018-06-11 13:51:30 +02:00
|
|
|
int instance_cull_count;
|
2016-10-19 16:14:41 +02:00
|
|
|
Instance *instance_cull_result[MAX_INSTANCE_CULL];
|
|
|
|
Instance *instance_shadow_cull_result[MAX_INSTANCE_CULL]; //used for generating shadowmaps
|
|
|
|
Instance *light_cull_result[MAX_LIGHTS_CULLED];
|
|
|
|
RID light_instance_cull_result[MAX_LIGHTS_CULLED];
|
|
|
|
int light_cull_count;
|
2018-06-11 13:51:30 +02:00
|
|
|
int directional_light_count;
|
2016-11-19 17:23:37 +01:00
|
|
|
RID reflection_probe_instance_cull_result[MAX_REFLECTION_PROBES_CULLED];
|
|
|
|
int reflection_probe_cull_count;
|
2019-10-03 22:39:08 +02:00
|
|
|
RID gi_probe_instance_cull_result[MAX_GI_PROBES_CULLED];
|
|
|
|
int gi_probe_cull_count;
|
2016-10-19 16:14:41 +02:00
|
|
|
|
2019-06-10 17:38:51 +02:00
|
|
|
RID_PtrOwner<Instance> instance_owner;
|
2016-10-19 16:14:41 +02:00
|
|
|
|
2020-01-21 21:32:27 +01:00
|
|
|
virtual RID instance_create();
|
2016-10-19 16:14:41 +02:00
|
|
|
|
2020-01-21 21:32:27 +01:00
|
|
|
virtual void instance_set_base(RID p_instance, RID p_base);
|
|
|
|
virtual void instance_set_scenario(RID p_instance, RID p_scenario);
|
2016-10-19 16:14:41 +02:00
|
|
|
virtual void instance_set_layer_mask(RID p_instance, uint32_t p_mask);
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void instance_set_transform(RID p_instance, const Transform &p_transform);
|
2019-05-09 11:21:49 +02:00
|
|
|
virtual void instance_attach_object_instance_id(RID p_instance, ObjectID p_id);
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void instance_set_blend_shape_weight(RID p_instance, int p_shape, float p_weight);
|
|
|
|
virtual void instance_set_surface_material(RID p_instance, int p_surface, RID p_material);
|
|
|
|
virtual void instance_set_visible(RID p_instance, bool p_visible);
|
2017-12-14 12:59:46 +01:00
|
|
|
virtual void instance_set_use_lightmap(RID p_instance, RID p_lightmap_instance, RID p_lightmap);
|
2016-10-19 16:14:41 +02:00
|
|
|
|
2018-02-01 09:57:10 +01:00
|
|
|
virtual void instance_set_custom_aabb(RID p_instance, AABB p_aabb);
|
2017-11-20 20:54:26 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void instance_attach_skeleton(RID p_instance, RID p_skeleton);
|
|
|
|
virtual void instance_set_exterior(RID p_instance, bool p_enabled);
|
2016-10-19 16:14:41 +02:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void instance_set_extra_visibility_margin(RID p_instance, real_t p_margin);
|
2016-10-19 16:14:41 +02:00
|
|
|
|
|
|
|
// don't use these in a game!
|
2017-11-17 03:09:00 +01:00
|
|
|
virtual Vector<ObjectID> instances_cull_aabb(const AABB &p_aabb, RID p_scenario = RID()) const;
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual Vector<ObjectID> instances_cull_ray(const Vector3 &p_from, const Vector3 &p_to, RID p_scenario = RID()) const;
|
|
|
|
virtual Vector<ObjectID> instances_cull_convex(const Vector<Plane> &p_convex, RID p_scenario = RID()) const;
|
2016-10-19 16:14:41 +02:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void instance_geometry_set_flag(RID p_instance, VS::InstanceFlags p_flags, bool p_enabled);
|
2016-10-19 16:14:41 +02:00
|
|
|
virtual void instance_geometry_set_cast_shadows_setting(RID p_instance, VS::ShadowCastingSetting p_shadow_casting_setting);
|
|
|
|
virtual void instance_geometry_set_material_override(RID p_instance, RID p_material);
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void instance_geometry_set_draw_range(RID p_instance, float p_min, float p_max, float p_min_margin, float p_max_margin);
|
|
|
|
virtual void instance_geometry_set_as_instance_lod(RID p_instance, RID p_as_lod_of_instance);
|
2016-10-19 16:14:41 +02:00
|
|
|
|
|
|
|
_FORCE_INLINE_ void _update_instance(Instance *p_instance);
|
|
|
|
_FORCE_INLINE_ void _update_instance_aabb(Instance *p_instance);
|
|
|
|
_FORCE_INLINE_ void _update_dirty_instance(Instance *p_instance);
|
2017-12-14 12:59:46 +01:00
|
|
|
_FORCE_INLINE_ void _update_instance_lightmap_captures(Instance *p_instance);
|
2016-10-19 16:14:41 +02:00
|
|
|
|
2018-11-14 13:32:39 +01:00
|
|
|
_FORCE_INLINE_ bool _light_instance_update_shadow(Instance *p_instance, const Transform p_cam_transform, const CameraMatrix &p_cam_projection, bool p_cam_orthogonal, RID p_shadow_atlas, Scenario *p_scenario);
|
2016-10-19 16:14:41 +02:00
|
|
|
|
2019-10-03 22:39:08 +02:00
|
|
|
bool _render_reflection_probe_step(Instance *p_instance, int p_step);
|
2020-01-13 19:37:24 +01:00
|
|
|
void _prepare_scene(const Transform p_cam_transform, const CameraMatrix &p_cam_projection, bool p_cam_orthogonal, RID p_force_environment, RID p_force_camera_effects, uint32_t p_visible_layers, RID p_scenario, RID p_shadow_atlas, RID p_reflection_probe, bool p_using_shadows = true);
|
|
|
|
void _render_scene(RID p_render_buffers, const Transform p_cam_transform, const CameraMatrix &p_cam_projection, bool p_cam_orthogonal, RID p_force_environment, RID p_force_camera_effects, RID p_scenario, RID p_shadow_atlas, RID p_reflection_probe, int p_reflection_probe_pass);
|
2019-08-19 00:40:52 +02:00
|
|
|
void render_empty_scene(RID p_render_buffers, RID p_scenario, RID p_shadow_atlas);
|
2016-11-19 17:23:37 +01:00
|
|
|
|
2019-08-19 00:40:52 +02:00
|
|
|
void render_camera(RID p_render_buffers, RID p_camera, RID p_scenario, Size2 p_viewport_size, RID p_shadow_atlas);
|
|
|
|
void render_camera(RID p_render_buffers, Ref<ARVRInterface> &p_interface, ARVRInterface::Eyes p_eye, RID p_camera, RID p_scenario, Size2 p_viewport_size, RID p_shadow_atlas);
|
2016-10-19 16:14:41 +02:00
|
|
|
void update_dirty_instances();
|
2016-11-19 17:23:37 +01:00
|
|
|
|
|
|
|
void render_probes();
|
2016-12-20 04:21:07 +01:00
|
|
|
|
2016-10-19 16:14:41 +02:00
|
|
|
bool free(RID p_rid);
|
|
|
|
|
|
|
|
VisualServerScene();
|
2018-10-02 12:07:44 +02:00
|
|
|
virtual ~VisualServerScene();
|
2016-10-19 16:14:41 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // VISUALSERVERSCENE_H
|