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

Revision 964, 4.7 KB checked in by igarcia, 18 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/**
7        @file FCDEffectProfile.h
8        This file contains the FCDEffectProfile abstract class.
9*/
10
11#ifndef _FCD_EFFECT_PROFILE_H_
12#define _FCD_EFFECT_PROFILE_H_
13
14#include "FUtils/FUDaeEnum.h"
15#include "FCDocument/FCDObject.h"
16
17class FCDocument;
18class FCDEffect;
19
20/**
21        The base for a COLLADA effect profile.
22
23        COLLADA has multiple effect profiles: CG, HLSL, GLSL, GLES and the COMMON profile.
24        For each profile, there is a class which implements this abstract class.
25        This abstract class solely holds the parent effect and allows access to the
26        profile type.
27
28        @see FCDEffectProfileFX FCDEffectStandard
29       
30        @ingroup FCDEffect
31*/
32class FCOLLADA_EXPORT FCDEffectProfile : public FCDObject
33{
34private:
35        DeclareObjectType;
36        FCDEffect* parent;
37
38public:
39        /** Constructor: do not use directly.
40                Instead, use the FCDEffect::AddProfile function.
41                @param document The COLLADA document that owns this effect profile.
42                @param parent The effect which contains this profile. */
43        FCDEffectProfile(FCDocument* document, FCDEffect* parent);
44
45        /** Destructor: do not use directly.
46                Instead, use the FCDEffect::ReleaseProfile function. */
47        virtual ~FCDEffectProfile();
48
49        /** Retrieves the profile type for this effect.
50                This function allows you to up-cast the pointer safely to a more specific
51                effect profile class.
52                @return The profile type. */
53        virtual FUDaeProfileType::Type GetType() const = 0;
54
55        /** Retrieves the parent effect.
56                This is the effect which contains this profile.
57                @return The parent effect. This pointer will never be NULL. */
58        FCDEffect* GetParent() { return parent; }
59        const FCDEffect* GetParent() const { return parent; } /**< See above. */
60
61        /** [INTERNAL] Retrieves the COLLADA id of the parent effect.
62                This function is useful when reporting errors and warnings.
63                @return The COLLADA id of the parent effect. */
64        const string& GetDaeId() const;
65
66        /** Retrieves an effect parameter. Looks for the effect parameter with the correct
67                semantic, in order to bind or override its value.
68                This function searches through the effect profile and the level of abstractions below.
69                @param semantic The effect parameter semantic to match.
70                @return The effect parameter that matches the semantic. This pointer will be NULL
71                        if no effect parameter matches the given semantic. */
72        virtual FCDEffectParameter* FindParameterBySemantic(const string& semantic) = 0;
73
74        /** Retrieves a subset of the effect parameter list.
75                Look for effect parameters with the correct semantic.
76                This function searches through the effect profile and the level of abstractions below.
77                @param semantic The effect parameter semantic to match.
78                @param parameters The list of parameters to fill in. This list is not cleared. */
79        virtual void FindParametersBySemantic(const string& semantic, FCDEffectParameterList& parameters) = 0;
80
81        /** Retrieves a subset of the effect parameter list.
82                Look for effect parameters with the correct reference.
83                This function searches through the effect profile and the level of abstractions below.
84                @param reference The effect parameter reference to match. In the case of effect
85                        parameter generators, the reference is replaced by the sub-id.
86                @param parameters The list of parameters to fill in. This list is not cleared. */
87        virtual void FindParametersByReference(const string& reference, FCDEffectParameterList& parameters) = 0;
88
89        /** [INTERNAL] Clones the profile effect and its parameters.
90                @param newParent The effect that will contain the cloned profile.
91                @return The cloned profile. This pointer will never be NULL. */
92        virtual FCDEffectProfile* Clone(FCDEffect* newParent) = 0;
93
94        /** [INTERNAL] Flattens this effect profile, pushing all the effect parameter overrides
95                into the effect parameter generators and moving all the parameters to the
96                effect technique level of abstraction. To flatten the material, use the
97                FCDMaterialInstance::FlattenMaterial function. */
98        virtual void Flatten() = 0;
99
100        /** [INTERNAL] Reads in the effect profile from a given COLLADA XML tree node.
101                @param profileNode The COLLADA XML tree node.
102                @return The status of the import. If the status is not successful,
103                        it may be dangerous to extract information from the effect profile.*/
104        virtual FUStatus LoadFromXML(xmlNode* profileNode) = 0;
105
106        /** [INTERNAL] Writes out the effect profile to the given COLLADA XML tree node.
107                @param parentNode The COLLADA XML parent node in which to insert the effect profile.
108                @return The created element XML tree node. */
109        virtual xmlNode* WriteToXML(xmlNode* parentNode) const = 0;
110};
111
112#endif // _FCD_EFFECT_PROFILE_H_
Note: See TracBrowser for help on using the repository browser.