source: NonGTP/FCollada/FCDocument/FCDTransform.h @ 964

Revision 964, 25.1 KB checked in by igarcia, 19 years ago (diff)
Line 
1/*
2        Copyright (C) 2005-2006 Feeling Software Inc.
3        MIT License: http://www.opensource.org/licenses/mit-license.php
4*/
5/*
6        Based on the FS Import classes:
7        Copyright (C) 2005-2006 Feeling Software Inc
8        Copyright (C) 2005-2006 Autodesk Media Entertainment
9        MIT License: http://www.opensource.org/licenses/mit-license.php
10*/
11
12/**
13        @file FCDTransform.h
14        This file contains the FCDTransform class and its up-classes:
15        FCDTTranslation, FCDTScale, FCDTRotation, FCDTMatrix, FCDTLookAt and FCDTSkew.
16*/
17
18#ifndef _FCD_TRANSFORM_H_
19#define _FCD_TRANSFORM_H_
20
21class FCDocument;
22class FCDSceneNode;
23
24#include "FCDocument/FCDObject.h"
25
26/**
27        A COLLADA transform.
28
29        COLLADA supports six transformation types: translations(FCDTTranslation),
30        rotations(FCDTRotation), scales(FCDTScale), matrices(FCDTMatrix),
31        skews(FCDTSkew) and the 'look-at' transform(FCDTLookAt).
32
33        @ingroup FCDocument
34*/
35class FCOLLADA_EXPORT FCDTransform : public FCDObject
36{
37public:
38        /** The COLLADA transform types. */
39        enum Type
40        {
41                TRANSLATION, /**< A translation(FCDTTranslation). */
42                ROTATION, /**< A rotation(FCDTRotation). */
43                SCALE, /**< A non-uniform scale(FCDTScale). */
44                MATRIX, /**< A matrix multiplication(FCDTMatrix). */
45                LOOKAT, /**< A targeted, 'look-at' transformation(FCDTLookAt). */
46                SKEW /**< A skew(FCDTSkew). */
47        };
48
49private:
50        DeclareObjectType;
51        FCDSceneNode* parent;
52
53public:
54        /** Constructor: do not use directly.
55                Instead, use the FCDSceneNode::AddTransform function.
56                @param document The COLLADA document that owns the transform.
57                @param parent The visual scene node that contains the transform.
58                        Set this pointer to NULL if this transform is not owned by a
59                        visual scene node. */
60        FCDTransform(FCDocument* document, FCDSceneNode* parent);
61
62        /** Destructor: do not use directly.
63                Instead, use the FCDSceneNode::ReleaseTransform function. */
64        virtual ~FCDTransform();
65
66        /** Retrieves the visual scene node that contains this transformation.
67                @return The parent visual scene node. This pointer will be NULL
68                        if the transformation is not contained by a visual scene node. */
69        FCDSceneNode* GetParent() { return parent; }
70        const FCDSceneNode* GetParent() const { return parent; } /**< See above. */
71
72        /** Creates a copy of a transformation.
73                @param newParent The visual scene node that will contain the clone.
74                @return The cloned transformation. */
75        virtual FCDTransform* Clone(FCDSceneNode* newParent) = 0;
76
77        /** Retrieves the class type of the transformation.
78                The class type should be used to up-case the transformation pointer.
79                @return The class type. */
80        virtual Type GetType() const = 0;
81
82        /** Converts the transformation into a matrix.
83                Useful for visual scene nodes with a weird transformation stack.
84                @return A matrix equivalent of the transformation. */
85        virtual FMMatrix44 ToMatrix() const = 0;
86
87        /** Retrieves whether this transformation has an animation tied to its values.
88                @return Whether the transformation is animated. */
89        virtual bool IsAnimated() const = 0;
90
91        /** Retrieves the animated element for the transformation.
92                @return The animated element. This pointer will be NULL if the transformation
93                        is not animated. */
94        virtual FCDAnimated* GetAnimated() = 0;
95
96        /** Retrieves whether a given transformation is the exact opposite of
97                this transformation. Executing two opposite transformations, one after the
98                other will not give any resulting transformation. This function is useful
99                to detect pivots within the transform stack.
100                @param transform A second transformation.
101                @return Whether the two transformations are opposites. */
102        virtual bool IsInverse(const FCDTransform* transform) const;
103
104        /** [INTERNAL] Reads in the transformation from a given COLLADA XML tree node.
105                @param transformNode The COLLADA XML tree node.
106                @return The status of the import. If the status is not successful,
107                        it may be dangerous to extract information from the transformation.*/
108        virtual FUStatus LoadFromXML(xmlNode* transformNode) = 0;
109
110        /** [INTERNAL] Writes out the transformation to the given COLLADA XML tree node.
111                @param parentNode The COLLADA XML parent node in which to insert the transformation.
112                @return The created XML tree node. */
113        virtual xmlNode* WriteToXML(xmlNode* parentNode) const = 0;
114};
115
116/**
117        A COLLADA translation.
118        A translation is a simple 3D displacement.
119
120        @ingroup FCDocument
121*/
122class FCOLLADA_EXPORT FCDTTranslation : public FCDTransform
123{
124private:
125        DeclareObjectType;
126        FMVector3 translation;
127
128public:
129        /** Constructor: do not use directly.
130                Instead, use the FCDSceneNode::AddTransform function with
131                the TRANSLATION transformation type.
132                @param document The COLLADA document that owns the translation.
133                @param parent The visual scene node that contains the translation.
134                        Set this pointer to NULL if the translation is not owned
135                        by a visual scene node. */
136        FCDTTranslation(FCDocument* document, FCDSceneNode* parent);
137       
138        /** Destructor: do not use directly.
139                Instead, use the FCDSceneNode::ReleaseTransform function. */
140        virtual ~FCDTTranslation();
141
142        /** Retrieves the transformation class type for the translation.
143                @return The transformation class type: TRANSLATION. */
144        virtual Type GetType() const { return TRANSLATION; }
145
146        /** Retrieves the translation 3D displacement vector.
147                This displacement vector may be animated.
148                @return The displacement vector. */
149        inline FMVector3& GetTranslation() { return translation; }
150        inline const FMVector3& GetTranslation() const { return translation; } /**< See above. */
151
152        /** Sets the translation 3D displacement vector.
153                @param _translation The displacement vector. */
154        inline void SetTranslation(const FMVector3& _translation) { translation = _translation; }
155
156        /** Sets the translation 3D displacement vector.
157                @param x The x-component displacement.
158                @param y The y-component displacement.
159                @param z The z-component displacement. */
160        inline void SetTranslation(float x, float y, float z) { translation = FMVector3(x, y, z); }
161
162        /** Converts the translation into a matrix.
163                @return A matrix equivalent of the translation. */
164        virtual FMMatrix44 ToMatrix() const;
165
166        /** Retrieves whether this translation is affected by an animation.
167                @return Whether the translation is animated. */
168        virtual bool IsAnimated() const;
169
170        /** Retrieves the animated element for the translation.
171                @see FCDAnimatedPoint3
172                @return The animated element. This pointer will be NULL if the translation
173                        is not animated. */
174        virtual FCDAnimated* GetAnimated();
175
176        /** Retrieves whether a given transform is the exact opposite of
177                this translation. The opposite of a translation has a displacement
178                vector with all the components multiplied by -1.
179                @param transform A second transformation.
180                @return Whether the two transformations are opposites. */
181        virtual bool IsInverse(const FCDTransform* transform) const;
182
183        /** Creates a copy of the translation.
184                @param newParent The visual scene node that will contain the clone.
185                @return The cloned translation. */
186        virtual FCDTransform* Clone(FCDSceneNode* newParent);
187
188        /** [INTERNAL] Reads in the translation from a given COLLADA XML tree node.
189                @param translationNode The COLLADA XML tree node.
190                @return The status of the import. If the status is not successful,
191                        it may be dangerous to extract information from the translation.*/
192        virtual FUStatus LoadFromXML(xmlNode* translationNode);
193
194        /** [INTERNAL] Writes out the translation to the given COLLADA XML tree node.
195                @param parentNode The COLLADA XML parent node in which to insert the translation.
196                @return The created XML tree node. */
197        virtual xmlNode* WriteToXML(xmlNode* parentNode) const;
198};
199
200/**
201        A COLLADA non-uniform scale.
202        A non-uniform scale contains three scale factors.
203        @ingroup FCDocument
204*/
205class FCOLLADA_EXPORT FCDTScale : public FCDTransform
206{
207private:
208        DeclareObjectType;
209        FMVector3 scale;
210
211public:
212        /** Constructor: do not use directly.
213                Instead, use the FCDSceneNode::AddTransform function with
214                the SCALE transformation type.
215                @param document The COLLADA document that owns the non-uniform scale.
216                @param parent The visual scene node that contains the non-uniform scale.
217                        Set this pointer to NULL if the non-uniform scale is not owned
218                        by a visual scene node. */
219        FCDTScale(FCDocument* document, FCDSceneNode* parent);
220
221        /** Destructor: do not use directly.
222                Instead, use the FCDSceneNode::ReleaseTransform function. */
223        virtual ~FCDTScale();
224
225        /** Retrieves the transformation class type for the non-uniform scale.
226                @return The class type: SCALE. */
227        virtual Type GetType() const { return SCALE; }
228
229        /** Retrieves the factors of the non-uniform scale.
230                These factors may be animated.
231                @return The scale factors. */
232        FMVector3& GetScale() { return scale; }
233        const FMVector3& GetScale() const { return scale; } /**< See above. */
234
235        /** Sets the factors of the non-uniform scale.
236                @param _scale The scale factors. */
237        inline void SetScale(const FMVector3& _scale) { scale = _scale; }
238
239        /** Sets the factors of the non-uniform scale.
240                @param x The x-component scale factor.
241                @param y The y-component scale factor.
242                @param z The z-component scale factor. */
243        inline void SetScale(float x, float y, float z) { scale = FMVector3(x, y, z); }
244
245        /** Converts the non-uniform scale into a matrix.
246                @return A matrix equivalent of the non-uniform scale. */
247        virtual FMMatrix44 ToMatrix() const;
248
249        /** Retrieves whether the factors of the non-uniform scale are animated.
250                @return Whether the scale factors are animated. */
251        virtual bool IsAnimated() const;
252
253        /** Retrieves the animated element for the non-uniform scale factors.
254                @see FCDAnimatedPoint3
255                @return The animated element. This pointer will be NULL if the
256                        scale factors are not animated. */
257        virtual FCDAnimated* GetAnimated();
258
259        /** Creates a copy of the non-uniform scale.
260                @param newParent The visual scene node that will contain the clone.
261                @return The cloned non-uniform scale. */
262        virtual FCDTransform* Clone(FCDSceneNode* newParent);
263
264        /** [INTERNAL] Reads in the non-uniform scale from a given COLLADA XML tree node.
265                @param scaleNode The COLLADA XML tree node.
266                @return The status of the import. If the status is not successful,
267                        it may be dangerous to extract information from the transformation.*/
268        virtual FUStatus LoadFromXML(xmlNode* scaleNode);
269
270        /** [INTERNAL] Writes out the non-uniform scale to the given COLLADA XML tree node.
271                @param parentNode The COLLADA XML parent node in which to insert the transformation.
272                @return The created XML tree node. */
273        virtual xmlNode* WriteToXML(xmlNode* parentNode) const;
274};
275
276/**
277        A COLLADA angle-axis rotation.
278        This rotation defines an axis around which the 3D points
279        are rotated by a given angle.
280        @todo (clock-wise/counter-clock-wise?)
281        @ingroup FCDocument
282*/
283class FCOLLADA_EXPORT FCDTRotation : public FCDTransform
284{
285private:
286        DeclareObjectType;
287        float angle;
288        FMVector3 axis;
289
290public:
291        /** Constructor: do not use directly.
292                Instead, use the FCDSceneNode::AddTransform function with
293                the transformation type: ROTATION.
294                @param document The COLLADA document that owns the rotation.
295                @param parent The visual scene node that contains the rotation.
296                        Set this pointer to NULL if the rotation is not owned
297                        by a visual scene node. */
298        FCDTRotation(FCDocument* document, FCDSceneNode* parent);
299       
300        /** Destructor: do not use directly.
301                Instead, use the FCDSceneNode::ReleaseTransform function. */
302        virtual ~FCDTRotation();
303
304        /** Retrieves the transformation class type for the rotation.
305                @return The class type: ROTATION. */
306        virtual Type GetType() const { return ROTATION; }
307
308        /** Retrieves the rotation axis.
309                This 3D vector may be animated.
310                @return The rotation axis. */
311        inline FMVector3& GetAxis() { return axis; }
312        inline const FMVector3& GetAxis() const { return axis; } /**< See above. */
313
314        /** Sets the rotation axis.
315                @param _axis The rotation axis. */
316        inline void SetAxis(const FMVector3& _axis) { axis = _axis; }
317
318        /** Sets the rotation axis.
319                @param x The x-component of the rotation axis.
320                @param y The y-component of the rotation axis.
321                @param z The z-component of the rotation axis. */
322        inline void SetAxis(float x, float y, float z) { axis = FMVector3(x, y, z); }
323
324        /** Retrieves the rotation angle.
325                This angle may be animated.
326                @return The rotation angle, in degrees. */
327        inline float& GetAngle() { return angle; }
328        inline const float& GetAngle() const { return angle; } /**< See above. */
329
330        /** Sets the rotation angle.
331                @param a The rotation angle, in degrees. */
332        inline void SetAngle(float a) { angle = a; }
333
334        /** Sets the rotation components
335                @param _axis The rotation axis.
336                @param a The rotation angle, in degrees. */
337        inline void SetRotation(const FMVector3& _axis, float a) { axis = _axis; angle = a; }
338
339        /** Converts the rotation into a matrix.
340                @return A matrix equivalent of the rotation. */
341        virtual FMMatrix44 ToMatrix() const;
342
343        /** Retrieves whether the axis or the angle of the rotation are animated.
344                @return Whether the rotation is animated. */
345        virtual bool IsAnimated() const;
346
347        /** Retrieves the animated element for the angle-axis rotation.
348                @see FCDAnimatedAngleAxis
349                @return The animated element. This pointer will be NULL if the
350                        rotation is not animated. */
351        virtual FCDAnimated* GetAnimated();
352
353        /** Retrieves whether a given transform is the exact opposite of
354                this rotation. The opposite of an angle-axis rotation has the
355                same axis as this rotation but the angle is multiplied by -1.
356                @param transform A second transformation.
357                @return Whether the two rotation are opposites. */
358        virtual bool IsInverse(const FCDTransform* transform) const;
359
360        /** Creates a copy of the angle-axis rotation.
361                @param newParent The visual scene node that will contain the clone.
362                @return The cloned angle-axis rotation. */
363        virtual FCDTransform* Clone(FCDSceneNode* newParent);
364
365        /** [INTERNAL] Reads in the rotation from a given COLLADA XML tree node.
366                @param rotationNode The COLLADA XML tree node.
367                @return The status of the import. If the status is not successful,
368                        it may be dangerous to extract information from the rotation.*/
369        virtual FUStatus LoadFromXML(xmlNode* rotationNode);
370
371        /** [INTERNAL] Writes out the rotation to the given COLLADA XML tree node.
372                @param parentNode The COLLADA XML parent node in which to insert the rotation.
373                @return The created XML tree node. */
374        virtual xmlNode* WriteToXML(xmlNode* parentNode) const;
375};
376
377/**
378        A COLLADA matrix transformation.
379        This transformation contains a matrix that should be
380        multiplied to the local transformation matrix.
381        @ingroup FCDocument
382*/
383class FCOLLADA_EXPORT FCDTMatrix : public FCDTransform
384{
385private:
386        DeclareObjectType;
387        FMMatrix44 transform;
388
389public:
390        /** Constructor: do not use directly.
391                Instead, use the FCDSceneNode::AddTransform function with
392                the transformation type: MATRIX.
393                @param document The COLLADA document that owns the transformation.
394                @param parent The visual scene node that contains the transformation. */
395        FCDTMatrix(FCDocument* document, FCDSceneNode* parent);
396
397        /** Destructor: do not use directly.
398                Instead, use the FCDSceneNode::ReleaseTransform function. */
399        virtual ~FCDTMatrix();
400       
401        /** Retrieves the transformation class type for the transformation.
402                @return The class type: MATRIX. */
403        virtual Type GetType() const { return MATRIX; }
404
405        /** Retrieves the matrix for the transformation.
406                All 16 values of the matrix may be animated.
407                @return The transformation matrix. */
408        FMMatrix44& GetTransform() { return transform; }
409        const FMMatrix44& GetTransform() const { return transform; } /**< See above. */
410
411        /** Sets the matrix for the transformation.
412                @param mx The transformation matrix. */
413        inline void SetTransform(const FMMatrix44& mx) { transform = mx; }
414
415        /** Converts the transformation into a matrix.
416                For matrix transformations, that's simply the transformation matrix.
417                @return The transformation matrix. */
418        virtual FMMatrix44 ToMatrix() const { return transform; }
419
420        /** Retrieves whether the transformation matrix is animated.
421                @return Whether the transformation matrix is animated. */
422        virtual bool IsAnimated() const;
423
424        /** Retrieves the animated element for the transformation matrix.
425                @see FCDAnimatedMatrix
426                @return The animated element. This pointer will be NULL if the
427                        transformation matrix is not animated. */
428        virtual FCDAnimated* GetAnimated();
429
430        /** Creates a copy of the matrix transformation.
431                @param newParent The visual scene node that will contain the clone.
432                @return The cloned matrix transformation. */
433        virtual FCDTransform* Clone(FCDSceneNode* newParent);
434
435        /** [INTERNAL] Reads in the matrix transformation from a given COLLADA XML tree node.
436                @param matrixNode The COLLADA XML tree node.
437                @return The status of the import. If the status is not successful,
438                        it may be dangerous to extract information from the transformation.*/
439        virtual FUStatus LoadFromXML(xmlNode* matrixNode);
440
441        /** [INTERNAL] Writes out the matrix transformation to the given COLLADA XML tree node.
442                @param parentNode The COLLADA XML parent node in which to insert the transformation.
443                @return The created XML tree node. */
444        virtual xmlNode* WriteToXML(xmlNode* parentNode) const;
445};
446
447/**
448        A COLLADA 'look-at' transformation.
449        This transformation type fully defines a position
450        and an orientation with a 3D world by using three
451        3D vectors: the viewer's position, the position
452        that the viewer is looking at, and the up-vector
453        for camera rolls. */
454class FCOLLADA_EXPORT FCDTLookAt : public FCDTransform
455{
456private:
457        DeclareObjectType;
458        FMVector3 position;
459        FMVector3 target;
460        FMVector3 up;
461
462public:
463        /** Constructor: do not use directly.
464                Instead, use the FCDSceneNode::AddTransform function with
465                the transformation type: LOOKAT.
466                @param document The COLLADA document that owns the transformation.
467                @param parent The visual scene node that contains the transformation. */
468        FCDTLookAt(FCDocument* document, FCDSceneNode* parent);
469
470        /** Destructor: do not use directly.
471                Instead, use the FCDSceneNode::ReleaseTransform function. */
472        virtual ~FCDTLookAt();
473
474        /** Retrieves the transformation class type for the transformation.
475                @return The class type: LOOKAT. */
476        virtual Type GetType() const { return LOOKAT; }
477
478        /** Retrieves the viewer's position.
479                @see FCDAnimatedPoint3
480                @return The viewer's position. */
481        FMVector3& GetPosition() { return position; }
482        const FMVector3& GetPosition() const { return position; } /**< See above. */
483
484        /** Sets the viewer's position.
485                @param pos The viewer's position. */
486        inline void SetPosition(const FMVector3& pos) { position = pos; }
487
488        /** Sets the viewer's position.
489                @param x The x-component of the position.
490                @param y The y-component of the position.
491                @param z The z-component of the position. */
492        inline void SetPosition(float x, float y, float z) { position = FMVector3(x, y, z); }
493
494        /** Retrieves the position that the viewer is looking at.
495                @see FCDAnimatedPoint3
496                @return The viewer's target. */
497        FMVector3& GetTarget() { return target; }
498        const FMVector3& GetTarget() const { return target; } /**< See above. */
499
500        /** Sets the position that the viewer is looking at.
501                @param _target The target position. */
502        inline void SetTarget(const FMVector3& _target) { target = _target; }
503
504        /** Sets the position that the viewer is looking at.
505                @param x The x-component of the target position.
506                @param y The y-component of the target position.
507                @param z The z-component of the target position. */
508        inline void SetTarget(float x, float y, float z) { target = FMVector3(x, y, z); }
509
510        /** Retrieves the viewer's up-vector.
511                @see FCDAnimatedPoint3
512                @return The up-vector. */
513        FMVector3& GetUp() { return up; }
514        const FMVector3& GetUp() const { return up; } /**< See above. */
515
516        /** Sets the viewer's up-vector.
517                @param _up The up-vector. */
518        inline void SetUp(const FMVector3& _up) { up = _up; }
519
520        /** Sets the viewer's up-vector.
521                @param x The x-component of the up-vector.
522                @param y The y-component of the up-vector.
523                @param z The z-component of the up-vector. */
524        inline void SetUp(float x, float y, float z) { up = FMVector3(x, y, z); }
525
526        /** Converts the transformation into a matrix.
527                @return The transformation matrix. */
528        virtual FMMatrix44 ToMatrix() const;
529
530        /** Retrieves whether the transformation is animated.
531                @return FCollada doesn't support animated 'look-at' transforms: false. */
532        virtual bool IsAnimated() const;
533
534        /** Retrieves the animated element for the transformation matrix.
535                @return FCollada doesn't support animated 'look-at' transforms: NULL. */
536        virtual FCDAnimated* GetAnimated();
537
538        /** Creates a copy of the transformation.
539                @param newParent The visual scene node that will contain the clone.
540                @return The cloned 'look-at' transformation. */
541        virtual FCDTransform* Clone(FCDSceneNode* newParent);
542
543        /** [INTERNAL] Reads in the transformation from a given COLLADA XML tree node.
544                @param lookAtNode The COLLADA XML tree node.
545                @return The status of the import. If the status is not successful,
546                        it may be dangerous to extract information from the transformation.*/
547        virtual FUStatus LoadFromXML(xmlNode* lookAtNode);
548
549        /** [INTERNAL] Writes out the transformation to the given COLLADA XML tree node.
550                @param parentNode The COLLADA XML parent node in which to insert the transformation.
551                @return The created XML tree node. */
552        virtual xmlNode* WriteToXML(xmlNode* parentNode) const;
553};
554
555/**
556        A COLLADA skew.
557        In COLLADA, the skew transformation follows the Renderman convention.
558        A skew is defined by two axis and one angle: the axis which is rotated, the axis around
559        which the rotation is done and the angle of the rotation.
560        @ingroup FCDocument
561*/
562class FCOLLADA_EXPORT FCDTSkew : public FCDTransform
563{
564private:
565        DeclareObjectType;
566        FMVector3 rotateAxis;
567        FMVector3 aroundAxis;
568        float angle;
569
570public:
571        /** Constructor: do not use directly.
572                Instead, use the FCDSceneNode::AddTransform function with
573                the transformation type: SKEW.
574                @param document The COLLADA document that owns the skew.
575                @param parent The visual scene node that contains the skew. */
576        FCDTSkew(FCDocument* document, FCDSceneNode* parent);
577
578        /** Destructor: do not use directly.
579                Instead, use the FCDSceneNode::ReleaseTransform function. */
580        virtual ~FCDTSkew();
581
582        /** Retrieves the transformation class type for the transformation.
583                @return The class type: SKEW. */
584        virtual Type GetType() const { return SKEW; }
585
586        /** Retrieves the axis which is rotated.
587                @return The rotated axis. */
588        const FMVector3& GetRotateAxis() const { return rotateAxis; }
589
590        /** Sets the axis which is rotated.
591                @param axis The rotated axis. */
592        inline void SetRotateAxis(const FMVector3& axis) { rotateAxis = axis; }
593
594        /** Retrieves the axis around which the rotation is done.
595                @return The rotation axis. */
596        const FMVector3& GetAroundAxis() const { return aroundAxis; }
597
598        /** Sets the axis around which the rotation is done.
599                @param axis The rotation axis. */
600        inline void SetAroundAxis(const FMVector3& axis) { aroundAxis = axis; }
601
602        /** Retrieves the rotation angle.
603                @return The rotation angle. */
604        const float& GetAngle() { return angle; }
605
606        /** Sets the rotation angle.
607                @param _angle The rotation angle. */
608        inline void SetAngle(float _angle) { angle = _angle; }
609
610        /** Converts the skew into a matrix.
611                @return The transformation matrix. */
612        virtual FMMatrix44 ToMatrix() const;
613
614        /** Retrieves whether the transformation is animated.
615                @return FCollada doesn't support animated skews: false. */
616        virtual bool IsAnimated() const;
617
618        /** Retrieves the animated element for the skew.
619                @return FCollada doesn't support animated skews: NULL. */
620        virtual FCDAnimated* GetAnimated();
621
622        /** Creates a copy of the skew.
623                @param newParent The visual scene node that will contain the clone.
624                @return The cloned skew. */
625        virtual FCDTransform* Clone(FCDSceneNode* newParent);
626
627        /** [INTERNAL] Reads in the skew from a given COLLADA XML tree node.
628                @param skewNode The COLLADA XML tree node.
629                @return The status of the import. If the status is not successful,
630                        it may be dangerous to extract information from the skew.*/
631        virtual FUStatus LoadFromXML(xmlNode* skewNode);
632
633        /** [INTERNAL] Writes out the skew to the given COLLADA XML tree node.
634                @param parentNode The COLLADA XML parent node in which to insert the skew.
635                @return The created XML tree node. */
636        virtual xmlNode* WriteToXML(xmlNode* parentNode) const;
637};
638
639/**
640        [INTERNAL] A factory for COLLADA transforms.
641        Creates the correct transform object for a given transform type/XML tree node.
642        To create new transforms, use the FCDSceneNode::AddTransform function.
643*/
644class FCOLLADA_EXPORT FCDTFactory
645{
646private:
647        FCDTFactory() {} // Static class: do not instantiate.
648
649public:
650        /** Creates a new COLLADA transform, given a transform type.
651                @param document The COLLADA document that will own the new transform.
652                @param parent The visual scene node that will contain the transform.
653                @param type The type of transform object to create.
654                @return The new COLLADA transform. This pointer will be NULL
655                        if the given type is invalid. */
656        static FCDTransform* CreateTransform(FCDocument* document, FCDSceneNode* parent, FCDTransform::Type type);
657
658        /** [INTERNAL] Imports a COLLADA transform, given an XML tree node.
659                @param document The COLLADA document that will own the new transform.
660                @param parent The visual scene node that will contain the transform.
661                @param node The XML tree node.
662                @return The imported COLLADA transform. This pointer will be NULL
663                        if the XML tree node does not describe a COLLADA transform. */
664        static FCDTransform* CreateTransform(FCDocument* document, FCDSceneNode* parent, xmlNode* node);
665};
666
667#endif // _FR_TRANSFORM_H_
Note: See TracBrowser for help on using the repository browser.