Animation system in progress
--HG-- extra : convert_revision : svn%3A7752d6cf-9f14-4ad2-affc-04f1e67b81a5/trunk%40173
This commit is contained in:
@@ -33,6 +33,14 @@
|
|||||||
E428C312166971FF00A16EDF /* KRAnimationLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = E428C30F166971FE00A16EDF /* KRAnimationLayer.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
E428C312166971FF00A16EDF /* KRAnimationLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = E428C30F166971FE00A16EDF /* KRAnimationLayer.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||||
E428C313166971FF00A16EDF /* KRAnimationLayer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E428C310166971FE00A16EDF /* KRAnimationLayer.cpp */; };
|
E428C313166971FF00A16EDF /* KRAnimationLayer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E428C310166971FE00A16EDF /* KRAnimationLayer.cpp */; };
|
||||||
E428C314166971FF00A16EDF /* KRAnimationLayer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E428C310166971FE00A16EDF /* KRAnimationLayer.cpp */; };
|
E428C314166971FF00A16EDF /* KRAnimationLayer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E428C310166971FE00A16EDF /* KRAnimationLayer.cpp */; };
|
||||||
|
E428C3161669A24B00A16EDF /* KRAnimationAttribute.h in Headers */ = {isa = PBXBuildFile; fileRef = E428C3151669A24B00A16EDF /* KRAnimationAttribute.h */; };
|
||||||
|
E428C3171669A24B00A16EDF /* KRAnimationAttribute.h in Headers */ = {isa = PBXBuildFile; fileRef = E428C3151669A24B00A16EDF /* KRAnimationAttribute.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||||
|
E428C3191669A25D00A16EDF /* KRAnimationAttribute.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E428C3181669A25D00A16EDF /* KRAnimationAttribute.cpp */; };
|
||||||
|
E428C31A1669A25D00A16EDF /* KRAnimationAttribute.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E428C3181669A25D00A16EDF /* KRAnimationAttribute.cpp */; };
|
||||||
|
E428C31C1669A77D00A16EDF /* KRAnimationCurveKey.h in Headers */ = {isa = PBXBuildFile; fileRef = E428C31B1669A77D00A16EDF /* KRAnimationCurveKey.h */; };
|
||||||
|
E428C31D1669A77D00A16EDF /* KRAnimationCurveKey.h in Headers */ = {isa = PBXBuildFile; fileRef = E428C31B1669A77D00A16EDF /* KRAnimationCurveKey.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||||
|
E428C31F1669A78D00A16EDF /* KRAnimationCurveKey.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E428C31E1669A78C00A16EDF /* KRAnimationCurveKey.cpp */; };
|
||||||
|
E428C3201669A78D00A16EDF /* KRAnimationCurveKey.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E428C31E1669A78C00A16EDF /* KRAnimationCurveKey.cpp */; };
|
||||||
E42CB1EC158446940066E0D8 /* KRQuaternion.h in Headers */ = {isa = PBXBuildFile; fileRef = E42CB1EB158446940066E0D8 /* KRQuaternion.h */; };
|
E42CB1EC158446940066E0D8 /* KRQuaternion.h in Headers */ = {isa = PBXBuildFile; fileRef = E42CB1EB158446940066E0D8 /* KRQuaternion.h */; };
|
||||||
E42CB1ED158446940066E0D8 /* KRQuaternion.h in Headers */ = {isa = PBXBuildFile; fileRef = E42CB1EB158446940066E0D8 /* KRQuaternion.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
E42CB1ED158446940066E0D8 /* KRQuaternion.h in Headers */ = {isa = PBXBuildFile; fileRef = E42CB1EB158446940066E0D8 /* KRQuaternion.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||||
E42CB1F0158446AB0066E0D8 /* KRQuaternion.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E42CB1EF158446AB0066E0D8 /* KRQuaternion.cpp */; };
|
E42CB1F0158446AB0066E0D8 /* KRQuaternion.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E42CB1EF158446AB0066E0D8 /* KRQuaternion.cpp */; };
|
||||||
@@ -238,6 +246,10 @@
|
|||||||
E428C3061669628A00A16EDF /* KRAnimationCurve.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = KRAnimationCurve.cpp; path = Classes/KRAnimationCurve.cpp; sourceTree = "<group>"; };
|
E428C3061669628A00A16EDF /* KRAnimationCurve.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = KRAnimationCurve.cpp; path = Classes/KRAnimationCurve.cpp; sourceTree = "<group>"; };
|
||||||
E428C30F166971FE00A16EDF /* KRAnimationLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = KRAnimationLayer.h; path = Classes/KRAnimationLayer.h; sourceTree = "<group>"; };
|
E428C30F166971FE00A16EDF /* KRAnimationLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = KRAnimationLayer.h; path = Classes/KRAnimationLayer.h; sourceTree = "<group>"; };
|
||||||
E428C310166971FE00A16EDF /* KRAnimationLayer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = KRAnimationLayer.cpp; path = Classes/KRAnimationLayer.cpp; sourceTree = "<group>"; };
|
E428C310166971FE00A16EDF /* KRAnimationLayer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = KRAnimationLayer.cpp; path = Classes/KRAnimationLayer.cpp; sourceTree = "<group>"; };
|
||||||
|
E428C3151669A24B00A16EDF /* KRAnimationAttribute.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = KRAnimationAttribute.h; path = Classes/KRAnimationAttribute.h; sourceTree = "<group>"; };
|
||||||
|
E428C3181669A25D00A16EDF /* KRAnimationAttribute.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = KRAnimationAttribute.cpp; path = Classes/KRAnimationAttribute.cpp; sourceTree = "<group>"; };
|
||||||
|
E428C31B1669A77D00A16EDF /* KRAnimationCurveKey.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = KRAnimationCurveKey.h; path = Classes/KRAnimationCurveKey.h; sourceTree = "<group>"; };
|
||||||
|
E428C31E1669A78C00A16EDF /* KRAnimationCurveKey.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = KRAnimationCurveKey.cpp; path = Classes/KRAnimationCurveKey.cpp; sourceTree = "<group>"; };
|
||||||
E42CB1EB158446940066E0D8 /* KRQuaternion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = KRQuaternion.h; path = Classes/KRQuaternion.h; sourceTree = "<group>"; };
|
E42CB1EB158446940066E0D8 /* KRQuaternion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = KRQuaternion.h; path = Classes/KRQuaternion.h; sourceTree = "<group>"; };
|
||||||
E42CB1EF158446AB0066E0D8 /* KRQuaternion.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = KRQuaternion.cpp; path = Classes/KRQuaternion.cpp; sourceTree = "<group>"; };
|
E42CB1EF158446AB0066E0D8 /* KRQuaternion.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = KRQuaternion.cpp; path = Classes/KRQuaternion.cpp; sourceTree = "<group>"; };
|
||||||
E430D08015F8882F0010558D /* occlusion_test.fsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; name = occlusion_test.fsh; path = Shaders/occlusion_test.fsh; sourceTree = "<group>"; };
|
E430D08015F8882F0010558D /* occlusion_test.fsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; name = occlusion_test.fsh; path = Shaders/occlusion_test.fsh; sourceTree = "<group>"; };
|
||||||
@@ -412,6 +424,10 @@
|
|||||||
E428C2FA1669613200A16EDF /* KRAnimation.cpp */,
|
E428C2FA1669613200A16EDF /* KRAnimation.cpp */,
|
||||||
E428C3031669627900A16EDF /* KRAnimationCurve.h */,
|
E428C3031669627900A16EDF /* KRAnimationCurve.h */,
|
||||||
E428C3061669628A00A16EDF /* KRAnimationCurve.cpp */,
|
E428C3061669628A00A16EDF /* KRAnimationCurve.cpp */,
|
||||||
|
E428C3151669A24B00A16EDF /* KRAnimationAttribute.h */,
|
||||||
|
E428C3181669A25D00A16EDF /* KRAnimationAttribute.cpp */,
|
||||||
|
E428C31B1669A77D00A16EDF /* KRAnimationCurveKey.h */,
|
||||||
|
E428C31E1669A78C00A16EDF /* KRAnimationCurveKey.cpp */,
|
||||||
);
|
);
|
||||||
name = Animation;
|
name = Animation;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@@ -806,6 +822,8 @@
|
|||||||
E428C2F81669612500A16EDF /* KRAnimation.h in Headers */,
|
E428C2F81669612500A16EDF /* KRAnimation.h in Headers */,
|
||||||
E428C3041669627900A16EDF /* KRAnimationCurve.h in Headers */,
|
E428C3041669627900A16EDF /* KRAnimationCurve.h in Headers */,
|
||||||
E428C311166971FF00A16EDF /* KRAnimationLayer.h in Headers */,
|
E428C311166971FF00A16EDF /* KRAnimationLayer.h in Headers */,
|
||||||
|
E428C3161669A24B00A16EDF /* KRAnimationAttribute.h in Headers */,
|
||||||
|
E428C31C1669A77D00A16EDF /* KRAnimationCurveKey.h in Headers */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
@@ -849,7 +867,9 @@
|
|||||||
E40BA45715EFF79500D7C3DD /* KRAABB.h in Headers */,
|
E40BA45715EFF79500D7C3DD /* KRAABB.h in Headers */,
|
||||||
E428C312166971FF00A16EDF /* KRAnimationLayer.h in Headers */,
|
E428C312166971FF00A16EDF /* KRAnimationLayer.h in Headers */,
|
||||||
E4AFC6B615F7C46800DDB4C8 /* KRAABB.cpp in Headers */,
|
E4AFC6B615F7C46800DDB4C8 /* KRAABB.cpp in Headers */,
|
||||||
|
E428C3171669A24B00A16EDF /* KRAnimationAttribute.h in Headers */,
|
||||||
E4AFC6BE15F7C9E600DDB4C8 /* KROctreeNode.h in Headers */,
|
E4AFC6BE15F7C9E600DDB4C8 /* KROctreeNode.h in Headers */,
|
||||||
|
E428C31D1669A77D00A16EDF /* KRAnimationCurveKey.h in Headers */,
|
||||||
E4AFC6BD15F7C9DA00DDB4C8 /* KROctree.h in Headers */,
|
E4AFC6BD15F7C9DA00DDB4C8 /* KROctree.h in Headers */,
|
||||||
E46A6B701559EF0A000DBD37 /* KRResource+blend.h in Headers */,
|
E46A6B701559EF0A000DBD37 /* KRResource+blend.h in Headers */,
|
||||||
E42CB1ED158446940066E0D8 /* KRQuaternion.h in Headers */,
|
E42CB1ED158446940066E0D8 /* KRQuaternion.h in Headers */,
|
||||||
@@ -994,6 +1014,8 @@
|
|||||||
E428C2FB1669613200A16EDF /* KRAnimation.cpp in Sources */,
|
E428C2FB1669613200A16EDF /* KRAnimation.cpp in Sources */,
|
||||||
E428C3071669628A00A16EDF /* KRAnimationCurve.cpp in Sources */,
|
E428C3071669628A00A16EDF /* KRAnimationCurve.cpp in Sources */,
|
||||||
E428C313166971FF00A16EDF /* KRAnimationLayer.cpp in Sources */,
|
E428C313166971FF00A16EDF /* KRAnimationLayer.cpp in Sources */,
|
||||||
|
E428C3191669A25D00A16EDF /* KRAnimationAttribute.cpp in Sources */,
|
||||||
|
E428C31F1669A78D00A16EDF /* KRAnimationCurveKey.cpp in Sources */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
@@ -1048,6 +1070,8 @@
|
|||||||
E428C2FC1669613200A16EDF /* KRAnimation.cpp in Sources */,
|
E428C2FC1669613200A16EDF /* KRAnimation.cpp in Sources */,
|
||||||
E428C3081669628A00A16EDF /* KRAnimationCurve.cpp in Sources */,
|
E428C3081669628A00A16EDF /* KRAnimationCurve.cpp in Sources */,
|
||||||
E428C314166971FF00A16EDF /* KRAnimationLayer.cpp in Sources */,
|
E428C314166971FF00A16EDF /* KRAnimationLayer.cpp in Sources */,
|
||||||
|
E428C31A1669A25D00A16EDF /* KRAnimationAttribute.cpp in Sources */,
|
||||||
|
E428C3201669A78D00A16EDF /* KRAnimationCurveKey.cpp in Sources */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -2,8 +2,31 @@
|
|||||||
// KRAnimation.cpp
|
// KRAnimation.cpp
|
||||||
// KREngine
|
// KREngine
|
||||||
//
|
//
|
||||||
// Created by Kearwood Gilbert on 2012-11-30.
|
// Copyright 2012 Kearwood Gilbert. All rights reserved.
|
||||||
// Copyright (c) 2012 Kearwood Software. All rights reserved.
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without modification, are
|
||||||
|
// permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
// 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||||
|
// conditions and the following disclaimer.
|
||||||
|
//
|
||||||
|
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
// of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
// provided with the distribution.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY KEARWOOD GILBERT ''AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL KEARWOOD GILBERT OR
|
||||||
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
|
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
|
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
|
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
//
|
||||||
|
// The views and conclusions contained in the software and documentation are those of the
|
||||||
|
// authors and should not be interpreted as representing official policies, either expressed
|
||||||
|
// or implied, of Kearwood Gilbert.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "KRAnimation.h"
|
#include "KRAnimation.h"
|
||||||
@@ -33,7 +56,6 @@ bool KRAnimation::save(const std::string& path) {
|
|||||||
tinyxml2::XMLDocument doc;
|
tinyxml2::XMLDocument doc;
|
||||||
tinyxml2::XMLElement *animation_node = doc.NewElement( "animation" );
|
tinyxml2::XMLElement *animation_node = doc.NewElement( "animation" );
|
||||||
doc.InsertEndChild(animation_node);
|
doc.InsertEndChild(animation_node);
|
||||||
// m_pRootNode->saveXML(animation_node);
|
|
||||||
|
|
||||||
for(std::map<std::string, KRAnimationLayer *>::iterator itr = m_layers.begin(); itr != m_layers.end(); ++itr){
|
for(std::map<std::string, KRAnimationLayer *>::iterator itr = m_layers.begin(); itr != m_layers.end(); ++itr){
|
||||||
(*itr).second->saveXML(animation_node);
|
(*itr).second->saveXML(animation_node);
|
||||||
@@ -56,6 +78,7 @@ KRAnimation *KRAnimation::Load(KRContext &context, const std::string &name, KRDa
|
|||||||
for(tinyxml2::XMLElement *child_element=animation_node->FirstChildElement(); child_element != NULL; child_element = child_element->NextSiblingElement()) {
|
for(tinyxml2::XMLElement *child_element=animation_node->FirstChildElement(); child_element != NULL; child_element = child_element->NextSiblingElement()) {
|
||||||
if(strcmp(child_element->Name(), "layer") == 0) {
|
if(strcmp(child_element->Name(), "layer") == 0) {
|
||||||
KRAnimationLayer *new_layer = new KRAnimationLayer(context);
|
KRAnimationLayer *new_layer = new KRAnimationLayer(context);
|
||||||
|
new_layer->loadXML(child_element);
|
||||||
new_animation->m_layers[new_layer->getName()] = new_layer;
|
new_animation->m_layers[new_layer->getName()] = new_layer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,8 +2,31 @@
|
|||||||
// KRAnimation.h
|
// KRAnimation.h
|
||||||
// KREngine
|
// KREngine
|
||||||
//
|
//
|
||||||
// Created by Kearwood Gilbert on 2012-11-30.
|
// Copyright 2012 Kearwood Gilbert. All rights reserved.
|
||||||
// Copyright (c) 2012 Kearwood Software. All rights reserved.
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without modification, are
|
||||||
|
// permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
// 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||||
|
// conditions and the following disclaimer.
|
||||||
|
//
|
||||||
|
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
// of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
// provided with the distribution.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY KEARWOOD GILBERT ''AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL KEARWOOD GILBERT OR
|
||||||
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
|
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
|
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
|
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
//
|
||||||
|
// The views and conclusions contained in the software and documentation are those of the
|
||||||
|
// authors and should not be interpreted as representing official policies, either expressed
|
||||||
|
// or implied, of Kearwood Gilbert.
|
||||||
//
|
//
|
||||||
|
|
||||||
#ifndef KRANIMATION_H
|
#ifndef KRANIMATION_H
|
||||||
|
|||||||
56
KREngine/KREngine/Classes/KRAnimationAttribute.cpp
Normal file
56
KREngine/KREngine/Classes/KRAnimationAttribute.cpp
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
//
|
||||||
|
// KRAnimationAttribute.cpp
|
||||||
|
// KREngine
|
||||||
|
//
|
||||||
|
// Copyright 2012 Kearwood Gilbert. All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without modification, are
|
||||||
|
// permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
// 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||||
|
// conditions and the following disclaimer.
|
||||||
|
//
|
||||||
|
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
// of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
// provided with the distribution.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY KEARWOOD GILBERT ''AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL KEARWOOD GILBERT OR
|
||||||
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
|
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
|
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
|
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
//
|
||||||
|
// The views and conclusions contained in the software and documentation are those of the
|
||||||
|
// authors and should not be interpreted as representing official policies, either expressed
|
||||||
|
// or implied, of Kearwood Gilbert.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "KRAnimationAttribute.h"
|
||||||
|
|
||||||
|
|
||||||
|
KRAnimationAttribute::KRAnimationAttribute(KRContext &context) : KRContextObject(context)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
KRAnimationAttribute::~KRAnimationAttribute()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
tinyxml2::XMLElement *KRAnimationAttribute::saveXML( tinyxml2::XMLNode *parent)
|
||||||
|
{
|
||||||
|
tinyxml2::XMLDocument *doc = parent->GetDocument();
|
||||||
|
tinyxml2::XMLElement *e = doc->NewElement("attribute");
|
||||||
|
tinyxml2::XMLNode *n = parent->InsertEndChild(e);
|
||||||
|
|
||||||
|
return e;
|
||||||
|
}
|
||||||
|
|
||||||
|
void KRAnimationAttribute::loadXML(tinyxml2::XMLElement *e)
|
||||||
|
{
|
||||||
|
}
|
||||||
54
KREngine/KREngine/Classes/KRAnimationAttribute.h
Normal file
54
KREngine/KREngine/Classes/KRAnimationAttribute.h
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
//
|
||||||
|
// KRAnimationAttribute.h
|
||||||
|
// KREngine
|
||||||
|
//
|
||||||
|
// Copyright 2012 Kearwood Gilbert. All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without modification, are
|
||||||
|
// permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
// 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||||
|
// conditions and the following disclaimer.
|
||||||
|
//
|
||||||
|
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
// of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
// provided with the distribution.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY KEARWOOD GILBERT ''AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL KEARWOOD GILBERT OR
|
||||||
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
|
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
|
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
|
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
//
|
||||||
|
// The views and conclusions contained in the software and documentation are those of the
|
||||||
|
// authors and should not be interpreted as representing official policies, either expressed
|
||||||
|
// or implied, of Kearwood Gilbert.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef KRANIMATIONATTRIBUTE_H
|
||||||
|
#define KRANIMATIONATTRIBUTE_H
|
||||||
|
|
||||||
|
#import "KRContextObject.h"
|
||||||
|
#import "KREngine-common.h"
|
||||||
|
#import "tinyxml2.h"
|
||||||
|
|
||||||
|
class KRAnimationAttribute : public KRContextObject {
|
||||||
|
public:
|
||||||
|
KRAnimationAttribute(KRContext &context);
|
||||||
|
~KRAnimationAttribute();
|
||||||
|
|
||||||
|
tinyxml2::XMLElement *saveXML( tinyxml2::XMLNode *parent);
|
||||||
|
void loadXML(tinyxml2::XMLElement *e);
|
||||||
|
|
||||||
|
std::string getTargetName() const;
|
||||||
|
void setTargetName(const std::string &target_name);
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::string m_target_name;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -2,8 +2,31 @@
|
|||||||
// KRAnimationCurve.cpp
|
// KRAnimationCurve.cpp
|
||||||
// KREngine
|
// KREngine
|
||||||
//
|
//
|
||||||
// Created by Kearwood Gilbert on 2012-11-30.
|
// Copyright 2012 Kearwood Gilbert. All rights reserved.
|
||||||
// Copyright (c) 2012 Kearwood Software. All rights reserved.
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without modification, are
|
||||||
|
// permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
// 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||||
|
// conditions and the following disclaimer.
|
||||||
|
//
|
||||||
|
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
// of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
// provided with the distribution.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY KEARWOOD GILBERT ''AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL KEARWOOD GILBERT OR
|
||||||
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
|
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
|
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
|
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
//
|
||||||
|
// The views and conclusions contained in the software and documentation are those of the
|
||||||
|
// authors and should not be interpreted as representing official policies, either expressed
|
||||||
|
// or implied, of Kearwood Gilbert.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "KRAnimationCurve.h"
|
#include "KRAnimationCurve.h"
|
||||||
|
|||||||
@@ -2,8 +2,31 @@
|
|||||||
// KRAnimationCurve.h
|
// KRAnimationCurve.h
|
||||||
// KREngine
|
// KREngine
|
||||||
//
|
//
|
||||||
// Created by Kearwood Gilbert on 2012-11-30.
|
// Copyright 2012 Kearwood Gilbert. All rights reserved.
|
||||||
// Copyright (c) 2012 Kearwood Software. All rights reserved.
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without modification, are
|
||||||
|
// permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
// 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||||
|
// conditions and the following disclaimer.
|
||||||
|
//
|
||||||
|
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
// of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
// provided with the distribution.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY KEARWOOD GILBERT ''AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL KEARWOOD GILBERT OR
|
||||||
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
|
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
|
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
|
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
//
|
||||||
|
// The views and conclusions contained in the software and documentation are those of the
|
||||||
|
// authors and should not be interpreted as representing official policies, either expressed
|
||||||
|
// or implied, of Kearwood Gilbert.
|
||||||
//
|
//
|
||||||
|
|
||||||
#ifndef KRANIMATIONCURVE_H
|
#ifndef KRANIMATIONCURVE_H
|
||||||
|
|||||||
32
KREngine/KREngine/Classes/KRAnimationCurveKey.cpp
Normal file
32
KREngine/KREngine/Classes/KRAnimationCurveKey.cpp
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
//
|
||||||
|
// KRAnimationCurveKey.cpp
|
||||||
|
// KREngine
|
||||||
|
//
|
||||||
|
// Copyright 2012 Kearwood Gilbert. All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without modification, are
|
||||||
|
// permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
// 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||||
|
// conditions and the following disclaimer.
|
||||||
|
//
|
||||||
|
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
// of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
// provided with the distribution.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY KEARWOOD GILBERT ''AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL KEARWOOD GILBERT OR
|
||||||
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
|
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
|
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
|
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
//
|
||||||
|
// The views and conclusions contained in the software and documentation are those of the
|
||||||
|
// authors and should not be interpreted as representing official policies, either expressed
|
||||||
|
// or implied, of Kearwood Gilbert.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "KRAnimationCurveKey.h"
|
||||||
37
KREngine/KREngine/Classes/KRAnimationCurveKey.h
Normal file
37
KREngine/KREngine/Classes/KRAnimationCurveKey.h
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
//
|
||||||
|
// KRAnimationCurveKey.h
|
||||||
|
// KREngine
|
||||||
|
//
|
||||||
|
// Copyright 2012 Kearwood Gilbert. All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without modification, are
|
||||||
|
// permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
// 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||||
|
// conditions and the following disclaimer.
|
||||||
|
//
|
||||||
|
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
// of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
// provided with the distribution.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY KEARWOOD GILBERT ''AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL KEARWOOD GILBERT OR
|
||||||
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
|
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
|
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
|
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
//
|
||||||
|
// The views and conclusions contained in the software and documentation are those of the
|
||||||
|
// authors and should not be interpreted as representing official policies, either expressed
|
||||||
|
// or implied, of Kearwood Gilbert.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef KRANIMATIONCURVEKEY_H
|
||||||
|
#define KRANIMATIONCURVEKEY_H
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -2,8 +2,31 @@
|
|||||||
// KRAnimationLayer.cpp
|
// KRAnimationLayer.cpp
|
||||||
// KREngine
|
// KREngine
|
||||||
//
|
//
|
||||||
// Created by Kearwood Gilbert on 2012-11-30.
|
// Copyright 2012 Kearwood Gilbert. All rights reserved.
|
||||||
// Copyright (c) 2012 Kearwood Software. All rights reserved.
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without modification, are
|
||||||
|
// permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
// 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||||
|
// conditions and the following disclaimer.
|
||||||
|
//
|
||||||
|
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
// of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
// provided with the distribution.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY KEARWOOD GILBERT ''AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL KEARWOOD GILBERT OR
|
||||||
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
|
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
|
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
|
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
//
|
||||||
|
// The views and conclusions contained in the software and documentation are those of the
|
||||||
|
// authors and should not be interpreted as representing official policies, either expressed
|
||||||
|
// or implied, of Kearwood Gilbert.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "KRAnimationLayer.h"
|
#include "KRAnimationLayer.h"
|
||||||
@@ -13,12 +36,14 @@ KRAnimationLayer::KRAnimationLayer(KRContext &context) : KRContextObject(context
|
|||||||
m_name = "";
|
m_name = "";
|
||||||
m_blend_mode = KRENGINE_ANIMATION_BLEND_MODE_ADDITIVE;
|
m_blend_mode = KRENGINE_ANIMATION_BLEND_MODE_ADDITIVE;
|
||||||
m_rotation_accumulation_mode = KRENGINE_ANIMATION_ROTATION_ACCUMULATION_BY_LAYER;
|
m_rotation_accumulation_mode = KRENGINE_ANIMATION_ROTATION_ACCUMULATION_BY_LAYER;
|
||||||
m_scale_accumulation_mode = KRENGINE_ANIMATION_SCALE_ACCUMULATION_ADDITIVE;
|
m_scale_accumulation_mode = KRENGINE_ANIMATION_SCALE_ACCUMULATION_MULTIPLY;
|
||||||
}
|
}
|
||||||
|
|
||||||
KRAnimationLayer::~KRAnimationLayer()
|
KRAnimationLayer::~KRAnimationLayer()
|
||||||
{
|
{
|
||||||
|
for(std::vector<KRAnimationAttribute *>::iterator itr = m_attributes.begin(); itr != m_attributes.end(); ++itr){
|
||||||
|
delete (*itr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string KRAnimationLayer::getName() const
|
std::string KRAnimationLayer::getName() const
|
||||||
@@ -69,15 +94,17 @@ tinyxml2::XMLElement *KRAnimationLayer::saveXML( tinyxml2::XMLNode *parent)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for(std::vector<KRAnimationAttribute *>::iterator itr = m_attributes.begin(); itr != m_attributes.end(); ++itr){
|
||||||
|
(*itr)->saveXML(n);
|
||||||
|
}
|
||||||
|
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
|
|
||||||
void KRAnimationLayer::loadXML(tinyxml2::XMLElement *e)
|
void KRAnimationLayer::loadXML(tinyxml2::XMLElement *e)
|
||||||
{
|
{
|
||||||
m_name = e->Attribute("name");
|
m_name = e->Attribute("name");
|
||||||
if(e->QueryFloatAttribute("weight", &m_weight) == tinyxml2::XML_SUCCESS) {
|
if(e->QueryFloatAttribute("weight", &m_weight) != tinyxml2::XML_SUCCESS) {
|
||||||
m_weight /= 100.0f;
|
|
||||||
} else {
|
|
||||||
m_weight = 1.0f; // default
|
m_weight = 1.0f; // default
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,7 +134,15 @@ void KRAnimationLayer::loadXML(tinyxml2::XMLElement *e)
|
|||||||
} else if(strcmp(szScaleAccumulationMode, "multiply") == 0) {
|
} else if(strcmp(szScaleAccumulationMode, "multiply") == 0) {
|
||||||
m_scale_accumulation_mode = KRENGINE_ANIMATION_SCALE_ACCUMULATION_MULTIPLY;
|
m_scale_accumulation_mode = KRENGINE_ANIMATION_SCALE_ACCUMULATION_MULTIPLY;
|
||||||
} else {
|
} else {
|
||||||
m_scale_accumulation_mode = KRENGINE_ANIMATION_SCALE_ACCUMULATION_ADDITIVE; // default
|
m_scale_accumulation_mode = KRENGINE_ANIMATION_SCALE_ACCUMULATION_MULTIPLY; // default
|
||||||
|
}
|
||||||
|
|
||||||
|
for(tinyxml2::XMLElement *child_element=e->FirstChildElement(); child_element != NULL; child_element = child_element->NextSiblingElement()) {
|
||||||
|
if(strcmp(child_element->Name(), "attribute") == 0) {
|
||||||
|
KRAnimationAttribute *new_attribute = new KRAnimationAttribute(getContext());
|
||||||
|
new_attribute->loadXML(child_element);
|
||||||
|
m_attributes.push_back(new_attribute);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -152,3 +187,7 @@ void KRAnimationLayer::setScaleAccumulationMode(const KRAnimationLayer::scale_ac
|
|||||||
m_scale_accumulation_mode = scale_accumulation_mode;
|
m_scale_accumulation_mode = scale_accumulation_mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void KRAnimationLayer::addAttribute(KRAnimationAttribute *attribute)
|
||||||
|
{
|
||||||
|
m_attributes.push_back(attribute);
|
||||||
|
}
|
||||||
|
|||||||
@@ -2,8 +2,31 @@
|
|||||||
// KRAnimationLayer.h
|
// KRAnimationLayer.h
|
||||||
// KREngine
|
// KREngine
|
||||||
//
|
//
|
||||||
// Created by Kearwood Gilbert on 2012-11-30.
|
// Copyright 2012 Kearwood Gilbert. All rights reserved.
|
||||||
// Copyright (c) 2012 Kearwood Software. All rights reserved.
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without modification, are
|
||||||
|
// permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
// 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||||
|
// conditions and the following disclaimer.
|
||||||
|
//
|
||||||
|
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
// of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
// provided with the distribution.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY KEARWOOD GILBERT ''AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL KEARWOOD GILBERT OR
|
||||||
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
|
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
|
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
|
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
//
|
||||||
|
// The views and conclusions contained in the software and documentation are those of the
|
||||||
|
// authors and should not be interpreted as representing official policies, either expressed
|
||||||
|
// or implied, of Kearwood Gilbert.
|
||||||
//
|
//
|
||||||
|
|
||||||
#ifndef KRANIMATIONLAYER_H
|
#ifndef KRANIMATIONLAYER_H
|
||||||
@@ -12,6 +35,7 @@
|
|||||||
#import "KRContextObject.h"
|
#import "KRContextObject.h"
|
||||||
#import "KREngine-common.h"
|
#import "KREngine-common.h"
|
||||||
#import "tinyxml2.h"
|
#import "tinyxml2.h"
|
||||||
|
#import "KRAnimationAttribute.h"
|
||||||
|
|
||||||
class KRAnimationLayer : public KRContextObject {
|
class KRAnimationLayer : public KRContextObject {
|
||||||
public:
|
public:
|
||||||
@@ -52,6 +76,7 @@ public:
|
|||||||
scale_accumulation_mode_t getScaleAccumulationMode() const;
|
scale_accumulation_mode_t getScaleAccumulationMode() const;
|
||||||
void setScaleAccumulationMode(const scale_accumulation_mode_t &scale_accumulation_mode);
|
void setScaleAccumulationMode(const scale_accumulation_mode_t &scale_accumulation_mode);
|
||||||
|
|
||||||
|
void addAttribute(KRAnimationAttribute *attribute);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string m_name;
|
std::string m_name;
|
||||||
@@ -59,6 +84,8 @@ private:
|
|||||||
blend_mode_t m_blend_mode;
|
blend_mode_t m_blend_mode;
|
||||||
rotation_accumulation_mode_t m_rotation_accumulation_mode;
|
rotation_accumulation_mode_t m_rotation_accumulation_mode;
|
||||||
scale_accumulation_mode_t m_scale_accumulation_mode;
|
scale_accumulation_mode_t m_scale_accumulation_mode;
|
||||||
|
|
||||||
|
std::vector<KRAnimationAttribute *> m_attributes;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -2,8 +2,31 @@
|
|||||||
// KRAnimationManager.cpp
|
// KRAnimationManager.cpp
|
||||||
// KREngine
|
// KREngine
|
||||||
//
|
//
|
||||||
// Created by Kearwood Gilbert on 2012-11-30.
|
// Copyright 2012 Kearwood Gilbert. All rights reserved.
|
||||||
// Copyright (c) 2012 Kearwood Software. All rights reserved.
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without modification, are
|
||||||
|
// permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
// 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||||
|
// conditions and the following disclaimer.
|
||||||
|
//
|
||||||
|
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
// of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
// provided with the distribution.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY KEARWOOD GILBERT ''AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL KEARWOOD GILBERT OR
|
||||||
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
|
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
|
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
|
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
//
|
||||||
|
// The views and conclusions contained in the software and documentation are those of the
|
||||||
|
// authors and should not be interpreted as representing official policies, either expressed
|
||||||
|
// or implied, of Kearwood Gilbert.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "KRAnimationManager.h"
|
#include "KRAnimationManager.h"
|
||||||
|
|||||||
@@ -2,8 +2,31 @@
|
|||||||
// KRAnimationManager.h
|
// KRAnimationManager.h
|
||||||
// KREngine
|
// KREngine
|
||||||
//
|
//
|
||||||
// Created by Kearwood Gilbert on 2012-11-30.
|
// Copyright 2012 Kearwood Gilbert. All rights reserved.
|
||||||
// Copyright (c) 2012 Kearwood Software. All rights reserved.
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without modification, are
|
||||||
|
// permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
// 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||||
|
// conditions and the following disclaimer.
|
||||||
|
//
|
||||||
|
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
// of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
// provided with the distribution.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY KEARWOOD GILBERT ''AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL KEARWOOD GILBERT OR
|
||||||
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
|
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
|
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
|
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
//
|
||||||
|
// The views and conclusions contained in the software and documentation are those of the
|
||||||
|
// authors and should not be interpreted as representing official policies, either expressed
|
||||||
|
// or implied, of Kearwood Gilbert.
|
||||||
//
|
//
|
||||||
|
|
||||||
#ifndef KRANIMATIONMANAGER_H
|
#ifndef KRANIMATIONMANAGER_H
|
||||||
|
|||||||
@@ -78,6 +78,14 @@ std::vector<KRResource *> KRResource::LoadFbx(KRContext &context, const std::str
|
|||||||
pNode->ResetPivotSetAndConvertAnimation();
|
pNode->ResetPivotSetAndConvertAnimation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----====---- Import Animation Layers ----====----
|
||||||
|
|
||||||
|
int animation_count = pFbxScene->GetSrcObjectCount(FBX_TYPE(FbxAnimStack));
|
||||||
|
for(int i = 0; i < animation_count; i++) {
|
||||||
|
// FbxAnimStack* pAnimStack = FbxCast<FbxAnimStack>(pFbxScene->GetSrcObject(FBX_TYPE(FbxAnimStack), i));
|
||||||
|
resources.push_back(LoadAnimation(context, pFbxScene->GetSrcObject<FbxAnimStack>(i)));
|
||||||
|
}
|
||||||
|
|
||||||
// ----====---- Import Scene Graph Nodes ----====----
|
// ----====---- Import Scene Graph Nodes ----====----
|
||||||
if(pNode)
|
if(pNode)
|
||||||
{
|
{
|
||||||
@@ -87,13 +95,7 @@ std::vector<KRResource *> KRResource::LoadFbx(KRContext &context, const std::str
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----====---- Import Animations ----====----
|
|
||||||
|
|
||||||
int animation_count = pFbxScene->GetSrcObjectCount(FBX_TYPE(FbxAnimStack));
|
|
||||||
for(int i = 0; i < animation_count; i++) {
|
|
||||||
// FbxAnimStack* pAnimStack = FbxCast<FbxAnimStack>(pFbxScene->GetSrcObject(FBX_TYPE(FbxAnimStack), i));
|
|
||||||
resources.push_back(LoadAnimation(context, pFbxScene->GetSrcObject<FbxAnimStack>(i)));
|
|
||||||
}
|
|
||||||
|
|
||||||
DestroySdkObjects(lSdkManager);
|
DestroySdkObjects(lSdkManager);
|
||||||
|
|
||||||
@@ -286,7 +288,7 @@ KRAnimationLayer *LoadAnimationLayer(KRContext &context, FbxAnimLayer *pAnimLaye
|
|||||||
{
|
{
|
||||||
KRAnimationLayer *new_layer = new KRAnimationLayer(context);
|
KRAnimationLayer *new_layer = new KRAnimationLayer(context);
|
||||||
new_layer->setName(pAnimLayer->GetName());
|
new_layer->setName(pAnimLayer->GetName());
|
||||||
new_layer->setWeight(pAnimLayer->Weight.Get());
|
new_layer->setWeight(pAnimLayer->Weight.Get() / 100.0f);
|
||||||
switch(pAnimLayer->BlendMode.Get()) {
|
switch(pAnimLayer->BlendMode.Get()) {
|
||||||
case FbxAnimLayer::eBlendAdditive:
|
case FbxAnimLayer::eBlendAdditive:
|
||||||
new_layer->setBlendMode(KRAnimationLayer::KRENGINE_ANIMATION_BLEND_MODE_ADDITIVE);
|
new_layer->setBlendMode(KRAnimationLayer::KRENGINE_ANIMATION_BLEND_MODE_ADDITIVE);
|
||||||
@@ -314,6 +316,7 @@ KRAnimationLayer *LoadAnimationLayer(KRContext &context, FbxAnimLayer *pAnimLaye
|
|||||||
new_layer->setScaleAccumulationMode(KRAnimationLayer::KRENGINE_ANIMATION_SCALE_ACCUMULATION_MULTIPLY);
|
new_layer->setScaleAccumulationMode(KRAnimationLayer::KRENGINE_ANIMATION_SCALE_ACCUMULATION_MULTIPLY);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new_layer;
|
return new_layer;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
@@ -446,6 +449,9 @@ void LoadNode(KRNode *parent_node, std::vector<KRResource *> &resources, FbxGeom
|
|||||||
KFbxVector4 lTmpVector;
|
KFbxVector4 lTmpVector;
|
||||||
pNode->UpdatePropertiesFromPivotsAndLimits();
|
pNode->UpdatePropertiesFromPivotsAndLimits();
|
||||||
// Transform = T * Roff * Rp * Rpre * R * Rpost * inverse(Rp) * Soff * Sp * S * inverse(Sp)
|
// Transform = T * Roff * Rp * Rpre * R * Rpost * inverse(Rp) * Soff * Sp * S * inverse(Sp)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
fbxDouble3 local_rotation = pNode->LclRotation.Get(); // pNode->GetGeometricRotation(KFbxNode::eSourcePivot);
|
fbxDouble3 local_rotation = pNode->LclRotation.Get(); // pNode->GetGeometricRotation(KFbxNode::eSourcePivot);
|
||||||
fbxDouble3 local_translation = pNode->LclTranslation.Get(); // pNode->GetGeometricTranslation(KFbxNode::eSourcePivot);
|
fbxDouble3 local_translation = pNode->LclTranslation.Get(); // pNode->GetGeometricTranslation(KFbxNode::eSourcePivot);
|
||||||
fbxDouble3 local_scale = pNode->LclScaling.Get(); // pNode->GetGeometricScaling(KFbxNode::eSourcePivot);
|
fbxDouble3 local_scale = pNode->LclScaling.Get(); // pNode->GetGeometricScaling(KFbxNode::eSourcePivot);
|
||||||
|
|||||||
Reference in New Issue
Block a user