IParticleChannelMesh.h

Go to the documentation of this file.
00001 
00008 /**********************************************************************
00009  *<
00010     CREATED BY: Oleg Bayborodin
00011 
00012     HISTORY: created 11-28-01
00013 
00014  *> Copyright (c) 2001, All Rights Reserved.
00015  **********************************************************************/
00016 
00017 #pragma once
00018 
00019 #include "PFExport.h"
00020 #include "..\ifnpub.h"
00021 // forward declarations
00022 class Box3;
00023 
00024 // standard particle channel "Mesh"
00025 // interface ID
00026 #define PARTICLECHANNELMESHR_INTERFACE Interface_ID(0x74f93c11, 0x1eb34500)
00027 #define PARTICLECHANNELMESHW_INTERFACE Interface_ID(0x74f93c11, 0x1eb34501)
00028 
00029 // since it's a "type" channel there is no "GetChannel" defines
00030 //#define GetParticleChannelMeshRInterface(obj) ((IParticleChannelMeshR*)obj->GetInterface(PARTICLECHANNELMESHR_INTERFACE))
00031 //#define GetParticleChannelMeshWInterface(obj) ((IParticleChannelMeshW*)obj->GetInterface(PARTICLECHANNELMESHW_INTERFACE))
00032 
00033 
00034 class IParticleChannelMeshR : public FPMixinInterface
00035 {
00036 public:
00037 
00038     // function IDs Read
00039     enum {  kIsShared,
00040             kGetValueCount,
00041             kGetValueIndex,
00042             kGetValueByIndex,
00043             kGetValue,
00044             kGetValueFirst,
00045             kGetMaxBoundingBox
00046     };
00047 
00048     BEGIN_FUNCTION_MAP
00049 
00050     FN_0(kIsShared, TYPE_bool, IsShared);
00051     FN_0(kGetValueCount, TYPE_INT, GetValueCount);
00052     FN_1(kGetValueIndex, TYPE_INT, GetValueIndex, TYPE_INT);
00053     FN_1(kGetValueByIndex, TYPE_MESH, GetValueByIndex, TYPE_INT);
00054     FN_1(kGetValue, TYPE_MESH, GetValue, TYPE_INT);
00055     FN_0(kGetValueFirst, TYPE_MESH, GetValue);
00056     VFN_2(kGetMaxBoundingBox, GetMaxBoundingBox, TYPE_POINT3_BR, TYPE_POINT3_BR);
00057 
00058     END_FUNCTION_MAP
00059 
00060     // check out if some particles have shared mesh
00061     // if it's true then there is no need to get a shape for each particle
00062     virtual bool        IsShared() const = 0;
00063     // get total number of actual meshes (values) in the channel
00064     virtual int         GetValueCount() const = 0;
00065     // get the value index of a particle
00066     virtual int         GetValueIndex(int particleIndex) const = 0;
00067     // get shape of the valueIndex-th value
00068     virtual const Mesh* GetValueByIndex(int valueIndex) const = 0;
00069     // get shape for particle with index
00070     virtual const Mesh* GetValue(int particleIndex) const = 0;
00071     // get global shape for all particles
00072     // the method returns the mesh of the first particle if it is local or shared
00073     virtual const Mesh* GetValue() const = 0;
00074     // returns maximal bounding box
00075     virtual const Box3&     GetMaxBoundingBox() const = 0;
00076     // FnPub alternative for the method above
00077     PFExport void           GetMaxBoundingBox(Point3& corner1, Point3& corner2) const;
00078 
00079     FPInterfaceDesc* GetDesc() { return GetDescByID(PARTICLECHANNELMESHR_INTERFACE); }
00080 };
00081 
00082 class IParticleChannelMeshW : public FPMixinInterface
00083 {
00084 public:
00085 
00086     // function IDs Write
00087     enum {  kSetValue,
00088             kSetValueMany,
00089             kSetValueAll,
00090             kCopyValue,
00091             kCopyValueMany,
00092             kCopyValueAll,
00093             kBuildMaxBoundingBox
00094     };
00095 
00096     BEGIN_FUNCTION_MAP
00097 
00098     FN_2(kSetValue, TYPE_bool, SetValue, TYPE_INT, TYPE_MESH);
00099     FN_2(kSetValueMany, TYPE_bool, SetValue, TYPE_INT_TAB_BR, TYPE_MESH);
00100     FN_1(kSetValueAll, TYPE_bool, SetValue, TYPE_MESH);
00101     FN_2(kCopyValue, TYPE_bool, CopyValue, TYPE_INT, TYPE_INT);
00102     FN_2(kCopyValueMany, TYPE_bool, CopyValue, TYPE_INT, TYPE_INT_TAB_BR);
00103     FN_1(kCopyValueAll, TYPE_bool, CopyValue, TYPE_INT);
00104     VFN_0(kBuildMaxBoundingBox, BuildMaxBoundingBox);
00105 
00106     END_FUNCTION_MAP
00107 
00108     // copies mesh to be a local value for particle with index "particleIndex"
00109     // returns true if successful
00110     virtual bool    SetValue(int particleIndex, Mesh* mesh) = 0;
00111     // copies mesh to be a shared value with indices in "particleIndices"
00112     // returns true if successful
00113     virtual bool    SetValue(Tab<int>& particleIndices, Mesh* mesh) = 0;
00114     // copies mesh to be a global values for all particles
00115     // returns true if successful
00116     virtual bool    SetValue(Mesh* mesh) = 0;
00117     // copy mesh value from fromParticle to toParticle
00118     virtual bool    CopyValue(int fromParticle, int toParticle) = 0;
00119     // copy mesh value from fromParticle to toParticles
00120     virtual bool    CopyValue(int fromParticle, Tab<int>& toParticles) = 0;
00121     // copy mesh value from fromParticle to all particles
00122     virtual bool    CopyValue(int fromParticle) = 0;
00123     // build maximal bounding box for the set of all shapes
00124     virtual void    BuildMaxBoundingBox() = 0;
00125 
00126     FPInterfaceDesc* GetDesc() { return GetDescByID(PARTICLECHANNELMESHW_INTERFACE); }
00127 };
00128