2014-02-10 02:10:30 +01:00
|
|
|
/*************************************************************************/
|
|
|
|
/* visual_server.h */
|
|
|
|
/*************************************************************************/
|
|
|
|
/* This file is part of: */
|
|
|
|
/* GODOT ENGINE */
|
|
|
|
/* http://www.godotengine.org */
|
|
|
|
/*************************************************************************/
|
2017-01-01 22:01:57 +01:00
|
|
|
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
|
2017-04-08 00:11:42 +02:00
|
|
|
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
|
2014-02-10 02:10:30 +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. */
|
|
|
|
/*************************************************************************/
|
|
|
|
#ifndef VISUAL_SERVER_H
|
|
|
|
#define VISUAL_SERVER_H
|
|
|
|
|
|
|
|
#include "bsp_tree.h"
|
|
|
|
#include "geometry.h"
|
2017-05-17 12:36:47 +02:00
|
|
|
#include "image.h"
|
2017-03-05 16:44:50 +01:00
|
|
|
#include "math_2d.h"
|
2014-02-10 02:10:30 +01:00
|
|
|
#include "object.h"
|
2017-03-05 16:44:50 +01:00
|
|
|
#include "rid.h"
|
|
|
|
#include "variant.h"
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
@author Juan Linietsky <reduzio@gmail.com>
|
|
|
|
*/
|
|
|
|
class VisualServer : public Object {
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
GDCLASS(VisualServer, Object);
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
static VisualServer *singleton;
|
|
|
|
|
|
|
|
int mm_policy;
|
|
|
|
|
2017-01-07 22:25:37 +01:00
|
|
|
PoolVector<String> _shader_get_param_list(RID p_shader) const;
|
2017-03-05 16:44:50 +01:00
|
|
|
void _camera_set_orthogonal(RID p_camera, float p_size, float p_z_near, float p_z_far);
|
|
|
|
void _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 = Color(1, 1, 1));
|
|
|
|
Array _get_array_from_surface(uint32_t p_format, PoolVector<uint8_t> p_vertex_data, int p_vertex_len, PoolVector<uint8_t> p_index_data, int p_index_len) const;
|
2016-11-10 03:55:06 +01:00
|
|
|
|
2016-03-09 00:00:52 +01:00
|
|
|
protected:
|
2014-02-10 02:10:30 +01:00
|
|
|
RID _make_test_cube();
|
2015-04-21 00:38:02 +02:00
|
|
|
void _free_internal_rids();
|
2014-02-10 02:10:30 +01:00
|
|
|
RID test_texture;
|
2014-05-29 15:56:39 +02:00
|
|
|
RID white_texture;
|
2015-04-21 00:38:02 +02:00
|
|
|
RID test_material;
|
2017-04-17 03:32:51 +02:00
|
|
|
RID material_2d[32];
|
2016-03-09 00:00:52 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
Error _surface_set_data(Array p_arrays, uint32_t p_format, uint32_t *p_offsets, uint32_t p_stride, PoolVector<uint8_t> &r_vertex_array, int p_vertex_array_len, PoolVector<uint8_t> &r_index_array, int p_index_array_len, Rect3 &r_aabb, Vector<Rect3> r_bone_aabb);
|
2016-10-19 16:14:41 +02:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
static VisualServer *(*create_func)();
|
2016-03-09 00:00:52 +01:00
|
|
|
static void _bind_methods();
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
public:
|
2014-02-10 02:10:30 +01:00
|
|
|
static VisualServer *get_singleton();
|
|
|
|
static VisualServer *create();
|
|
|
|
|
|
|
|
enum {
|
2016-03-09 00:00:52 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
NO_INDEX_ARRAY = -1,
|
|
|
|
ARRAY_WEIGHTS_SIZE = 4,
|
|
|
|
CANVAS_ITEM_Z_MIN = -4096,
|
|
|
|
CANVAS_ITEM_Z_MAX = 4096,
|
|
|
|
MAX_GLOW_LEVELS = 7,
|
2014-10-03 13:58:41 +02:00
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
MAX_CURSORS = 8,
|
|
|
|
};
|
2016-03-09 00:00:52 +01:00
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
/* TEXTURE API */
|
|
|
|
|
|
|
|
enum TextureFlags {
|
2017-03-05 16:44:50 +01:00
|
|
|
TEXTURE_FLAG_MIPMAPS = 1, /// Enable automatic mipmap generation - when available
|
|
|
|
TEXTURE_FLAG_REPEAT = 2, /// Repeat texture (Tiling), otherwise Clamping
|
|
|
|
TEXTURE_FLAG_FILTER = 4, /// Create texure with linear (or available) filter
|
|
|
|
TEXTURE_FLAG_ANISOTROPIC_FILTER = 8,
|
|
|
|
TEXTURE_FLAG_CONVERT_TO_LINEAR = 16,
|
|
|
|
TEXTURE_FLAG_MIRRORED_REPEAT = 32, /// Repeat texture, with alternate sections mirrored
|
|
|
|
TEXTURE_FLAG_CUBEMAP = 2048,
|
|
|
|
TEXTURE_FLAG_USED_FOR_STREAMING = 4096,
|
|
|
|
TEXTURE_FLAGS_DEFAULT = TEXTURE_FLAG_REPEAT | TEXTURE_FLAG_MIPMAPS | TEXTURE_FLAG_FILTER
|
2016-03-09 00:00:52 +01:00
|
|
|
};
|
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
enum CubeMapSide {
|
2016-03-09 00:00:52 +01:00
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
CUBEMAP_LEFT,
|
|
|
|
CUBEMAP_RIGHT,
|
|
|
|
CUBEMAP_BOTTOM,
|
|
|
|
CUBEMAP_TOP,
|
2016-03-09 00:00:52 +01:00
|
|
|
CUBEMAP_FRONT,
|
2014-02-10 02:10:30 +01:00
|
|
|
CUBEMAP_BACK
|
|
|
|
};
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual RID texture_create() = 0;
|
2017-05-17 12:36:47 +02:00
|
|
|
RID texture_create_from_image(const Ref<Image> &p_image, uint32_t p_flags = TEXTURE_FLAGS_DEFAULT); // helper
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void texture_allocate(RID p_texture, int p_width, int p_height, Image::Format p_format, uint32_t p_flags = TEXTURE_FLAGS_DEFAULT) = 0;
|
2017-05-17 12:36:47 +02:00
|
|
|
virtual void texture_set_data(RID p_texture, const Ref<Image> &p_image, CubeMapSide p_cube_side = CUBEMAP_LEFT) = 0;
|
|
|
|
virtual Ref<Image> texture_get_data(RID p_texture, CubeMapSide p_cube_side = CUBEMAP_LEFT) const = 0;
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void texture_set_flags(RID p_texture, uint32_t p_flags) = 0;
|
|
|
|
virtual uint32_t texture_get_flags(RID p_texture) const = 0;
|
|
|
|
virtual Image::Format texture_get_format(RID p_texture) const = 0;
|
2017-05-20 02:09:36 +02:00
|
|
|
virtual uint32_t texture_get_texid(RID p_texture) const = 0;
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual uint32_t texture_get_width(RID p_texture) const = 0;
|
|
|
|
virtual uint32_t texture_get_height(RID p_texture) const = 0;
|
|
|
|
virtual void texture_set_size_override(RID p_texture, int p_width, int p_height) = 0;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void texture_set_path(RID p_texture, const String &p_path) = 0;
|
|
|
|
virtual String texture_get_path(RID p_texture) const = 0;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void texture_set_shrink_all_x2_on_set_data(bool p_enable) = 0;
|
2015-10-21 14:50:44 +02:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
typedef void (*TextureDetectCallback)(void *);
|
2016-05-04 17:36:51 +02:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void texture_set_detect_3d_callback(RID p_texture, TextureDetectCallback p_callback, void *p_userdata) = 0;
|
|
|
|
virtual void texture_set_detect_srgb_callback(RID p_texture, TextureDetectCallback p_callback, void *p_userdata) = 0;
|
2017-06-17 02:47:28 +02:00
|
|
|
virtual void texture_set_detect_normal_callback(RID p_texture, TextureDetectCallback p_callback, void *p_userdata) = 0;
|
2017-02-06 04:38:39 +01:00
|
|
|
|
2015-10-21 14:50:44 +02:00
|
|
|
struct TextureInfo {
|
|
|
|
RID texture;
|
|
|
|
Size2 size;
|
|
|
|
Image::Format format;
|
|
|
|
int bytes;
|
|
|
|
String path;
|
|
|
|
};
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void texture_debug_usage(List<TextureInfo> *r_info) = 0;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void textures_keep_original(bool p_enable) = 0;
|
2016-12-23 04:37:38 +01:00
|
|
|
|
2017-05-25 18:53:59 +02:00
|
|
|
/* SKY API */
|
2016-11-19 17:23:37 +01:00
|
|
|
|
2017-05-25 18:53:59 +02:00
|
|
|
virtual RID sky_create() = 0;
|
|
|
|
virtual void sky_set_texture(RID p_sky, RID p_cube_map, int p_radiance_size) = 0;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
/* SHADER API */
|
|
|
|
|
|
|
|
enum ShaderMode {
|
|
|
|
|
2016-10-03 21:33:42 +02:00
|
|
|
SHADER_SPATIAL,
|
2014-02-10 02:10:30 +01:00
|
|
|
SHADER_CANVAS_ITEM,
|
2017-01-02 02:16:52 +01:00
|
|
|
SHADER_PARTICLES,
|
2016-10-10 23:31:01 +02:00
|
|
|
SHADER_MAX
|
2014-02-10 02:10:30 +01:00
|
|
|
};
|
|
|
|
|
2017-04-07 04:36:37 +02:00
|
|
|
virtual RID shader_create() = 0;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void shader_set_code(RID p_shader, const String &p_code) = 0;
|
|
|
|
virtual String shader_get_code(RID p_shader) const = 0;
|
|
|
|
virtual void shader_get_param_list(RID p_shader, List<PropertyInfo> *p_param_list) const = 0;
|
2014-12-21 15:42:44 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void shader_set_default_texture_param(RID p_shader, const StringName &p_name, RID p_texture) = 0;
|
|
|
|
virtual RID shader_get_default_texture_param(RID p_shader, const StringName &p_name) const = 0;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
/* COMMON MATERIAL API */
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual RID material_create() = 0;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void material_set_shader(RID p_shader_material, RID p_shader) = 0;
|
|
|
|
virtual RID material_get_shader(RID p_shader_material) const = 0;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void material_set_param(RID p_material, const StringName &p_param, const Variant &p_value) = 0;
|
|
|
|
virtual Variant material_get_param(RID p_material, const StringName &p_param) const = 0;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void material_set_line_width(RID p_material, float p_width) = 0;
|
2017-07-08 17:34:05 +02:00
|
|
|
virtual void material_set_next_pass(RID p_material, RID p_next_material) = 0;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
/* MESH API */
|
|
|
|
|
|
|
|
enum ArrayType {
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
ARRAY_VERTEX = 0,
|
|
|
|
ARRAY_NORMAL = 1,
|
|
|
|
ARRAY_TANGENT = 2,
|
|
|
|
ARRAY_COLOR = 3,
|
|
|
|
ARRAY_TEX_UV = 4,
|
|
|
|
ARRAY_TEX_UV2 = 5,
|
|
|
|
ARRAY_BONES = 6,
|
|
|
|
ARRAY_WEIGHTS = 7,
|
|
|
|
ARRAY_INDEX = 8,
|
|
|
|
ARRAY_MAX = 9
|
2016-03-09 00:00:52 +01:00
|
|
|
};
|
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
enum ArrayFormat {
|
|
|
|
/* ARRAY FORMAT FLAGS */
|
2017-03-05 16:44:50 +01:00
|
|
|
ARRAY_FORMAT_VERTEX = 1 << ARRAY_VERTEX, // mandatory
|
|
|
|
ARRAY_FORMAT_NORMAL = 1 << ARRAY_NORMAL,
|
|
|
|
ARRAY_FORMAT_TANGENT = 1 << ARRAY_TANGENT,
|
|
|
|
ARRAY_FORMAT_COLOR = 1 << ARRAY_COLOR,
|
|
|
|
ARRAY_FORMAT_TEX_UV = 1 << ARRAY_TEX_UV,
|
|
|
|
ARRAY_FORMAT_TEX_UV2 = 1 << ARRAY_TEX_UV2,
|
|
|
|
ARRAY_FORMAT_BONES = 1 << ARRAY_BONES,
|
|
|
|
ARRAY_FORMAT_WEIGHTS = 1 << ARRAY_WEIGHTS,
|
|
|
|
ARRAY_FORMAT_INDEX = 1 << ARRAY_INDEX,
|
|
|
|
|
|
|
|
ARRAY_COMPRESS_BASE = (ARRAY_INDEX + 1),
|
|
|
|
ARRAY_COMPRESS_VERTEX = 1 << (ARRAY_VERTEX + ARRAY_COMPRESS_BASE), // mandatory
|
|
|
|
ARRAY_COMPRESS_NORMAL = 1 << (ARRAY_NORMAL + ARRAY_COMPRESS_BASE),
|
|
|
|
ARRAY_COMPRESS_TANGENT = 1 << (ARRAY_TANGENT + ARRAY_COMPRESS_BASE),
|
|
|
|
ARRAY_COMPRESS_COLOR = 1 << (ARRAY_COLOR + ARRAY_COMPRESS_BASE),
|
|
|
|
ARRAY_COMPRESS_TEX_UV = 1 << (ARRAY_TEX_UV + ARRAY_COMPRESS_BASE),
|
|
|
|
ARRAY_COMPRESS_TEX_UV2 = 1 << (ARRAY_TEX_UV2 + ARRAY_COMPRESS_BASE),
|
|
|
|
ARRAY_COMPRESS_BONES = 1 << (ARRAY_BONES + ARRAY_COMPRESS_BASE),
|
|
|
|
ARRAY_COMPRESS_WEIGHTS = 1 << (ARRAY_WEIGHTS + ARRAY_COMPRESS_BASE),
|
|
|
|
ARRAY_COMPRESS_INDEX = 1 << (ARRAY_INDEX + ARRAY_COMPRESS_BASE),
|
|
|
|
|
|
|
|
ARRAY_FLAG_USE_2D_VERTICES = ARRAY_COMPRESS_INDEX << 1,
|
|
|
|
ARRAY_FLAG_USE_16_BIT_BONES = ARRAY_COMPRESS_INDEX << 2,
|
|
|
|
|
|
|
|
ARRAY_COMPRESS_DEFAULT = ARRAY_COMPRESS_VERTEX | ARRAY_COMPRESS_NORMAL | ARRAY_COMPRESS_TANGENT | ARRAY_COMPRESS_COLOR | ARRAY_COMPRESS_TEX_UV | ARRAY_COMPRESS_TEX_UV2 | ARRAY_COMPRESS_WEIGHTS
|
2016-10-03 21:33:42 +02:00
|
|
|
|
2016-03-09 00:00:52 +01:00
|
|
|
};
|
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
enum PrimitiveType {
|
2017-03-05 16:44:50 +01:00
|
|
|
PRIMITIVE_POINTS = 0,
|
|
|
|
PRIMITIVE_LINES = 1,
|
|
|
|
PRIMITIVE_LINE_STRIP = 2,
|
|
|
|
PRIMITIVE_LINE_LOOP = 3,
|
|
|
|
PRIMITIVE_TRIANGLES = 4,
|
|
|
|
PRIMITIVE_TRIANGLE_STRIP = 5,
|
|
|
|
PRIMITIVE_TRIANGLE_FAN = 6,
|
|
|
|
PRIMITIVE_MAX = 7,
|
2016-03-09 00:00:52 +01:00
|
|
|
};
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual RID mesh_create() = 0;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void mesh_add_surface_from_arrays(RID p_mesh, PrimitiveType p_primitive, const Array &p_arrays, const Array &p_blend_shapes = Array(), uint32_t p_compress_format = ARRAY_COMPRESS_DEFAULT);
|
|
|
|
virtual void mesh_add_surface(RID p_mesh, uint32_t p_format, PrimitiveType p_primitive, const PoolVector<uint8_t> &p_array, int p_vertex_count, const PoolVector<uint8_t> &p_index_array, int p_index_count, const Rect3 &p_aabb, const Vector<PoolVector<uint8_t> > &p_blend_shapes = Vector<PoolVector<uint8_t> >(), const Vector<Rect3> &p_bone_aabbs = Vector<Rect3>()) = 0;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void mesh_set_blend_shape_count(RID p_mesh, int p_amount) = 0;
|
|
|
|
virtual int mesh_get_blend_shape_count(RID p_mesh) const = 0;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-01-12 12:34:00 +01:00
|
|
|
enum BlendShapeMode {
|
|
|
|
BLEND_SHAPE_MODE_NORMALIZED,
|
|
|
|
BLEND_SHAPE_MODE_RELATIVE,
|
2014-02-10 02:10:30 +01:00
|
|
|
};
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void mesh_set_blend_shape_mode(RID p_mesh, BlendShapeMode p_mode) = 0;
|
|
|
|
virtual BlendShapeMode mesh_get_blend_shape_mode(RID p_mesh) const = 0;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void mesh_surface_set_material(RID p_mesh, int p_surface, RID p_material) = 0;
|
|
|
|
virtual RID mesh_surface_get_material(RID p_mesh, int p_surface) const = 0;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual int mesh_surface_get_array_len(RID p_mesh, int p_surface) const = 0;
|
|
|
|
virtual int mesh_surface_get_array_index_len(RID p_mesh, int p_surface) const = 0;
|
2016-10-03 21:33:42 +02:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual PoolVector<uint8_t> mesh_surface_get_array(RID p_mesh, int p_surface) const = 0;
|
|
|
|
virtual PoolVector<uint8_t> mesh_surface_get_index_array(RID p_mesh, int p_surface) const = 0;
|
2016-10-03 21:33:42 +02:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual Array mesh_surface_get_arrays(RID p_mesh, int p_surface) const;
|
2016-10-03 21:33:42 +02:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual uint32_t mesh_surface_get_format(RID p_mesh, int p_surface) const = 0;
|
|
|
|
virtual PrimitiveType mesh_surface_get_primitive_type(RID p_mesh, int p_surface) const = 0;
|
2016-03-09 00:00:52 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual Rect3 mesh_surface_get_aabb(RID p_mesh, int p_surface) const = 0;
|
|
|
|
virtual Vector<PoolVector<uint8_t> > mesh_surface_get_blend_shapes(RID p_mesh, int p_surface) const = 0;
|
|
|
|
virtual Vector<Rect3> mesh_surface_get_skeleton_aabb(RID p_mesh, int p_surface) const = 0;
|
2016-11-10 03:55:06 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void mesh_remove_surface(RID p_mesh, int p_index) = 0;
|
|
|
|
virtual int mesh_get_surface_count(RID p_mesh) const = 0;
|
2014-05-05 03:50:23 +02:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void mesh_set_custom_aabb(RID p_mesh, const Rect3 &p_aabb) = 0;
|
|
|
|
virtual Rect3 mesh_get_custom_aabb(RID p_mesh) const = 0;
|
2014-05-05 03:50:23 +02:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void mesh_clear(RID p_mesh) = 0;
|
2015-09-20 18:03:46 +02:00
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
/* MULTIMESH API */
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual RID multimesh_create() = 0;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2016-10-03 21:33:42 +02:00
|
|
|
enum MultimeshTransformFormat {
|
|
|
|
MULTIMESH_TRANSFORM_2D,
|
|
|
|
MULTIMESH_TRANSFORM_3D,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum MultimeshColorFormat {
|
|
|
|
MULTIMESH_COLOR_NONE,
|
|
|
|
MULTIMESH_COLOR_8BIT,
|
|
|
|
MULTIMESH_COLOR_FLOAT,
|
|
|
|
};
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void multimesh_allocate(RID p_multimesh, int p_instances, MultimeshTransformFormat p_transform_format, MultimeshColorFormat p_color_format) = 0;
|
|
|
|
virtual int multimesh_get_instance_count(RID p_multimesh) const = 0;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void multimesh_set_mesh(RID p_multimesh, RID p_mesh) = 0;
|
|
|
|
virtual void multimesh_instance_set_transform(RID p_multimesh, int p_index, const Transform &p_transform) = 0;
|
|
|
|
virtual void multimesh_instance_set_transform_2d(RID p_multimesh, int p_index, const Transform2D &p_transform) = 0;
|
|
|
|
virtual void multimesh_instance_set_color(RID p_multimesh, int p_index, const Color &p_color) = 0;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual RID multimesh_get_mesh(RID p_multimesh) const = 0;
|
|
|
|
virtual Rect3 multimesh_get_aabb(RID p_multimesh) const = 0;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual Transform multimesh_instance_get_transform(RID p_multimesh, int p_index) const = 0;
|
|
|
|
virtual Transform2D multimesh_instance_get_transform_2d(RID p_multimesh, int p_index) const = 0;
|
|
|
|
virtual Color multimesh_instance_get_color(RID p_multimesh, int p_index) const = 0;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void multimesh_set_visible_instances(RID p_multimesh, int p_visible) = 0;
|
|
|
|
virtual int multimesh_get_visible_instances(RID p_multimesh) const = 0;
|
2016-10-03 21:33:42 +02:00
|
|
|
|
2014-05-29 15:56:39 +02:00
|
|
|
/* IMMEDIATE API */
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual RID immediate_create() = 0;
|
|
|
|
virtual void immediate_begin(RID p_immediate, PrimitiveType p_rimitive, RID p_texture = RID()) = 0;
|
|
|
|
virtual void immediate_vertex(RID p_immediate, const Vector3 &p_vertex) = 0;
|
|
|
|
virtual void immediate_vertex_2d(RID p_immediate, const Vector2 &p_vertex);
|
|
|
|
virtual void immediate_normal(RID p_immediate, const Vector3 &p_normal) = 0;
|
|
|
|
virtual void immediate_tangent(RID p_immediate, const Plane &p_tangent) = 0;
|
|
|
|
virtual void immediate_color(RID p_immediate, const Color &p_color) = 0;
|
|
|
|
virtual void immediate_uv(RID p_immediate, const Vector2 &tex_uv) = 0;
|
|
|
|
virtual void immediate_uv2(RID p_immediate, const Vector2 &tex_uv) = 0;
|
|
|
|
virtual void immediate_end(RID p_immediate) = 0;
|
|
|
|
virtual void immediate_clear(RID p_immediate) = 0;
|
|
|
|
virtual void immediate_set_material(RID p_immediate, RID p_material) = 0;
|
|
|
|
virtual RID immediate_get_material(RID p_immediate) const = 0;
|
2014-05-29 15:56:39 +02:00
|
|
|
|
2016-10-03 21:33:42 +02:00
|
|
|
/* SKELETON API */
|
2014-05-29 15:56:39 +02:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual RID skeleton_create() = 0;
|
|
|
|
virtual void skeleton_allocate(RID p_skeleton, int p_bones, bool p_2d_skeleton = false) = 0;
|
|
|
|
virtual int skeleton_get_bone_count(RID p_skeleton) const = 0;
|
|
|
|
virtual void skeleton_bone_set_transform(RID p_skeleton, int p_bone, const Transform &p_transform) = 0;
|
|
|
|
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;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
/* Light API */
|
2016-03-09 00:00:52 +01:00
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
enum LightType {
|
|
|
|
LIGHT_DIRECTIONAL,
|
|
|
|
LIGHT_OMNI,
|
|
|
|
LIGHT_SPOT
|
|
|
|
};
|
|
|
|
|
|
|
|
enum LightParam {
|
2016-03-09 00:00:52 +01:00
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
LIGHT_PARAM_ENERGY,
|
2016-10-03 21:33:42 +02:00
|
|
|
LIGHT_PARAM_SPECULAR,
|
|
|
|
LIGHT_PARAM_RANGE,
|
2014-02-10 02:10:30 +01:00
|
|
|
LIGHT_PARAM_ATTENUATION,
|
2016-10-03 21:33:42 +02:00
|
|
|
LIGHT_PARAM_SPOT_ANGLE,
|
2016-10-27 16:50:26 +02:00
|
|
|
LIGHT_PARAM_SPOT_ATTENUATION,
|
2017-02-08 03:48:09 +01:00
|
|
|
LIGHT_PARAM_CONTACT_SHADOW_SIZE,
|
2016-10-03 21:33:42 +02:00
|
|
|
LIGHT_PARAM_SHADOW_MAX_DISTANCE,
|
|
|
|
LIGHT_PARAM_SHADOW_SPLIT_1_OFFSET,
|
|
|
|
LIGHT_PARAM_SHADOW_SPLIT_2_OFFSET,
|
|
|
|
LIGHT_PARAM_SHADOW_SPLIT_3_OFFSET,
|
|
|
|
LIGHT_PARAM_SHADOW_NORMAL_BIAS,
|
2016-10-27 16:50:26 +02:00
|
|
|
LIGHT_PARAM_SHADOW_BIAS,
|
2014-02-10 02:10:30 +01:00
|
|
|
LIGHT_PARAM_MAX
|
|
|
|
};
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual RID light_create(LightType p_type) = 0;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void light_set_color(RID p_light, const Color &p_color) = 0;
|
|
|
|
virtual void light_set_param(RID p_light, LightParam p_param, float p_value) = 0;
|
|
|
|
virtual void light_set_shadow(RID p_light, bool p_enabled) = 0;
|
|
|
|
virtual void light_set_shadow_color(RID p_light, const Color &p_color) = 0;
|
|
|
|
virtual void light_set_projector(RID p_light, RID p_texture) = 0;
|
|
|
|
virtual void light_set_negative(RID p_light, bool p_enable) = 0;
|
|
|
|
virtual void light_set_cull_mask(RID p_light, uint32_t p_mask) = 0;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
// omni light
|
|
|
|
enum LightOmniShadowMode {
|
|
|
|
LIGHT_OMNI_SHADOW_DUAL_PARABOLOID,
|
2016-11-10 03:55:06 +01:00
|
|
|
LIGHT_OMNI_SHADOW_CUBE,
|
2014-02-10 02:10:30 +01:00
|
|
|
};
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void light_omni_set_shadow_mode(RID p_light, LightOmniShadowMode p_mode) = 0;
|
2016-11-10 03:55:06 +01:00
|
|
|
|
|
|
|
// omni light
|
|
|
|
enum LightOmniShadowDetail {
|
|
|
|
LIGHT_OMNI_SHADOW_DETAIL_VERTICAL,
|
|
|
|
LIGHT_OMNI_SHADOW_DETAIL_HORIZONTAL
|
|
|
|
};
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void light_omni_set_shadow_detail(RID p_light, LightOmniShadowDetail p_detail) = 0;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
// directional light
|
|
|
|
enum LightDirectionalShadowMode {
|
|
|
|
LIGHT_DIRECTIONAL_SHADOW_ORTHOGONAL,
|
2014-05-05 03:50:23 +02:00
|
|
|
LIGHT_DIRECTIONAL_SHADOW_PARALLEL_2_SPLITS,
|
|
|
|
LIGHT_DIRECTIONAL_SHADOW_PARALLEL_4_SPLITS
|
2014-02-10 02:10:30 +01:00
|
|
|
};
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void light_directional_set_shadow_mode(RID p_light, LightDirectionalShadowMode p_mode) = 0;
|
|
|
|
virtual void light_directional_set_blend_splits(RID p_light, bool p_enable) = 0;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2016-10-03 21:33:42 +02:00
|
|
|
/* PROBE API */
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual RID reflection_probe_create() = 0;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2016-11-19 17:23:37 +01:00
|
|
|
enum ReflectionProbeUpdateMode {
|
|
|
|
REFLECTION_PROBE_UPDATE_ONCE,
|
|
|
|
REFLECTION_PROBE_UPDATE_ALWAYS,
|
2014-02-10 02:10:30 +01:00
|
|
|
};
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void reflection_probe_set_update_mode(RID p_probe, ReflectionProbeUpdateMode p_mode) = 0;
|
|
|
|
virtual void reflection_probe_set_intensity(RID p_probe, float p_intensity) = 0;
|
|
|
|
virtual void reflection_probe_set_interior_ambient(RID p_probe, const Color &p_color) = 0;
|
|
|
|
virtual void reflection_probe_set_interior_ambient_energy(RID p_probe, float p_energy) = 0;
|
|
|
|
virtual void reflection_probe_set_interior_ambient_probe_contribution(RID p_probe, float p_contrib) = 0;
|
|
|
|
virtual void reflection_probe_set_max_distance(RID p_probe, float p_distance) = 0;
|
|
|
|
virtual void reflection_probe_set_extents(RID p_probe, const Vector3 &p_extents) = 0;
|
|
|
|
virtual void reflection_probe_set_origin_offset(RID p_probe, const Vector3 &p_offset) = 0;
|
|
|
|
virtual void reflection_probe_set_as_interior(RID p_probe, bool p_enable) = 0;
|
|
|
|
virtual void reflection_probe_set_enable_box_projection(RID p_probe, bool p_enable) = 0;
|
|
|
|
virtual void reflection_probe_set_enable_shadows(RID p_probe, bool p_enable) = 0;
|
|
|
|
virtual void reflection_probe_set_cull_mask(RID p_probe, uint32_t p_layers) = 0;
|
2016-03-09 00:00:52 +01:00
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
/* ROOM API */
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual RID room_create() = 0;
|
|
|
|
virtual void room_add_bounds(RID p_room, const PoolVector<Vector2> &p_convex_polygon, float p_height, const Transform &p_transform) = 0;
|
|
|
|
virtual void room_clear_bounds(RID p_room) = 0;
|
2016-03-09 00:00:52 +01:00
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
/* PORTAL API */
|
|
|
|
|
|
|
|
// portals are only (x/y) points, forming a convex shape, which its clockwise
|
|
|
|
// order points outside. (z is 0);
|
2016-03-09 00:00:52 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual RID portal_create() = 0;
|
|
|
|
virtual void portal_set_shape(RID p_portal, const Vector<Point2> &p_shape) = 0;
|
|
|
|
virtual void portal_set_enabled(RID p_portal, bool p_enabled) = 0;
|
|
|
|
virtual void portal_set_disable_distance(RID p_portal, float p_distance) = 0;
|
|
|
|
virtual void portal_set_disabled_color(RID p_portal, const Color &p_color) = 0;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2016-12-20 04:21:07 +01:00
|
|
|
/* GI PROBE API */
|
2014-05-29 15:56:39 +02:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual RID gi_probe_create() = 0;
|
2014-06-11 15:41:03 +02:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void gi_probe_set_bounds(RID p_probe, const Rect3 &p_bounds) = 0;
|
|
|
|
virtual Rect3 gi_probe_get_bounds(RID p_probe) const = 0;
|
2014-06-11 15:41:03 +02:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void gi_probe_set_cell_size(RID p_probe, float p_range) = 0;
|
|
|
|
virtual float gi_probe_get_cell_size(RID p_probe) const = 0;
|
2014-06-11 15:41:03 +02:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void gi_probe_set_to_cell_xform(RID p_probe, const Transform &p_xform) = 0;
|
|
|
|
virtual Transform gi_probe_get_to_cell_xform(RID p_probe) const = 0;
|
2014-06-11 15:41:03 +02:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void gi_probe_set_dynamic_data(RID p_probe, const PoolVector<int> &p_data) = 0;
|
|
|
|
virtual PoolVector<int> gi_probe_get_dynamic_data(RID p_probe) const = 0;
|
2014-10-28 02:54:32 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void gi_probe_set_dynamic_range(RID p_probe, int p_range) = 0;
|
|
|
|
virtual int gi_probe_get_dynamic_range(RID p_probe) const = 0;
|
2014-10-28 02:54:32 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void gi_probe_set_energy(RID p_probe, float p_range) = 0;
|
|
|
|
virtual float gi_probe_get_energy(RID p_probe) const = 0;
|
2014-08-14 15:31:38 +02:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void gi_probe_set_bias(RID p_probe, float p_range) = 0;
|
|
|
|
virtual float gi_probe_get_bias(RID p_probe) const = 0;
|
2017-02-16 12:55:11 +01:00
|
|
|
|
2017-07-16 04:24:37 +02:00
|
|
|
virtual void gi_probe_set_normal_bias(RID p_probe, float p_range) = 0;
|
|
|
|
virtual float gi_probe_get_normal_bias(RID p_probe) const = 0;
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void gi_probe_set_propagation(RID p_probe, float p_range) = 0;
|
|
|
|
virtual float gi_probe_get_propagation(RID p_probe) const = 0;
|
2017-02-06 09:12:15 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void gi_probe_set_interior(RID p_probe, bool p_enable) = 0;
|
|
|
|
virtual bool gi_probe_is_interior(RID p_probe) const = 0;
|
2014-06-11 15:41:03 +02:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void gi_probe_set_compress(RID p_probe, bool p_enable) = 0;
|
|
|
|
virtual bool gi_probe_is_compressed(RID p_probe) const = 0;
|
2016-01-31 13:56:53 +01:00
|
|
|
|
2016-12-30 12:35:54 +01:00
|
|
|
/* PARTICLES API */
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual RID particles_create() = 0;
|
2016-12-30 12:35:54 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void particles_set_emitting(RID p_particles, bool p_emitting) = 0;
|
|
|
|
virtual void particles_set_amount(RID p_particles, int p_amount) = 0;
|
|
|
|
virtual void particles_set_lifetime(RID p_particles, float p_lifetime) = 0;
|
2017-06-25 13:01:15 +02:00
|
|
|
virtual void particles_set_one_shot(RID p_particles, bool p_one_shot) = 0;
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void particles_set_pre_process_time(RID p_particles, float p_time) = 0;
|
|
|
|
virtual void particles_set_explosiveness_ratio(RID p_particles, float p_ratio) = 0;
|
|
|
|
virtual void particles_set_randomness_ratio(RID p_particles, float p_ratio) = 0;
|
|
|
|
virtual void particles_set_custom_aabb(RID p_particles, const Rect3 &p_aabb) = 0;
|
2017-04-09 03:38:11 +02:00
|
|
|
virtual void particles_set_speed_scale(RID p_particles, float p_scale) = 0;
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void particles_set_use_local_coordinates(RID p_particles, bool p_enable) = 0;
|
|
|
|
virtual void particles_set_process_material(RID p_particles, RID p_material) = 0;
|
2017-04-07 04:36:37 +02:00
|
|
|
virtual void particles_set_fixed_fps(RID p_particles, int p_fps) = 0;
|
|
|
|
virtual void particles_set_fractional_delta(RID p_particles, bool p_enable) = 0;
|
2017-06-25 13:01:15 +02:00
|
|
|
virtual void particles_restart(RID p_particles) = 0;
|
2016-01-31 13:56:53 +01:00
|
|
|
|
2016-12-30 12:35:54 +01:00
|
|
|
enum ParticlesDrawOrder {
|
|
|
|
PARTICLES_DRAW_ORDER_INDEX,
|
|
|
|
PARTICLES_DRAW_ORDER_LIFETIME,
|
|
|
|
PARTICLES_DRAW_ORDER_VIEW_DEPTH,
|
|
|
|
};
|
2014-10-28 02:54:32 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void particles_set_draw_order(RID p_particles, ParticlesDrawOrder p_order) = 0;
|
2014-10-28 02:54:32 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void particles_set_draw_passes(RID p_particles, int p_count) = 0;
|
|
|
|
virtual void particles_set_draw_pass_mesh(RID p_particles, int p_pass, RID p_mesh) = 0;
|
2014-10-28 02:54:32 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual Rect3 particles_get_current_aabb(RID p_particles) = 0;
|
2014-05-29 15:56:39 +02:00
|
|
|
|
2017-06-21 21:25:45 +02:00
|
|
|
virtual void particles_set_emission_transform(RID p_particles, const Transform &p_transform) = 0; //this is only used for 2D, in 3D it's automatic
|
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
/* CAMERA API */
|
2016-03-09 00:00:52 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual RID camera_create() = 0;
|
|
|
|
virtual void camera_set_perspective(RID p_camera, float p_fovy_degrees, float p_z_near, float p_z_far) = 0;
|
|
|
|
virtual void camera_set_orthogonal(RID p_camera, float p_size, float p_z_near, float p_z_far) = 0;
|
|
|
|
virtual void camera_set_transform(RID p_camera, const Transform &p_transform) = 0;
|
|
|
|
virtual void camera_set_cull_mask(RID p_camera, uint32_t p_layers) = 0;
|
|
|
|
virtual void camera_set_environment(RID p_camera, RID p_env) = 0;
|
|
|
|
virtual void camera_set_use_vertical_aspect(RID p_camera, bool p_enable) = 0;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
/*
|
2016-12-30 12:35:54 +01:00
|
|
|
enum ParticlesCollisionMode {
|
|
|
|
PARTICLES_COLLISION_NONE,
|
|
|
|
PARTICLES_COLLISION_TEXTURE,
|
|
|
|
PARTICLES_COLLISION_CUBEMAP,
|
2014-02-10 02:10:30 +01:00
|
|
|
};
|
|
|
|
|
2016-12-30 12:35:54 +01:00
|
|
|
virtual void particles_set_collision(RID p_particles,ParticlesCollisionMode p_mode,const Transform&, p_xform,const RID p_depth_tex,const RID p_normal_tex)=0;
|
2014-02-10 02:10:30 +01:00
|
|
|
*/
|
2016-10-03 21:33:42 +02:00
|
|
|
/* VIEWPORT TARGET API */
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual RID viewport_create() = 0;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-04-23 14:10:41 +02:00
|
|
|
virtual void viewport_set_use_arvr(RID p_viewport, bool p_use_arvr) = 0;
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void viewport_set_size(RID p_viewport, int p_width, int p_height) = 0;
|
|
|
|
virtual void viewport_set_active(RID p_viewport, bool p_active) = 0;
|
|
|
|
virtual void viewport_set_parent_viewport(RID p_viewport, RID p_parent_viewport) = 0;
|
2016-10-03 21:33:42 +02:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void viewport_attach_to_screen(RID p_viewport, const Rect2 &p_rect = Rect2(), int p_screen = 0) = 0;
|
|
|
|
virtual void viewport_detach(RID p_viewport) = 0;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2016-10-03 21:33:42 +02:00
|
|
|
enum ViewportUpdateMode {
|
|
|
|
VIEWPORT_UPDATE_DISABLED,
|
|
|
|
VIEWPORT_UPDATE_ONCE, //then goes to disabled, must be manually updated
|
|
|
|
VIEWPORT_UPDATE_WHEN_VISIBLE, // default
|
|
|
|
VIEWPORT_UPDATE_ALWAYS
|
2014-02-10 02:10:30 +01:00
|
|
|
};
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void viewport_set_update_mode(RID p_viewport, ViewportUpdateMode p_mode) = 0;
|
|
|
|
virtual void viewport_set_vflip(RID p_viewport, bool p_enable) = 0;
|
2014-04-15 03:43:44 +02:00
|
|
|
|
2016-10-03 21:33:42 +02:00
|
|
|
enum ViewportClearMode {
|
2014-04-15 03:43:44 +02:00
|
|
|
|
2016-10-03 21:33:42 +02:00
|
|
|
VIEWPORT_CLEAR_ALWAYS,
|
2016-10-05 06:26:35 +02:00
|
|
|
VIEWPORT_CLEAR_NEVER,
|
2016-10-03 21:33:42 +02:00
|
|
|
VIEWPORT_CLEAR_ONLY_NEXT_FRAME
|
2014-02-10 02:10:30 +01:00
|
|
|
};
|
2016-03-09 00:00:52 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void viewport_set_clear_mode(RID p_viewport, ViewportClearMode p_clear_mode) = 0;
|
2016-10-03 21:33:42 +02:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual RID viewport_get_texture(RID p_viewport) const = 0;
|
2016-03-09 00:00:52 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void viewport_set_hide_scenario(RID p_viewport, bool p_hide) = 0;
|
|
|
|
virtual void viewport_set_hide_canvas(RID p_viewport, bool p_hide) = 0;
|
|
|
|
virtual void viewport_set_disable_environment(RID p_viewport, bool p_disable) = 0;
|
|
|
|
virtual void viewport_set_disable_3d(RID p_viewport, bool p_disable) = 0;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void viewport_attach_camera(RID p_viewport, RID p_camera) = 0;
|
|
|
|
virtual void viewport_set_scenario(RID p_viewport, RID p_scenario) = 0;
|
|
|
|
virtual void viewport_attach_canvas(RID p_viewport, RID p_canvas) = 0;
|
|
|
|
virtual void viewport_remove_canvas(RID p_viewport, RID p_canvas) = 0;
|
|
|
|
virtual void viewport_set_canvas_transform(RID p_viewport, RID p_canvas, const Transform2D &p_offset) = 0;
|
|
|
|
virtual void viewport_set_transparent_background(RID p_viewport, bool p_enabled) = 0;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void viewport_set_global_canvas_transform(RID p_viewport, const Transform2D &p_transform) = 0;
|
|
|
|
virtual void viewport_set_canvas_layer(RID p_viewport, RID p_canvas, int p_layer) = 0;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void viewport_set_shadow_atlas_size(RID p_viewport, int p_size) = 0;
|
|
|
|
virtual void viewport_set_shadow_atlas_quadrant_subdivision(RID p_viewport, int p_quadrant, int p_subdiv) = 0;
|
2016-11-10 03:55:06 +01:00
|
|
|
|
2017-01-02 02:16:52 +01:00
|
|
|
enum ViewportMSAA {
|
|
|
|
VIEWPORT_MSAA_DISABLED,
|
|
|
|
VIEWPORT_MSAA_2X,
|
|
|
|
VIEWPORT_MSAA_4X,
|
|
|
|
VIEWPORT_MSAA_8X,
|
|
|
|
VIEWPORT_MSAA_16X,
|
|
|
|
};
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void viewport_set_msaa(RID p_viewport, ViewportMSAA p_msaa) = 0;
|
2017-06-09 05:23:50 +02:00
|
|
|
|
|
|
|
enum ViewportUsage {
|
|
|
|
VIEWPORT_USAGE_2D,
|
|
|
|
VIEWPORT_USAGE_2D_NO_SAMPLING,
|
|
|
|
VIEWPORT_USAGE_3D,
|
|
|
|
VIEWPORT_USAGE_3D_NO_EFFECTS,
|
|
|
|
};
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void viewport_set_hdr(RID p_viewport, bool p_enabled) = 0;
|
2017-06-09 05:23:50 +02:00
|
|
|
virtual void viewport_set_usage(RID p_viewport, ViewportUsage p_usage) = 0;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-06-11 20:52:03 +02:00
|
|
|
enum ViewportRenderInfo {
|
|
|
|
|
|
|
|
VIEWPORT_RENDER_INFO_OBJECTS_IN_FRAME,
|
|
|
|
VIEWPORT_RENDER_INFO_VERTICES_IN_FRAME,
|
|
|
|
VIEWPORT_RENDER_INFO_MATERIAL_CHANGES_IN_FRAME,
|
|
|
|
VIEWPORT_RENDER_INFO_SHADER_CHANGES_IN_FRAME,
|
|
|
|
VIEWPORT_RENDER_INFO_SURFACE_CHANGES_IN_FRAME,
|
|
|
|
VIEWPORT_RENDER_INFO_DRAW_CALLS_IN_FRAME,
|
|
|
|
VIEWPORT_RENDER_INFO_MAX
|
|
|
|
};
|
|
|
|
|
|
|
|
virtual int viewport_get_render_info(RID p_viewport, ViewportRenderInfo p_info) = 0;
|
|
|
|
|
|
|
|
enum ViewportDebugDraw {
|
|
|
|
VIEWPORT_DEBUG_DRAW_DISABLED,
|
|
|
|
VIEWPORT_DEBUG_DRAW_UNSHADED,
|
|
|
|
VIEWPORT_DEBUG_DRAW_OVERDRAW,
|
|
|
|
VIEWPORT_DEBUG_DRAW_WIREFRAME,
|
|
|
|
};
|
|
|
|
|
|
|
|
virtual void viewport_set_debug_draw(RID p_viewport, ViewportDebugDraw p_draw) = 0;
|
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
/* ENVIRONMENT API */
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual RID environment_create() = 0;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
enum EnvironmentBG {
|
|
|
|
|
2016-10-21 12:27:13 +02:00
|
|
|
ENV_BG_CLEAR_COLOR,
|
2014-02-10 02:10:30 +01:00
|
|
|
ENV_BG_COLOR,
|
2017-05-25 18:53:59 +02:00
|
|
|
ENV_BG_SKY,
|
2015-03-16 04:47:37 +01:00
|
|
|
ENV_BG_CANVAS,
|
2016-10-21 12:27:13 +02:00
|
|
|
ENV_BG_KEEP,
|
2014-02-10 02:10:30 +01:00
|
|
|
ENV_BG_MAX
|
|
|
|
};
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void environment_set_background(RID p_env, EnvironmentBG p_bg) = 0;
|
2017-05-25 18:53:59 +02:00
|
|
|
virtual void environment_set_sky(RID p_env, RID p_sky) = 0;
|
|
|
|
virtual void environment_set_sky_scale(RID p_env, float p_scale) = 0;
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void environment_set_bg_color(RID p_env, const Color &p_color) = 0;
|
|
|
|
virtual void environment_set_bg_energy(RID p_env, float p_energy) = 0;
|
|
|
|
virtual void environment_set_canvas_max_layer(RID p_env, int p_max_layer) = 0;
|
2017-05-25 18:53:59 +02:00
|
|
|
virtual void environment_set_ambient_light(RID p_env, const Color &p_color, float p_energy = 1.0, float p_sky_contribution = 0.0) = 0;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2016-10-03 21:33:42 +02:00
|
|
|
//set default SSAO options
|
|
|
|
//set default SSR options
|
|
|
|
//set default SSSSS options
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2016-12-10 05:13:20 +01:00
|
|
|
enum EnvironmentDOFBlurQuality {
|
|
|
|
ENV_DOF_BLUR_QUALITY_LOW,
|
|
|
|
ENV_DOF_BLUR_QUALITY_MEDIUM,
|
|
|
|
ENV_DOF_BLUR_QUALITY_HIGH,
|
2014-02-10 02:10:30 +01:00
|
|
|
};
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void environment_set_dof_blur_near(RID p_env, bool p_enable, float p_distance, float p_transition, float p_far_amount, EnvironmentDOFBlurQuality p_quality) = 0;
|
|
|
|
virtual void environment_set_dof_blur_far(RID p_env, bool p_enable, float p_distance, float p_transition, float p_far_amount, EnvironmentDOFBlurQuality p_quality) = 0;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2016-10-03 21:33:42 +02:00
|
|
|
enum EnvironmentGlowBlendMode {
|
|
|
|
GLOW_BLEND_MODE_ADDITIVE,
|
|
|
|
GLOW_BLEND_MODE_SCREEN,
|
|
|
|
GLOW_BLEND_MODE_SOFTLIGHT,
|
2016-12-08 13:48:38 +01:00
|
|
|
GLOW_BLEND_MODE_REPLACE,
|
2014-05-29 15:56:39 +02:00
|
|
|
};
|
2017-07-08 17:12:18 +02:00
|
|
|
virtual void environment_set_glow(RID p_env, bool p_enable, int p_level_flags, float p_intensity, float p_strength, float p_bloom_threshold, EnvironmentGlowBlendMode p_blend_mode, float p_hdr_bleed_threshold, float p_hdr_bleed_scale, bool p_bicubic_upscale) = 0;
|
2014-06-28 04:21:45 +02:00
|
|
|
|
2016-10-03 21:33:42 +02:00
|
|
|
enum EnvironmentToneMapper {
|
|
|
|
ENV_TONE_MAPPER_LINEAR,
|
|
|
|
ENV_TONE_MAPPER_REINHARDT,
|
2016-10-30 01:48:09 +02:00
|
|
|
ENV_TONE_MAPPER_FILMIC,
|
2016-12-07 21:49:52 +01:00
|
|
|
ENV_TONE_MAPPER_ACES
|
2014-02-10 02:10:30 +01:00
|
|
|
};
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void environment_set_tonemap(RID p_env, EnvironmentToneMapper p_tone_mapper, float p_exposure, float p_white, bool p_auto_exposure, float p_min_luminance, float p_max_luminance, float p_auto_exp_speed, float p_auto_exp_grey) = 0;
|
|
|
|
virtual void environment_set_adjustment(RID p_env, bool p_enable, float p_brightness, float p_contrast, float p_saturation, RID p_ramp) = 0;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-06-16 02:28:05 +02:00
|
|
|
virtual void environment_set_ssr(RID p_env, bool p_enable, int p_max_steps, float p_fade_in, float p_fade_out, float p_depth_tolerance, bool p_roughness) = 0;
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void environment_set_ssao(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_radius2, float p_intensity2, float p_bias, float p_light_affect, const Color &p_color, bool p_blur) = 0;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-06-07 04:16:17 +02:00
|
|
|
virtual void environment_set_fog(RID p_env, bool p_enable, const Color &p_color, const Color &p_sun_color, float p_sun_amount) = 0;
|
|
|
|
virtual void environment_set_fog_depth(RID p_env, bool p_enable, float p_depth_begin, float p_depth_curve, bool p_transmit, float p_transmit_curve) = 0;
|
|
|
|
virtual void environment_set_fog_height(RID p_env, bool p_enable, float p_min_height, float p_max_height, float p_height_curve) = 0;
|
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
/* SCENARIO API */
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual RID scenario_create() = 0;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
enum ScenarioDebugMode {
|
|
|
|
SCENARIO_DEBUG_DISABLED,
|
|
|
|
SCENARIO_DEBUG_WIREFRAME,
|
|
|
|
SCENARIO_DEBUG_OVERDRAW,
|
2014-09-18 05:18:57 +02:00
|
|
|
SCENARIO_DEBUG_SHADELESS,
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
};
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void scenario_set_debug(RID p_scenario, ScenarioDebugMode p_debug_mode) = 0;
|
|
|
|
virtual void scenario_set_environment(RID p_scenario, RID p_environment) = 0;
|
|
|
|
virtual void scenario_set_reflection_atlas_size(RID p_scenario, int p_size, int p_subdiv) = 0;
|
|
|
|
virtual void scenario_set_fallback_environment(RID p_scenario, RID p_environment) = 0;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
/* INSTANCING API */
|
2016-03-09 00:00:52 +01:00
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
enum InstanceType {
|
2016-03-09 00:00:52 +01:00
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
INSTANCE_NONE,
|
|
|
|
INSTANCE_MESH,
|
|
|
|
INSTANCE_MULTIMESH,
|
2014-05-29 15:56:39 +02:00
|
|
|
INSTANCE_IMMEDIATE,
|
2014-02-10 02:10:30 +01:00
|
|
|
INSTANCE_PARTICLES,
|
|
|
|
INSTANCE_LIGHT,
|
2016-10-03 21:33:42 +02:00
|
|
|
INSTANCE_REFLECTION_PROBE,
|
2014-02-10 02:10:30 +01:00
|
|
|
INSTANCE_ROOM,
|
|
|
|
INSTANCE_PORTAL,
|
2016-12-20 04:21:07 +01:00
|
|
|
INSTANCE_GI_PROBE,
|
2016-10-19 16:14:41 +02:00
|
|
|
INSTANCE_MAX,
|
2016-12-20 04:21:07 +01:00
|
|
|
/*INSTANCE_BAKED_LIGHT_SAMPLER,*/
|
2014-10-28 02:54:32 +01:00
|
|
|
|
2017-04-07 04:36:37 +02:00
|
|
|
INSTANCE_GEOMETRY_MASK = (1 << INSTANCE_MESH) | (1 << INSTANCE_MULTIMESH) | (1 << INSTANCE_IMMEDIATE) | (1 << INSTANCE_PARTICLES)
|
2014-02-10 02:10:30 +01:00
|
|
|
};
|
2016-03-09 00:00:52 +01:00
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
virtual RID instance_create2(RID p_base, RID p_scenario);
|
|
|
|
|
2017-01-14 12:26:56 +01:00
|
|
|
//virtual RID instance_create(RID p_base,RID p_scenario)=0; // from can be mesh, light, area and portal so far.
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual RID instance_create() = 0; // from can be mesh, light, poly, area and portal so far.
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void instance_set_base(RID p_instance, RID p_base) = 0; // from can be mesh, light, poly, area and portal so far.
|
|
|
|
virtual void instance_set_scenario(RID p_instance, RID p_scenario) = 0; // from can be mesh, light, poly, area and portal so far.
|
|
|
|
virtual void instance_set_layer_mask(RID p_instance, uint32_t p_mask) = 0;
|
|
|
|
virtual void instance_set_transform(RID p_instance, const Transform &p_transform) = 0;
|
2017-08-07 12:17:31 +02:00
|
|
|
virtual void instance_attach_object_instance_id(RID p_instance, ObjectID p_ID) = 0;
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void instance_set_blend_shape_weight(RID p_instance, int p_shape, float p_weight) = 0;
|
|
|
|
virtual void instance_set_surface_material(RID p_instance, int p_surface, RID p_material) = 0;
|
|
|
|
virtual void instance_set_visible(RID p_instance, bool p_visible) = 0;
|
2016-05-27 19:18:40 +02:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void instance_attach_skeleton(RID p_instance, RID p_skeleton) = 0;
|
|
|
|
virtual void instance_set_exterior(RID p_instance, bool p_enabled) = 0;
|
|
|
|
virtual void instance_set_room(RID p_instance, RID p_room) = 0;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void instance_set_extra_visibility_margin(RID p_instance, real_t p_margin) = 0;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
// don't use these in a game!
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual Vector<ObjectID> instances_cull_aabb(const Rect3 &p_aabb, RID p_scenario = RID()) const = 0;
|
|
|
|
virtual Vector<ObjectID> instances_cull_ray(const Vector3 &p_from, const Vector3 &p_to, RID p_scenario = RID()) const = 0;
|
|
|
|
virtual Vector<ObjectID> instances_cull_convex(const Vector<Plane> &p_convex, RID p_scenario = RID()) const = 0;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
enum InstanceFlags {
|
|
|
|
INSTANCE_FLAG_CAST_SHADOW,
|
|
|
|
INSTANCE_FLAG_VISIBLE_IN_ALL_ROOMS,
|
2014-06-11 15:41:03 +02:00
|
|
|
INSTANCE_FLAG_USE_BAKED_LIGHT,
|
2014-02-10 02:10:30 +01:00
|
|
|
INSTANCE_FLAG_MAX
|
|
|
|
};
|
|
|
|
|
2016-03-08 00:00:55 +01:00
|
|
|
enum ShadowCastingSetting {
|
|
|
|
SHADOW_CASTING_SETTING_OFF,
|
|
|
|
SHADOW_CASTING_SETTING_ON,
|
|
|
|
SHADOW_CASTING_SETTING_DOUBLE_SIDED,
|
|
|
|
SHADOW_CASTING_SETTING_SHADOWS_ONLY,
|
|
|
|
};
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void instance_geometry_set_flag(RID p_instance, InstanceFlags p_flags, bool p_enabled) = 0;
|
2016-03-08 00:00:55 +01:00
|
|
|
virtual void instance_geometry_set_cast_shadows_setting(RID p_instance, ShadowCastingSetting p_shadow_casting_setting) = 0;
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void instance_geometry_set_material_override(RID p_instance, RID p_material) = 0;
|
2014-06-11 15:41:03 +02:00
|
|
|
|
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) = 0;
|
|
|
|
virtual void instance_geometry_set_as_instance_lod(RID p_instance, RID p_as_lod_of_instance) = 0;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
/* CANVAS (2D) */
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual RID canvas_create() = 0;
|
|
|
|
virtual void canvas_set_item_mirroring(RID p_canvas, RID p_item, const Point2 &p_mirroring) = 0;
|
|
|
|
virtual void canvas_set_modulate(RID p_canvas, const Color &p_color) = 0;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual RID canvas_item_create() = 0;
|
|
|
|
virtual void canvas_item_set_parent(RID p_item, RID p_parent) = 0;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void canvas_item_set_visible(RID p_item, bool p_visible) = 0;
|
|
|
|
virtual void canvas_item_set_light_mask(RID p_item, int p_mask) = 0;
|
2015-02-18 23:39:44 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void canvas_item_set_transform(RID p_item, const Transform2D &p_transform) = 0;
|
|
|
|
virtual void canvas_item_set_clip(RID p_item, bool p_clip) = 0;
|
|
|
|
virtual void canvas_item_set_distance_field_mode(RID p_item, bool p_enable) = 0;
|
|
|
|
virtual void canvas_item_set_custom_rect(RID p_item, bool p_custom_rect, const Rect2 &p_rect = Rect2()) = 0;
|
|
|
|
virtual void canvas_item_set_modulate(RID p_item, const Color &p_color) = 0;
|
|
|
|
virtual void canvas_item_set_self_modulate(RID p_item, const Color &p_color) = 0;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void canvas_item_set_draw_behind_parent(RID p_item, bool p_enable) = 0;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2016-10-03 21:33:42 +02:00
|
|
|
enum NinePatchAxisMode {
|
|
|
|
NINE_PATCH_STRETCH,
|
|
|
|
NINE_PATCH_TILE,
|
|
|
|
NINE_PATCH_TILE_FIT,
|
|
|
|
};
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void canvas_item_add_line(RID p_item, const Point2 &p_from, const Point2 &p_to, const Color &p_color, float p_width = 1.0, bool p_antialiased = false) = 0;
|
2017-07-01 02:30:17 +02:00
|
|
|
virtual void canvas_item_add_polyline(RID p_item, const Vector<Point2> &p_points, const Vector<Color> &p_colors, float p_width = 1.0, bool p_antialiased = false) = 0;
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void canvas_item_add_rect(RID p_item, const Rect2 &p_rect, const Color &p_color) = 0;
|
|
|
|
virtual void canvas_item_add_circle(RID p_item, const Point2 &p_pos, float p_radius, const Color &p_color) = 0;
|
2017-06-18 04:26:49 +02:00
|
|
|
virtual void canvas_item_add_texture_rect(RID p_item, const Rect2 &p_rect, RID p_texture, bool p_tile = false, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, RID p_normal_map = RID()) = 0;
|
2017-06-19 03:55:02 +02:00
|
|
|
virtual void canvas_item_add_texture_rect_region(RID p_item, const Rect2 &p_rect, RID p_texture, const Rect2 &p_src_rect, const Color &p_modulate = Color(1, 1, 1), bool p_transpose = false, RID p_normal_map = RID(), bool p_clip_uv = true) = 0;
|
2017-06-18 04:26:49 +02:00
|
|
|
virtual 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, NinePatchAxisMode p_x_axis_mode = NINE_PATCH_STRETCH, NinePatchAxisMode p_y_axis_mode = NINE_PATCH_STRETCH, bool p_draw_center = true, const Color &p_modulate = Color(1, 1, 1), RID p_normal_map = RID()) = 0;
|
|
|
|
virtual 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()) = 0;
|
|
|
|
virtual 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()) = 0;
|
|
|
|
virtual 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()) = 0;
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void canvas_item_add_mesh(RID p_item, const RID &p_mesh, RID p_skeleton = RID()) = 0;
|
|
|
|
virtual void canvas_item_add_multimesh(RID p_item, RID p_mesh, RID p_skeleton = RID()) = 0;
|
2017-06-21 21:25:45 +02:00
|
|
|
virtual void canvas_item_add_particles(RID p_item, RID p_particles, RID p_texture, RID p_normal_map, int p_h_frames, int p_v_frames) = 0;
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void canvas_item_add_set_transform(RID p_item, const Transform2D &p_transform) = 0;
|
|
|
|
virtual void canvas_item_add_clip_ignore(RID p_item, bool p_ignore) = 0;
|
|
|
|
virtual void canvas_item_set_sort_children_by_y(RID p_item, bool p_enable) = 0;
|
|
|
|
virtual void canvas_item_set_z(RID p_item, int p_z) = 0;
|
|
|
|
virtual void canvas_item_set_z_as_relative_to_parent(RID p_item, bool p_enable) = 0;
|
|
|
|
virtual void canvas_item_set_copy_to_backbuffer(RID p_item, bool p_enable, const Rect2 &p_rect) = 0;
|
|
|
|
|
|
|
|
virtual void canvas_item_clear(RID p_item) = 0;
|
|
|
|
virtual void canvas_item_set_draw_index(RID p_item, int p_index) = 0;
|
|
|
|
|
|
|
|
virtual void canvas_item_set_material(RID p_item, RID p_material) = 0;
|
|
|
|
|
|
|
|
virtual void canvas_item_set_use_parent_material(RID p_item, bool p_enable) = 0;
|
|
|
|
|
|
|
|
virtual RID canvas_light_create() = 0;
|
|
|
|
virtual void canvas_light_attach_to_canvas(RID p_light, RID p_canvas) = 0;
|
|
|
|
virtual void canvas_light_set_enabled(RID p_light, bool p_enabled) = 0;
|
|
|
|
virtual void canvas_light_set_scale(RID p_light, float p_scale) = 0;
|
|
|
|
virtual void canvas_light_set_transform(RID p_light, const Transform2D &p_transform) = 0;
|
|
|
|
virtual void canvas_light_set_texture(RID p_light, RID p_texture) = 0;
|
|
|
|
virtual void canvas_light_set_texture_offset(RID p_light, const Vector2 &p_offset) = 0;
|
|
|
|
virtual void canvas_light_set_color(RID p_light, const Color &p_color) = 0;
|
|
|
|
virtual void canvas_light_set_height(RID p_light, float p_height) = 0;
|
|
|
|
virtual void canvas_light_set_energy(RID p_light, float p_energy) = 0;
|
|
|
|
virtual void canvas_light_set_z_range(RID p_light, int p_min_z, int p_max_z) = 0;
|
|
|
|
virtual void canvas_light_set_layer_range(RID p_light, int p_min_layer, int p_max_layer) = 0;
|
|
|
|
virtual void canvas_light_set_item_cull_mask(RID p_light, int p_mask) = 0;
|
|
|
|
virtual void canvas_light_set_item_shadow_cull_mask(RID p_light, int p_mask) = 0;
|
2015-01-22 15:07:16 +01:00
|
|
|
|
2015-04-03 06:43:37 +02:00
|
|
|
enum CanvasLightMode {
|
|
|
|
CANVAS_LIGHT_MODE_ADD,
|
|
|
|
CANVAS_LIGHT_MODE_SUB,
|
|
|
|
CANVAS_LIGHT_MODE_MIX,
|
2015-12-09 00:25:08 +01:00
|
|
|
CANVAS_LIGHT_MODE_MASK,
|
2015-04-03 06:43:37 +02:00
|
|
|
};
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void canvas_light_set_mode(RID p_light, CanvasLightMode p_mode) = 0;
|
2016-10-03 21:33:42 +02:00
|
|
|
|
|
|
|
enum CanvasLightShadowFilter {
|
|
|
|
CANVAS_LIGHT_FILTER_NONE,
|
|
|
|
CANVAS_LIGHT_FILTER_PCF3,
|
|
|
|
CANVAS_LIGHT_FILTER_PCF5,
|
|
|
|
CANVAS_LIGHT_FILTER_PCF9,
|
|
|
|
CANVAS_LIGHT_FILTER_PCF13,
|
|
|
|
};
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void canvas_light_set_shadow_enabled(RID p_light, bool p_enabled) = 0;
|
|
|
|
virtual void canvas_light_set_shadow_buffer_size(RID p_light, int p_size) = 0;
|
|
|
|
virtual void canvas_light_set_shadow_gradient_length(RID p_light, float p_length) = 0;
|
|
|
|
virtual void canvas_light_set_shadow_filter(RID p_light, CanvasLightShadowFilter p_filter) = 0;
|
|
|
|
virtual void canvas_light_set_shadow_color(RID p_light, const Color &p_color) = 0;
|
2017-06-13 06:23:04 +02:00
|
|
|
virtual void canvas_light_set_shadow_smooth(RID p_light, float p_smooth) = 0;
|
2015-03-02 04:54:10 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual RID canvas_light_occluder_create() = 0;
|
|
|
|
virtual void canvas_light_occluder_attach_to_canvas(RID p_occluder, RID p_canvas) = 0;
|
|
|
|
virtual void canvas_light_occluder_set_enabled(RID p_occluder, bool p_enabled) = 0;
|
|
|
|
virtual void canvas_light_occluder_set_polygon(RID p_occluder, RID p_polygon) = 0;
|
|
|
|
virtual void canvas_light_occluder_set_transform(RID p_occluder, const Transform2D &p_xform) = 0;
|
|
|
|
virtual void canvas_light_occluder_set_light_mask(RID p_occluder, int p_mask) = 0;
|
2015-01-22 15:07:16 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual RID canvas_occluder_polygon_create() = 0;
|
|
|
|
virtual void canvas_occluder_polygon_set_shape(RID p_occluder_polygon, const PoolVector<Vector2> &p_shape, bool p_closed) = 0;
|
|
|
|
virtual void canvas_occluder_polygon_set_shape_as_lines(RID p_occluder_polygon, const PoolVector<Vector2> &p_shape) = 0;
|
2016-10-03 21:33:42 +02:00
|
|
|
|
2015-03-02 04:54:10 +01:00
|
|
|
enum CanvasOccluderPolygonCullMode {
|
|
|
|
CANVAS_OCCLUDER_POLYGON_CULL_DISABLED,
|
|
|
|
CANVAS_OCCLUDER_POLYGON_CULL_CLOCKWISE,
|
|
|
|
CANVAS_OCCLUDER_POLYGON_CULL_COUNTER_CLOCKWISE,
|
|
|
|
};
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void canvas_occluder_polygon_set_cull_mode(RID p_occluder_polygon, CanvasOccluderPolygonCullMode p_mode) = 0;
|
2015-01-22 15:07:16 +01:00
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
/* CURSOR */
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void cursor_set_rotation(float p_rotation, int p_cursor = 0) = 0; // radians
|
|
|
|
virtual void cursor_set_texture(RID p_texture, const Point2 &p_center_offset = Point2(0, 0), int p_cursor = 0, const Rect2 &p_region = Rect2()) = 0;
|
|
|
|
virtual void cursor_set_visible(bool p_visible, int p_cursor = 0) = 0;
|
|
|
|
virtual void cursor_set_pos(const Point2 &p_pos, int p_cursor = 0) = 0;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
/* BLACK BARS */
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void black_bars_set_margins(int p_left, int p_top, int p_right, int p_bottom) = 0;
|
|
|
|
virtual void black_bars_set_images(RID p_left, RID p_top, RID p_right, RID p_bottom) = 0;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
/* FREE */
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void free(RID p_rid) = 0; ///< free RIDs associated with the visual server
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-06-09 05:23:50 +02:00
|
|
|
virtual void request_frame_drawn_callback(Object *p_where, const StringName &p_method, const Variant &p_userdata) = 0;
|
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
/* EVENT QUEUING */
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void draw() = 0;
|
|
|
|
virtual void sync() = 0;
|
|
|
|
virtual bool has_changed() const = 0;
|
|
|
|
virtual void init() = 0;
|
|
|
|
virtual void finish() = 0;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
/* STATUS INFORMATION */
|
|
|
|
|
|
|
|
enum RenderInfo {
|
|
|
|
|
|
|
|
INFO_OBJECTS_IN_FRAME,
|
|
|
|
INFO_VERTICES_IN_FRAME,
|
|
|
|
INFO_MATERIAL_CHANGES_IN_FRAME,
|
|
|
|
INFO_SHADER_CHANGES_IN_FRAME,
|
|
|
|
INFO_SURFACE_CHANGES_IN_FRAME,
|
|
|
|
INFO_DRAW_CALLS_IN_FRAME,
|
|
|
|
INFO_USAGE_VIDEO_MEM_TOTAL,
|
|
|
|
INFO_VIDEO_MEM_USED,
|
|
|
|
INFO_TEXTURE_MEM_USED,
|
|
|
|
INFO_VERTEX_MEM_USED,
|
|
|
|
};
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual int get_render_info(RenderInfo p_info) = 0;
|
2014-05-29 15:56:39 +02:00
|
|
|
|
|
|
|
/* Materials for 2D on 3D */
|
|
|
|
|
2017-04-17 03:32:51 +02:00
|
|
|
RID material_2d_get(bool p_shaded, bool p_transparent, bool p_double_sided, bool p_cut_alpha, bool p_opaque_prepass);
|
2016-03-09 00:00:52 +01:00
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
/* TESTING */
|
2016-03-09 00:00:52 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual RID get_test_cube() = 0;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
virtual RID get_test_texture();
|
2014-05-29 15:56:39 +02:00
|
|
|
virtual RID get_white_texture();
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual RID make_sphere_mesh(int p_lats, int p_lons, float p_radius);
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void mesh_add_surface_from_mesh_data(RID p_mesh, const Geometry::MeshData &p_mesh_data);
|
|
|
|
virtual void mesh_add_surface_from_planes(RID p_mesh, const PoolVector<Plane> &p_planes);
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-05-17 12:36:47 +02:00
|
|
|
virtual void set_boot_image(const Ref<Image> &p_image, const Color &p_color, bool p_scale) = 0;
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void set_default_clear_color(const Color &p_color) = 0;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
enum Features {
|
|
|
|
FEATURE_SHADERS,
|
|
|
|
FEATURE_MULTITHREADED,
|
|
|
|
};
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual bool has_feature(Features p_feature) const = 0;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual bool has_os_feature(const String &p_feature) const = 0;
|
2017-02-06 04:38:39 +01:00
|
|
|
|
2017-06-11 20:52:03 +02:00
|
|
|
virtual void set_debug_generate_wireframes(bool p_generate) = 0;
|
|
|
|
|
2016-03-09 00:00:52 +01:00
|
|
|
VisualServer();
|
2014-02-10 02:10:30 +01:00
|
|
|
virtual ~VisualServer();
|
|
|
|
};
|
|
|
|
|
|
|
|
// make variant understand the enums
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
VARIANT_ENUM_CAST(VisualServer::CubeMapSide);
|
|
|
|
VARIANT_ENUM_CAST(VisualServer::TextureFlags);
|
|
|
|
VARIANT_ENUM_CAST(VisualServer::ShaderMode);
|
|
|
|
VARIANT_ENUM_CAST(VisualServer::ArrayType);
|
|
|
|
VARIANT_ENUM_CAST(VisualServer::ArrayFormat);
|
|
|
|
VARIANT_ENUM_CAST(VisualServer::PrimitiveType);
|
|
|
|
VARIANT_ENUM_CAST(VisualServer::LightType);
|
|
|
|
VARIANT_ENUM_CAST(VisualServer::LightParam);
|
|
|
|
VARIANT_ENUM_CAST(VisualServer::ScenarioDebugMode);
|
|
|
|
VARIANT_ENUM_CAST(VisualServer::InstanceType);
|
|
|
|
VARIANT_ENUM_CAST(VisualServer::RenderInfo);
|
2016-10-03 21:33:42 +02:00
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
//typedef VisualServer VS; // makes it easier to use
|
|
|
|
#define VS VisualServer
|
|
|
|
|
|
|
|
#endif
|