diff --git a/code/glTF2Asset.h b/code/glTF2Asset.h index b19de747a..a4b833f58 100644 --- a/code/glTF2Asset.h +++ b/code/glTF2Asset.h @@ -129,7 +129,6 @@ namespace glTF2 struct BufferView; // here due to cross-reference struct Texture; - struct Light; struct Skin; // Vec/matrix types, as raw float arrays @@ -835,7 +834,6 @@ namespace glTF2 Nullable scale; Ref camera; - Ref light; std::vector< Ref > skeletons; //!< The ID of skeleton nodes. Each of which is the root of a node hierarchy. Ref skin; //!< The ID of the skin referenced by this node. @@ -891,27 +889,6 @@ namespace glTF2 void Read(Value& obj, Asset& r); }; - struct Technique : public Object - { - struct Parameters - { - - }; - - struct States - { - - }; - - struct Functions - { - - }; - - Technique() {} - void Read(Value& obj, Asset& r); - }; - //! A texture and its sampler. struct Texture : public Object { diff --git a/code/glTF2Asset.inl b/code/glTF2Asset.inl index 3d53bfccf..eab0b8373 100644 --- a/code/glTF2Asset.inl +++ b/code/glTF2Asset.inl @@ -984,52 +984,6 @@ inline void Camera::Read(Value& obj, Asset& r) } } -inline void Light::Read(Value& obj, Asset& r) -{ - SetDefaults(); - - if (Value* type = FindString(obj, "type")) { - const char* t = type->GetString(); - if (strcmp(t, "ambient") == 0) this->type = Type_ambient; - else if (strcmp(t, "directional") == 0) this->type = Type_directional; - else if (strcmp(t, "point") == 0) this->type = Type_point; - else if (strcmp(t, "spot") == 0) this->type = Type_spot; - - if (this->type != Type_undefined) { - if (Value* vals = FindString(obj, t)) { - ReadMember(*vals, "color", color); - - ReadMember(*vals, "constantAttenuation", constantAttenuation); - ReadMember(*vals, "linearAttenuation", linearAttenuation); - ReadMember(*vals, "quadraticAttenuation", quadraticAttenuation); - ReadMember(*vals, "distance", distance); - - ReadMember(*vals, "falloffAngle", falloffAngle); - ReadMember(*vals, "falloffExponent", falloffExponent); - } - } - } -} - -inline void Light::SetDefaults() -{ - #ifndef M_PI - const float M_PI = 3.14159265358979323846f; - #endif - - type = Type_undefined; - - SetVector(color, 0.f, 0.f, 0.f, 1.f); - - constantAttenuation = 0.f; - linearAttenuation = 1.f; - quadraticAttenuation = 1.f; - distance = 0.f; - - falloffAngle = static_cast(M_PI / 2.f); - falloffExponent = 0.f; -} - inline void Node::Read(Value& obj, Asset& r) { diff --git a/code/glTF2AssetWriter.inl b/code/glTF2AssetWriter.inl index 33625816e..a8ee16c82 100644 --- a/code/glTF2AssetWriter.inl +++ b/code/glTF2AssetWriter.inl @@ -557,11 +557,6 @@ namespace glTF2 { } - inline void Write(Value& obj, Technique& b, AssetWriter& w) - { - - } - inline void Write(Value& obj, Texture& tex, AssetWriter& w) { if (tex.source) { @@ -572,11 +567,6 @@ namespace glTF2 { } } - inline void Write(Value& obj, Light& b, AssetWriter& w) - { - - } - inline AssetWriter::AssetWriter(Asset& a) : mDoc() diff --git a/code/glTF2Importer.cpp b/code/glTF2Importer.cpp index 316970fa5..b4fd96948 100644 --- a/code/glTF2Importer.cpp +++ b/code/glTF2Importer.cpp @@ -493,46 +493,6 @@ void glTF2Importer::ImportCameras(glTF2::Asset& r) } } -void glTF2Importer::ImportLights(glTF2::Asset& r) -{ - if (!r.lights.Size()) return; - - mScene->mNumLights = r.lights.Size(); - mScene->mLights = new aiLight*[r.lights.Size()]; - - for (size_t i = 0; i < r.lights.Size(); ++i) { - Light& l = r.lights[i]; - - aiLight* ail = mScene->mLights[i] = new aiLight(); - - switch (l.type) { - case Light::Type_directional: - ail->mType = aiLightSource_DIRECTIONAL; break; - - case Light::Type_spot: - ail->mType = aiLightSource_SPOT; break; - - case Light::Type_ambient: - ail->mType = aiLightSource_AMBIENT; break; - - default: // Light::Type_point - ail->mType = aiLightSource_POINT; break; - } - - CopyValue(l.color, ail->mColorAmbient); - CopyValue(l.color, ail->mColorDiffuse); - CopyValue(l.color, ail->mColorSpecular); - - ail->mAngleOuterCone = l.falloffAngle; - ail->mAngleInnerCone = l.falloffExponent; // TODO fix this, it does not look right at all - - ail->mAttenuationConstant = l.constantAttenuation; - ail->mAttenuationLinear = l.linearAttenuation; - ail->mAttenuationQuadratic = l.quadraticAttenuation; - } -} - - aiNode* ImportNode(aiScene* pScene, glTF2::Asset& r, std::vector& meshOffsets, glTF2::Ref& ptr) { Node& node = *ptr; @@ -602,10 +562,6 @@ aiNode* ImportNode(aiScene* pScene, glTF2::Asset& r, std::vector& pScene->mCameras[node.camera.GetIndex()]->mName = ainode->mName; } - if (node.light) { - pScene->mLights[node.light.GetIndex()]->mName = ainode->mName; - } - return ainode; } @@ -695,13 +651,14 @@ void glTF2Importer::InternReadFile(const std::string& pFile, aiScene* pScene, IO // Copy the data out // + + ImportEmbeddedTextures(asset); ImportMaterials(asset); ImportMeshes(asset); ImportCameras(asset); - ImportLights(asset); ImportNodes(asset);