summaryrefslogtreecommitdiffstats
path: root/scene/resources/multimesh.cpp
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2016-10-03 16:33:42 -0300
committerJuan Linietsky <reduzio@gmail.com>2016-10-03 21:35:16 +0200
commit22d83bc9f655d5ae7a1b49709c4c1b663725daf5 (patch)
treea817195c08d4713a70ca014a3f63f5937934fe36 /scene/resources/multimesh.cpp
parent78d97b060a6873a454e710380cb9ef1bde5e4c65 (diff)
downloadredot-engine-22d83bc9f655d5ae7a1b49709c4c1b663725daf5.tar.gz
Begining of GLES3 renderer:
-Most 2D drawing is implemented -Missing shaders -Missing all 3D -Editor needs to be set on update always to be used, otherwise it does not refresh -Large parts of editor not working
Diffstat (limited to 'scene/resources/multimesh.cpp')
-rw-r--r--scene/resources/multimesh.cpp42
1 files changed, 40 insertions, 2 deletions
diff --git a/scene/resources/multimesh.cpp b/scene/resources/multimesh.cpp
index c5ade63124..0a005d8c54 100644
--- a/scene/resources/multimesh.cpp
+++ b/scene/resources/multimesh.cpp
@@ -141,7 +141,7 @@ Ref<Mesh> MultiMesh::get_mesh() const {
void MultiMesh::set_instance_count(int p_count) {
- VisualServer::get_singleton()->multimesh_set_instance_count(multimesh,p_count);
+ VisualServer::get_singleton()->multimesh_allocate(multimesh,p_count,VS::MultimeshTransformFormat(transform_format),VS::MultimeshColorFormat(color_format));
}
int MultiMesh::get_instance_count() const {
@@ -177,7 +177,7 @@ Color MultiMesh::get_instance_color(int p_instance) const {
void MultiMesh::set_aabb(const AABB& p_aabb) {
aabb=p_aabb;
- VisualServer::get_singleton()->multimesh_set_aabb(multimesh,p_aabb);
+ VisualServer::get_singleton()->multimesh_set_custom_aabb(multimesh,p_aabb);
}
@@ -220,10 +220,36 @@ RID MultiMesh::get_rid() const {
}
+
+void MultiMesh::set_color_format(ColorFormat p_color_format) {
+
+ color_format=p_color_format;
+}
+
+MultiMesh::ColorFormat MultiMesh::get_color_format() const{
+
+ return color_format;
+}
+
+void MultiMesh::set_transform_format(TransformFormat p_transform_format){
+
+ transform_format=p_transform_format;
+}
+MultiMesh::TransformFormat MultiMesh::get_transform_format() const{
+
+ return transform_format;
+}
+
+
void MultiMesh::_bind_methods() {
ObjectTypeDB::bind_method(_MD("set_mesh","mesh:Mesh"),&MultiMesh::set_mesh);
ObjectTypeDB::bind_method(_MD("get_mesh:Mesh"),&MultiMesh::get_mesh);
+ ObjectTypeDB::bind_method(_MD("set_color_format","format"),&MultiMesh::set_color_format);
+ ObjectTypeDB::bind_method(_MD("get_color_format"),&MultiMesh::get_color_format);
+ ObjectTypeDB::bind_method(_MD("set_transform_format","format"),&MultiMesh::set_transform_format);
+ ObjectTypeDB::bind_method(_MD("get_transform_format"),&MultiMesh::get_transform_format);
+
ObjectTypeDB::bind_method(_MD("set_instance_count","count"),&MultiMesh::set_instance_count);
ObjectTypeDB::bind_method(_MD("get_instance_count"),&MultiMesh::get_instance_count);
ObjectTypeDB::bind_method(_MD("set_instance_transform","instance","transform"),&MultiMesh::set_instance_transform);
@@ -241,17 +267,29 @@ void MultiMesh::_bind_methods() {
ObjectTypeDB::bind_method(_MD("_get_color_array"),&MultiMesh::_get_color_array);
+ ADD_PROPERTY(PropertyInfo(Variant::INT,"color_format",PROPERTY_HINT_ENUM,"None,Byte,Float"), _SCS("set_color_format"), _SCS("get_color_format"));
+ ADD_PROPERTY(PropertyInfo(Variant::INT,"transform_format",PROPERTY_HINT_ENUM,"None,2D,3D"), _SCS("set_transform_format"), _SCS("get_transform_format"));
ADD_PROPERTY(PropertyInfo(Variant::INT,"instance_count",PROPERTY_HINT_RANGE,"0,16384,1"), _SCS("set_instance_count"), _SCS("get_instance_count"));
ADD_PROPERTY(PropertyInfo(Variant::OBJECT,"mesh",PROPERTY_HINT_RESOURCE_TYPE,"Mesh"), _SCS("set_mesh"), _SCS("get_mesh"));
ADD_PROPERTY(PropertyInfo(Variant::_AABB,"aabb"), _SCS("set_aabb"), _SCS("get_aabb") );
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3_ARRAY,"transform_array",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR), _SCS("_set_transform_array"), _SCS("_get_transform_array"));
ADD_PROPERTY(PropertyInfo(Variant::COLOR_ARRAY,"color_array",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR), _SCS("_set_color_array"), _SCS("_get_color_array"));
+
+ BIND_CONSTANT( TRANSFORM_NONE );
+ BIND_CONSTANT( TRANSFORM_2D );
+ BIND_CONSTANT( TRANSFORM_3D );
+ BIND_CONSTANT( COLOR_NONE );
+ BIND_CONSTANT( COLOR_8BIT );
+ BIND_CONSTANT( COLOR_FLOAT );
+
}
MultiMesh::MultiMesh() {
multimesh = VisualServer::get_singleton()->multimesh_create();
+ color_format=COLOR_NONE;
+ transform_format=TRANSFORM_NONE;
}
MultiMesh::~MultiMesh() {