瀏覽代碼

- fbx: add DOM classes for light and camera node attachments. Devise a new macro-based system to easily define dynamic fbx properties.

Alexander Gessler 13 年之前
父節點
當前提交
ffbac847ef
共有 4 個文件被更改,包括 302 次插入212 次删除
  1. 7 1
      code/FBXDocument.cpp
  2. 56 0
      code/FBXDocument.h
  3. 28 0
      code/FBXNodeAttribute.cpp
  4. 211 211
      workspaces/vc9/assimp.vcproj

+ 7 - 1
code/FBXDocument.cpp

@@ -506,9 +506,15 @@ const Object* LazyObject::Get(bool dieOnError)
 			}
 			}
 		}
 		}
 		else if (!strncmp(obtype,"NodeAttribute",length)) {
 		else if (!strncmp(obtype,"NodeAttribute",length)) {
-			if (!strcmp(classtag.c_str(),"CameraSwitcher")) {
+			if (!strcmp(classtag.c_str(),"Camera")) {
+				object.reset(new Camera(id,element,doc,name));
+			}
+			else if (!strcmp(classtag.c_str(),"CameraSwitcher")) {
 				object.reset(new CameraSwitcher(id,element,doc,name));
 				object.reset(new CameraSwitcher(id,element,doc,name));
 			}
 			}
+			else if (!strcmp(classtag.c_str(),"Light")) {
+				object.reset(new Light(id,element,doc,name));
+			}
 		}
 		}
 		else if (!strncmp(obtype,"Deformer",length)) {
 		else if (!strncmp(obtype,"Deformer",length)) {
 			if (!strcmp(classtag.c_str(),"Cluster")) {
 			if (!strcmp(classtag.c_str(),"Cluster")) {

+ 56 - 0
code/FBXDocument.h

@@ -48,6 +48,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include <map>
 #include <map>
 #include <string>
 #include <string>
 
 
+#include "FBXProperties.h"
+
 namespace Assimp {
 namespace Assimp {
 namespace FBX {
 namespace FBX {
 
 
@@ -210,6 +212,60 @@ private:
 };
 };
 
 
 
 
+#define fbx_stringize(a) #a
+
+#define fbx_simple_property(name, type, default_value) \
+	type name() const { \
+		return PropertyGet(Props(), fbx_stringize(name), (default_value)); \
+	}
+
+
+/** DOM base class for FBX cameras attached to a node */
+class Camera : public NodeAttribute
+{
+public:
+
+	Camera(uint64_t id, const Element& element, const Document& doc, const std::string& name);
+	~Camera();
+
+public:
+
+	fbx_simple_property(Position, aiVector3D, aiVector3D(0,0,0));
+	fbx_simple_property(UpVector, aiVector3D, aiVector3D(0,1,0));
+	fbx_simple_property(InterestPosition, aiVector3D, aiVector3D(0,0,0));
+
+	fbx_simple_property(AspectWidth, float, 1.0f);
+	fbx_simple_property(AspectHeight, float, 1.0f);
+	fbx_simple_property(FilmWidth, float, 1.0f);
+	fbx_simple_property(FilmHeight, float, 1.0f);
+
+	fbx_simple_property(FilmAspectRatio, float, 1.0f);
+	fbx_simple_property(ApertureMode, int, 0);
+
+	fbx_simple_property(FieldOfView, float, 1.0f);
+	fbx_simple_property(FocalLength, float, 1.0f);
+
+private:
+};
+
+
+/** DOM base class for FBX lights attached to a node */
+class Light : public NodeAttribute
+{
+public:
+
+	Light(uint64_t id, const Element& element, const Document& doc, const std::string& name);
+	~Light();
+
+public:
+
+	fbx_simple_property(Color, aiVector3D, aiVector3D(1,1,1));
+	fbx_simple_property(Intensity, float, 1.0f);
+
+private:
+};
+
+
 /** DOM base class for FBX models (even though its semantics are more "node" than "model" */
 /** DOM base class for FBX models (even though its semantics are more "node" than "model" */
 class Model : public Object
 class Model : public Object
 {
 {

+ 28 - 0
code/FBXNodeAttribute.cpp

@@ -104,6 +104,34 @@ CameraSwitcher::~CameraSwitcher()
 
 
 }
 }
 
 
+
+// ------------------------------------------------------------------------------------------------
+Camera::Camera(uint64_t id, const Element& element, const Document& doc, const std::string& name)
+: NodeAttribute(id,element,doc,name)
+{
+
+}
+
+
+// ------------------------------------------------------------------------------------------------
+Camera::~Camera()
+{
+}
+
+
+// ------------------------------------------------------------------------------------------------
+Light::Light(uint64_t id, const Element& element, const Document& doc, const std::string& name)
+: NodeAttribute(id,element,doc,name)
+{
+
+}
+
+
+// ------------------------------------------------------------------------------------------------
+Light::~Light()
+{
+}
+
 }
 }
 }
 }
 
 

文件差異過大導致無法顯示
+ 211 - 211
workspaces/vc9/assimp.vcproj


部分文件因文件數量過多而無法顯示