mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2025-01-10 21:09:38 +01:00
Cleaned up and added GLTF helper methods to the build.
This commit is contained in:
parent
4090cb34d7
commit
435a59947a
@ -6,9 +6,11 @@ Import("env_modules")
|
||||
env_gltf = env_modules.Clone()
|
||||
|
||||
# Godot source files
|
||||
env_gltf.add_source_files(env.modules_sources, "*.cpp")
|
||||
env_gltf.add_source_files(env.modules_sources, "register_types.cpp")
|
||||
#env_gltf.add_source_files(env.modules_sources, "*.cpp")
|
||||
|
||||
env_gltf.add_source_files(env.modules_sources, "extensions/*.cpp")
|
||||
env_gltf.add_source_files(env.modules_sources, "structures/*.cpp")
|
||||
|
||||
if env["tools"]:
|
||||
env_gltf.add_source_files(env.modules_sources, "editor/*.cpp")
|
||||
#if env["tools"]:
|
||||
# env_gltf.add_source_files(env.modules_sources, "editor/*.cpp")
|
||||
|
@ -45,11 +45,11 @@ void GLTFLight::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_outer_cone_angle", "outer_cone_angle"), &GLTFLight::set_outer_cone_angle);
|
||||
|
||||
ADD_PROPERTY(PropertyInfo(Variant::COLOR, "color"), "set_color", "get_color"); // Color
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "intensity"), "set_intensity", "get_intensity"); // float
|
||||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "intensity"), "set_intensity", "get_intensity"); // float
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "light_type"), "set_light_type", "get_light_type"); // String
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "range"), "set_range", "get_range"); // float
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "inner_cone_angle"), "set_inner_cone_angle", "get_inner_cone_angle"); // float
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "outer_cone_angle"), "set_outer_cone_angle", "get_outer_cone_angle"); // float
|
||||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "range"), "set_range", "get_range"); // float
|
||||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "inner_cone_angle"), "set_inner_cone_angle", "get_inner_cone_angle"); // float
|
||||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "outer_cone_angle"), "set_outer_cone_angle", "get_outer_cone_angle"); // float
|
||||
}
|
||||
|
||||
Color GLTFLight::get_color() {
|
||||
|
@ -31,9 +31,9 @@
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#include "core/hash_set.h"
|
||||
#include "core/array.h"
|
||||
#include "core/dictionary.h"
|
||||
#include "core/hash_set.h"
|
||||
|
||||
namespace GLTFTemplateConvert {
|
||||
template <class T>
|
||||
@ -75,8 +75,9 @@ static void set_from_array(HashSet<T> &r_out, const Array &p_inp) {
|
||||
template <class K, class V>
|
||||
static Dictionary to_dict(const HashMap<K, V> &p_inp) {
|
||||
Dictionary ret;
|
||||
for (const KeyValue<K, V> &E : p_inp) {
|
||||
ret[E.key] = E.value;
|
||||
const K *key = NULL;
|
||||
while ((key = p_inp.next(key))) {
|
||||
ret[*key] = p_inp[*key];
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
@ -32,20 +32,6 @@
|
||||
|
||||
#ifndef _3D_DISABLED
|
||||
|
||||
void register_gltf_types() {
|
||||
|
||||
}
|
||||
void unregister_gltf_types() {
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
#include "extensions/gltf_light.h"
|
||||
#include "extensions/gltf_spec_gloss.h"
|
||||
#include "gltf_document.h"
|
||||
#include "gltf_document_extension.h"
|
||||
#include "gltf_document_extension_convert_importer_mesh.h"
|
||||
#include "gltf_state.h"
|
||||
#include "structures/gltf_accessor.h"
|
||||
#include "structures/gltf_animation.h"
|
||||
#include "structures/gltf_buffer_view.h"
|
||||
@ -56,6 +42,40 @@ void unregister_gltf_types() {
|
||||
#include "structures/gltf_skin.h"
|
||||
#include "structures/gltf_texture.h"
|
||||
|
||||
#include "extensions/gltf_light.h"
|
||||
#include "extensions/gltf_spec_gloss.h"
|
||||
|
||||
void register_gltf_types() {
|
||||
ClassDB::register_class<GLTFAccessor>();
|
||||
ClassDB::register_class<GLTFAnimation>();
|
||||
ClassDB::register_class<GLTFBufferView>();
|
||||
ClassDB::register_class<GLTFCamera>();
|
||||
ClassDB::register_class<GLTFMesh>();
|
||||
ClassDB::register_class<GLTFNode>();
|
||||
ClassDB::register_class<GLTFSkeleton>();
|
||||
ClassDB::register_class<GLTFSkin>();
|
||||
ClassDB::register_class<GLTFTexture>();
|
||||
|
||||
ClassDB::register_class<GLTFSpecGloss>();
|
||||
ClassDB::register_class<GLTFLight>();
|
||||
|
||||
//ClassDB::register_class<GLTFDocument>();
|
||||
//ClassDB::register_class<GLTFDocumentExtension>();
|
||||
//ClassDB::register_class<GLTFDocumentExtensionConvertImporterMesh>();
|
||||
//ClassDB::register_class<GLTFState>();
|
||||
}
|
||||
void unregister_gltf_types() {
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
#include "gltf_document.h"
|
||||
#include "gltf_document_extension.h"
|
||||
#include "gltf_document_extension_convert_importer_mesh.h"
|
||||
#include "gltf_state.h"
|
||||
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
#include "core/project_settings.h"
|
||||
#include "editor/editor_node.h"
|
||||
|
@ -124,19 +124,19 @@ void GLTFAccessor::set_type(int p_type) {
|
||||
type = (GLTFType)p_type; // TODO: Register enum
|
||||
}
|
||||
|
||||
Vector<double> GLTFAccessor::get_min() {
|
||||
PoolRealArray GLTFAccessor::get_min() {
|
||||
return min;
|
||||
}
|
||||
|
||||
void GLTFAccessor::set_min(Vector<double> p_min) {
|
||||
void GLTFAccessor::set_min(const PoolRealArray &p_min) {
|
||||
min = p_min;
|
||||
}
|
||||
|
||||
Vector<double> GLTFAccessor::get_max() {
|
||||
PoolRealArray GLTFAccessor::get_max() {
|
||||
return max;
|
||||
}
|
||||
|
||||
void GLTFAccessor::set_max(Vector<double> p_max) {
|
||||
void GLTFAccessor::set_max(const PoolRealArray &p_max) {
|
||||
max = p_max;
|
||||
}
|
||||
|
||||
|
@ -46,8 +46,8 @@ private:
|
||||
bool normalized = false;
|
||||
int count = 0;
|
||||
GLTFType type = GLTFType::TYPE_SCALAR;
|
||||
Vector<double> min;
|
||||
Vector<double> max;
|
||||
PoolRealArray min;
|
||||
PoolRealArray max;
|
||||
int sparse_count = 0;
|
||||
int sparse_indices_buffer_view = 0;
|
||||
int sparse_indices_byte_offset = 0;
|
||||
@ -77,11 +77,11 @@ public:
|
||||
int get_type();
|
||||
void set_type(int p_type);
|
||||
|
||||
Vector<double> get_min();
|
||||
void set_min(Vector<double> p_min);
|
||||
PoolRealArray get_min();
|
||||
void set_min(const PoolRealArray &p_min);
|
||||
|
||||
Vector<double> get_max();
|
||||
void set_max(Vector<double> p_max);
|
||||
PoolRealArray get_max();
|
||||
void set_max(const PoolRealArray &p_max);
|
||||
|
||||
int get_sparse_count();
|
||||
void set_sparse_count(int p_sparse_count);
|
||||
|
@ -30,8 +30,6 @@
|
||||
|
||||
#include "gltf_buffer_view.h"
|
||||
|
||||
#include "../gltf_document_extension.h"
|
||||
|
||||
void GLTFBufferView::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_buffer"), &GLTFBufferView::get_buffer);
|
||||
ClassDB::bind_method(D_METHOD("set_buffer", "buffer"), &GLTFBufferView::set_buffer);
|
||||
|
@ -41,7 +41,7 @@ void GLTFMesh::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_instance_materials", "instance_materials"), &GLTFMesh::set_instance_materials);
|
||||
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "mesh"), "set_mesh", "get_mesh");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::PACKED_FLOAT32_ARRAY, "blend_weights"), "set_blend_weights", "get_blend_weights"); // Vector<float>
|
||||
ADD_PROPERTY(PropertyInfo(Variant::POOL_REAL_ARRAY, "blend_weights"), "set_blend_weights", "get_blend_weights"); // Vector<float>
|
||||
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "instance_materials"), "set_instance_materials", "get_instance_materials");
|
||||
}
|
||||
|
||||
|
@ -33,6 +33,7 @@
|
||||
|
||||
#include "../gltf_defines.h"
|
||||
#include "core/resource.h"
|
||||
#include "core/hash_set.h"
|
||||
|
||||
class GLTFSkeleton : public Resource {
|
||||
GDCLASS(GLTFSkeleton, Resource);
|
||||
|
@ -133,10 +133,10 @@ void GLTFSkin::set_joint_i_to_bone_i(Dictionary p_joint_i_to_bone_i) {
|
||||
|
||||
Dictionary GLTFSkin::get_joint_i_to_name() {
|
||||
Dictionary ret;
|
||||
HashMap<int, StringName>::Iterator elem = joint_i_to_name.begin();
|
||||
while (elem) {
|
||||
ret[elem->key] = String(elem->value);
|
||||
++elem;
|
||||
|
||||
const int *key = NULL;
|
||||
while ((key = joint_i_to_name.next(key))) {
|
||||
ret[*key] = String(joint_i_to_name[*key]);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user