- fbx: add DOM classes for light and camera node attachments. Devise a new macro-based system to easily define dynamic fbx properties.
parent
c126cfa1ff
commit
ffbac847ef
|
@ -506,9 +506,15 @@ const Object* LazyObject::Get(bool dieOnError)
|
|||
}
|
||||
}
|
||||
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));
|
||||
}
|
||||
else if (!strcmp(classtag.c_str(),"Light")) {
|
||||
object.reset(new Light(id,element,doc,name));
|
||||
}
|
||||
}
|
||||
else if (!strncmp(obtype,"Deformer",length)) {
|
||||
if (!strcmp(classtag.c_str(),"Cluster")) {
|
||||
|
|
|
@ -48,6 +48,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <map>
|
||||
#include <string>
|
||||
|
||||
#include "FBXProperties.h"
|
||||
|
||||
namespace Assimp {
|
||||
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" */
|
||||
class Model : public Object
|
||||
{
|
||||
|
|
|
@ -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()
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue