- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- File List
- File Members

# FCDocument/FCDEffectParameterSurface.h

Go to the documentation of this file.

    00001 /*
    00002     Copyright (C) 2005-2007 Feeling Software Inc.
    00003     Portions of the code are:
    00004     Copyright (C) 2005-2007 Sony Computer Entertainment America
    00005
    00006     MIT License: http://www.opensource.org/licenses/mit-license.php
    00007 */
    00008
    00015 #ifndef _FCD_EFFECT_PARAMETER_SURFACE_H_
    00016 #define _FCD_EFFECT_PARAMETER_SURFACE_H_
    00017
    00018 #ifndef _FCD_EFFECT_PARAMETER_H_
    00019 #include "FCDocument/FCDEffectParameter.h"
    00020 #endif // _FCD_EFFECT_PARAMETER_H_
    00021
    00022 class FCDImage;
    00023 class FCDEffectParameterSurfaceInit;
    00024
    00028 struct FCDFormatHint
    00029 {
    00031     enum channelValues { CHANNEL_UNKNOWN, CHANNEL_RGB, CHANNEL_RGBA, CHANNEL_L, CHANNEL_LA, CHANNEL_D, CHANNEL_XYZ, CHANNEL_XYZW };
    00032
    00034     enum rangeValue { RANGE_UNKNOWN, RANGE_SNORM, RANGE_UNORM, RANGE_SINT, RANGE_UINT, RANGE_FLOAT, RANGE_LOW };
    00035
    00037     enum precisionValue { PRECISION_UNKNOWN, PRECISION_LOW, PRECISION_MID, PRECISION_HIGH };
    00038
    00040     enum optionValue { OPT_SRGB_GAMMA, OPT_NORMALIZED3, OPT_NORMALIZED4, OPT_COMPRESSABLE };
    00041
    00042     channelValues channels;
    00043     rangeValue range;
    00044     precisionValue precision;
    00045     fm::vector<optionValue> options;
    00046 };
    00047
    00057 class FCOLLADA_EXPORT FCDEffectParameterSurface : public FCDEffectParameter
    00058 {
    00059 private:
    00060     DeclareObjectType(FCDEffectParameter);
    00061     StringList names;
    00062     DeclareParameterTrackList(FCDImage, images, FC("Images"));
    00063     FCDEffectParameterSurfaceInit* initMethod;
    00064     fm::string format;
    00065     FCDFormatHint* formatHint;
    00066     FMVector3 size;
    00067     float viewportRatio;
    00068     uint16 mipLevelCount;
    00069     bool generateMipmaps;
    00070     fm::string type;
    00071
    00072 public:
    00076     FCDEffectParameterSurface(FCDocument* document);
    00077
    00079     virtual ~FCDEffectParameterSurface();
    00080
    00083     virtual Type GetType() const { return SURFACE; }
    00084
    00091     FCDEffectParameterSurfaceInit* GetInitMethod() { return initMethod; }
    00092     const FCDEffectParameterSurfaceInit* GetInitMethod() const { return initMethod; }
    00102     void SetInitMethod(FCDEffectParameterSurfaceInit* method);
    00103
    00108     const FCDImage** GetImages() const { return images.begin(); }
    00114     size_t GetImageCount() const { return images.size(); }
    00115
    00119     FCDImage* GetImage(size_t index = 0) { return index < images.size() ? images.at(index) : NULL; }
    00120     const FCDImage* GetImage(size_t index = 0) const { return index < images.size() ? images.at(index) : NULL; }
    00126     size_t FindImage(const FCDImage* image) const;
    00127
    00136     size_t AddImage(FCDImage* image, size_t index = (size_t) -1);
    00137
    00143     void RemoveImage(FCDImage* image);
    00144
    00149     const FMVector3& GetSize() const { return size; }
    00150
    00155     void SetSize(const FMVector3& dimensions) { size = dimensions; }
    00156
    00159     float GetViewportRatio() const { return viewportRatio; }
    00160
    00163     void SetViewportRatio(float ratio) { viewportRatio = ratio; SetDirtyFlag(); }
    00164
    00171     uint16 GetMipLevelCount() const { return mipLevelCount; }
    00172
    00178     void SetMipLevelCount(uint16 levelCount) { mipLevelCount = levelCount; SetDirtyFlag(); }
    00179
    00183     bool IsGenerateMipMaps() const { return generateMipmaps; }
    00184
    00188     void SetGenerateMipMaps(bool _generateMipmaps) { generateMipmaps = _generateMipmaps; SetDirtyFlag(); }
    00189
    00191     void SetFormat(const fm::string& _format) { format = _format; SetDirtyFlag(); }
    00192     const fm::string& GetFormat(){ return format; }
    00193
    00195     void SetSurfaceType(const fm::string& _type) { type = _type; SetDirtyFlag(); }
    00196
    00198     const fm::string& GetSurfaceType() { return type; }
    00199
    00203     virtual bool IsValueEqual(FCDEffectParameter *parameter);
    00204
    00210     virtual FCDEffectParameter* Clone(FCDEffectParameter* clone = NULL) const;
    00211
    00215     virtual void Overwrite(FCDEffectParameter* target);
    00216
    00219     StringList& GetNames() { return names; }
    00220
    00223     FCDFormatHint* AddFormatHint();
    00224
    00228     inline FCDFormatHint* GetFormatHint() { return formatHint; }
    00229     inline const FCDFormatHint* GetFormatHint() const { return formatHint; }
    00230 };
    00231
    00232
    00238 class FCOLLADA_EXPORT FCDEffectParameterSurfaceInitFactory
    00239 {
    00240 private:
    00241     // Never instantiate: this is a static class
    00242     FCDEffectParameterSurfaceInitFactory() {}
    00243
    00244 public:
    00245
    00247     enum InitType
    00248     {
    00249         FROM,
    00250         AS_NULL,
    00251         AS_TARGET,
    00252         CUBE,
    00253         VOLUME,
    00254         PLANAR
    00255     };
    00256
    00259     static FCDEffectParameterSurfaceInit* Create(InitType type);
    00260 };
    00261
    00262
    00271 class FCOLLADA_EXPORT FCDEffectParameterSurfaceInit
    00272 {
    00273 public:
    00275     FCDEffectParameterSurfaceInit() {}
    00276
    00278     virtual ~FCDEffectParameterSurfaceInit() {}
    00279
    00284     virtual FCDEffectParameterSurfaceInitFactory::InitType GetInitType() const = 0;
    00285
    00288     virtual FCDEffectParameterSurfaceInit* Clone(FCDEffectParameterSurfaceInit* clone) const;
    00289 };
    00290
    00294 class FCOLLADA_EXPORT FCDEffectParameterSurfaceInitCube : public FCDEffectParameterSurfaceInit
    00295 {
    00296 public:
    00298     enum CubeType
    00299     {
    00300         ALL,
    00301         PRIMARY,
    00302         FACE
    00303     };
    00304
    00305 public:
    00307     FCDEffectParameterSurfaceInitCube();
    00308
    00310     virtual ~FCDEffectParameterSurfaceInitCube() {}
    00311
    00316     virtual FCDEffectParameterSurfaceInitFactory::InitType GetInitType() const {return FCDEffectParameterSurfaceInitFactory::CUBE;}
    00317
    00323     virtual FCDEffectParameterSurfaceInit* Clone(FCDEffectParameterSurfaceInit* clone) const;
    00324
    00326     CubeType cubeType;
    00327
    00332     UInt16List order;
    00333 };
    00334
    00338 class FCOLLADA_EXPORT FCDEffectParameterSurfaceInitVolume : public FCDEffectParameterSurfaceInit
    00339 {
    00340 public:
    00342     enum VolumeType
    00343     {
    00344         ALL,
    00345         PRIMARY
    00346     };
    00347
    00348 public:
    00350     FCDEffectParameterSurfaceInitVolume();
    00351
    00353     virtual ~FCDEffectParameterSurfaceInitVolume() {}
    00354
    00359     virtual FCDEffectParameterSurfaceInitFactory::InitType GetInitType() const {return FCDEffectParameterSurfaceInitFactory::VOLUME;}
    00360
    00366     virtual FCDEffectParameterSurfaceInit* Clone(FCDEffectParameterSurfaceInit* clone) const;
    00367
    00369     VolumeType volumeType;
    00370 };
    00371
    00376 class FCOLLADA_EXPORT FCDEffectParameterSurfaceInitFrom : public FCDEffectParameterSurfaceInit
    00377 {
    00378 public:
    00380     FCDEffectParameterSurfaceInitFrom() {}
    00381
    00383     virtual ~FCDEffectParameterSurfaceInitFrom() {}
    00384
    00389     virtual FCDEffectParameterSurfaceInitFactory::InitType GetInitType() const {return FCDEffectParameterSurfaceInitFactory::FROM;}
    00390
    00396     virtual FCDEffectParameterSurfaceInit* Clone(FCDEffectParameterSurfaceInit* clone) const;
    00397
    00399     StringList mip;
    00400
    00402     StringList slice;
    00403
    00405     StringList face;
    00406 };
    00407
    00411 class FCOLLADA_EXPORT FCDEffectParameterSurfaceInitAsNull : public FCDEffectParameterSurfaceInit
    00412 {
    00413 public:
    00415     FCDEffectParameterSurfaceInitAsNull() {}
    00416
    00418     virtual ~FCDEffectParameterSurfaceInitAsNull() {}
    00419
    00424     virtual FCDEffectParameterSurfaceInitFactory::InitType GetInitType() const {return FCDEffectParameterSurfaceInitFactory::AS_NULL;}
    00425
    00431     virtual FCDEffectParameterSurfaceInit* Clone(FCDEffectParameterSurfaceInit* clone) const;
    00432 };
    00433
    00437 class FCOLLADA_EXPORT FCDEffectParameterSurfaceInitAsTarget : public FCDEffectParameterSurfaceInit
    00438 {
    00439 public:
    00441     FCDEffectParameterSurfaceInitAsTarget() {};
    00442
    00444     virtual ~FCDEffectParameterSurfaceInitAsTarget() {}
    00445
    00450     virtual FCDEffectParameterSurfaceInitFactory::InitType GetInitType() const {return FCDEffectParameterSurfaceInitFactory::AS_TARGET;}
    00451
    00457     virtual FCDEffectParameterSurfaceInit* Clone(FCDEffectParameterSurfaceInit* clone) const;
    00458 };
    00459
    00463 class FCOLLADA_EXPORT FCDEffectParameterSurfaceInitPlanar : public FCDEffectParameterSurfaceInit
    00464 {
    00465 public:
    00467     FCDEffectParameterSurfaceInitPlanar() {};
    00468
    00470     virtual ~FCDEffectParameterSurfaceInitPlanar() {}
    00471
    00476     virtual FCDEffectParameterSurfaceInitFactory::InitType GetInitType() const {return FCDEffectParameterSurfaceInitFactory::PLANAR;}
    00477
    00483     virtual FCDEffectParameterSurfaceInit* Clone(FCDEffectParameterSurfaceInit* clone) const;
    00484 };
    00485
    00486
    00487
    00488 #endif // _FCD_EFFECT_PARAMETER_SURFACE_H_