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

Revision 964, 3.2 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 FCDTargetedEntity.h
14        This file contains the FCDTargetedEntity class.
15*/
16
17#ifndef _FCD_TARGETED_ENTITY_H_
18#define _FCD_TARGETED_ENTITY_H_
19
20#include "FCDocument/FCDEntity.h"
21
22class FCDSceneNode;
23
24/**
25        A targeted entity.
26
27        COLLADA doesn't have targeted entity.
28        Therefore: the behavior of a targeted entity is application-defined.
29       
30        This class is used to support 3dsMax's targeted cameras and lights
31        and we also plan to support Maya's targeted cameras and lights.
32
33        @see FCDCamera FCDLight
34        @ingroup FCDEntity
35*/
36class FCOLLADA_EXPORT FCDTargetedEntity : public FCDEntity
37{
38private:
39        DeclareObjectType;
40
41        // Target
42        string targetId; // only valid during the import
43        FCDSceneNode* targetNode;
44
45public:
46        /** Constructor: do not use directly.
47                Instead, create objects of the up-classes.
48                @param document The COLLADA document that owns the targeted entity.
49                @param baseId The prefix COLLADA id to be used if no COLLADA id is provided. */
50        FCDTargetedEntity(FCDocument* document, const char* baseId);
51
52        /** Destructor: do not use directly.
53                Instead, release objects through their libraries or their parent entities. */
54        virtual ~FCDTargetedEntity();
55
56        /** Retrieves whether a target is defined for this entity.
57                @return Whether a target is defined for this entity. */
58        inline bool HasTarget() const { return targetNode != NULL; }
59
60        /** Retrieves the target visual scene node for this entity.
61                @return The target visual scene node. */
62        inline FCDSceneNode* GetTargetNode() { return targetNode; }
63        inline const FCDSceneNode* GetTargetNode() const { return targetNode; } /**< See above. */
64
65        /** Sets the target visual scene node for this entity.
66                @param target The new target node. */
67        void SetTargetNode(FCDSceneNode* target);
68
69        /** [INTERNAL] Links the entity with its target.
70                This function is used during the import of a COLLADA document.
71                @todo Modify this function to support multiple visual scenes.
72                @param sceneRoot The root visual scene.
73                @return The status of the linkage. */
74        FUStatus LinkTarget(FCDSceneNode* sceneRoot);
75
76protected:
77        /** [INTERNAL] Retrieves the COLLADA id of the target entity.
78                The actual resolution of the COLLADA id into a visual scene node happens
79                during the LinkTarget function.
80                @return The COLLADA id of the target entity. */
81        inline const string& GetTargetId() { return targetId; }
82
83        /** [INTERNAL] Sets the COLLADA id of the target entity.
84                This function is used during the import of a COLLADA document.
85                The actual resolution of the COLLADA id into a visual scene node happens
86                during the LinkTarget function.
87                @param _targetId A COLLADA id. */
88        inline void SetTargetId(const string& _targetId) { targetId = _targetId; }
89        inline void SetTargetId(const char* _targetId) { targetId = _targetId; } /**< See above. */
90};
91
92#endif // _FCD_TARGETED_ENTITY_H_
93
Note: See TracBrowser for help on using the repository browser.