added everything

This commit is contained in:
Metario
2017-04-17 06:17:10 -06:00
commit 9c6ff74f19
6121 changed files with 1625704 additions and 0 deletions

View File

@ -0,0 +1,196 @@
/**********************************************************************
*<
FILE: IConveriosnManager.h
DESCRIPTION: Tools to convert from one coordinate system to another
CREATED BY: Neil Hazzard
HISTORY: 10|12|2002
IGame Version: 1.122
*> Copyright (c) 2002, All Rights Reserved.
**********************************************************************/
/*!\file IConversionManager.h
\brief IGame Coordinate conversion Interfaces.
*/
#ifndef __ICONVERSIONMANAGER__H
#define __ICONVERSIONMANAGER__H
#pragma once
#include "Max.h"
#define IGAMEEXPORT __declspec( dllexport )
//!A User definable Coordinate System
/*! The developer can use this to define the Coordinate System that they are using. Rotation specifies whether
it is a Right or Left handed system. The Axis define which way the primary axis point. This will mean that the
data extracted is converted correctly, and the winding order is correct for Left and Right handed systems.
\n
In Max this could be defined as
\n
<pre>
UserCoord = {
1, //Right Handed
1, //X axis goes right
4, //Y Axis goes in
2, //Z Axis goes up.
1, //U Tex axis is left
0, //V Tex axis is Up
}
</pre>
*/
struct UserCoord{
//! Handedness
/*! 0 specifies Left Handed, 1 specifies Right Handed.
*/
int rotation;
//! The X axis
/*! It can be one of the following values 0 = left, 1 = right, 2 = Up, 3 = Down, 4 = in, 5 = out.
*/
int xAxis;
//! The Y axis
/*! It can be one of the following values 0 = left, 1 = right, 2 = Up, 3 = Down, 4 = in, 5 = out.
*/
int yAxis;
//! The Z axis
/*! It can be one of the following values 0 = left, 1 = right, 2 = Up, 3 = Down, 4 = in, 5 = out.
*/
int zAxis;
//! The U Texture axis
/*! It can be one of the following values 0 = left, 1 = right
*/
int uAxis;
//! The V Texture axis
/*! It can be one of the following values 0 = Up, 1 = down
*/
int vAxis;
};
//! A developer can use this class to define what Coord Systems IGame exports the data in
/*! IGame will convert data from the standard Max RH Z up system to any defined system. At the moment direct support
for DirectX and OpenGL are provided. This means that all Matrix and vertex data will have been converted ready to use
on your target system
\nYou should set up the coordinate system straight after initialising IGame. The default is to provide everything in Max
native formats.
*/
class IGameConversionManager
{
public:
//! The supported Coordinate Systems
/*! These are used to tell IGame how to format the data
*/
enum CoordSystem{
IGAME_MAX, /*!<Max RH Z up & +Y*/
IGAME_D3D, /*!<DirectX LH Y up & +Z*/
IGAME_OGL, /*!<OpenGL RH Y up & -Z*/
IGAME_USER /*!<User defined Coord System*/
};
//!Set IGame up for the Coordinate System you are wanting the data to be present in
/*! The default system is the MAX system.
\param Coord The Coordinate system to use If Coord is IGAME_USER then you must set
this data via SetUserCoordSystem
*/
virtual void SetCoordSystem(CoordSystem Coord) =0;
//!Set the User defined Coordinate system, if the CoordSystem has been defined as IGAME_USER
/*! Allow a user definable Coordinate System. See comments above.
\param UC THe data to define the system
*/
virtual void SetUserCoordSystem(UserCoord UC) =0;
};
typedef float GRow[4];
//! this is very minimal, it is used purely to store 4x4 data with minimum functionality to support that.
class GMatrix
{
float m[4][4];
friend IGAMEEXPORT Point3 operator*(const Point3& V, const GMatrix& A);
public:
Point4& operator[](int i) { return((Point4&)(*m[i]));}
const Point4& operator[](int i) const { return((Point4&)(*m[i])); }
//!Returns the Address of the GMatrix. This allows direct access via the [] operator
/*!
\returns The address of the GMatrix
*/
GRow * GetAddr(){return (GRow *)(m);}
//!Returns the Address of the GMatrix. This allows direct access via the [] operator.
/*! This method is const aware.
\returns The address of the GMatrix
*/
const GRow* GetAddr() const { return (GRow *)(m); }
//!constructor from a Matrix3
IGAMEEXPORT GMatrix(Matrix3);
//! default constructor
IGAMEEXPORT GMatrix();
//! Sets all values to 0.0f
void ResetMatrix();
//! Set the Standard Identity Matrix
void SetIdentity();
/*! Access to the matrix column.
\param i The number of the column to retrieve
\returns A Point4 containing the column
*/
IGAMEEXPORT Point4 GetColumn(int i) const;
/*! Set the the matrix column.
\param i The number of the column to set
\param col Point4 containing the column to set
*/
IGAMEEXPORT void SetColumn(int i, Point4 col);
/*! Access to the matrix row.
\param i The number of the row to retrieve
\returns A Point4 containing the row
*/
Point4 GetRow(int i) const { return (*this)[i]; }
/*! Set to the matrix row to the desired data.
\param i The number of the row to set
\param row A Point4 containing the row
*/
IGAMEEXPORT void SetRow(int i, Point4 row);
//!Provide matrix multiplication
IGAMEEXPORT GMatrix operator*(const GMatrix&)const;
//!Assignment operator from a Matrix3
IGAMEEXPORT GMatrix& operator=(const Matrix3&);
//!Extract a Matrix3 from the GMatrix
/*!This is for backward compatibility. This is only of use if you use Max as a coordinate system, other wise
standard max algebra might not be correct for your format.
\returns A max Matrix3 form of the GMatrix
*/
IGAMEEXPORT Matrix3 ExtractMatrix3()const ;
};
//! Multiplies a GMatrix with a Point3
IGAMEEXPORT Point3 operator*(const Point3& V, const GMatrix& A);
//!External access to the conversion manager
IGAMEEXPORT IGameConversionManager * GetConversionManager();
#endif

View File

@ -0,0 +1,322 @@
/**********************************************************************
*<
FILE: IGame.h
DESCRIPTION: Scene and Node interfaces for IGame
CREATED BY: Neil Hazzard, Discreet
HISTORY: created 02/02/02
IGame Version: 1.122
*> Copyright (c) 2002, All Rights Reserved.
**********************************************************************/
/*!\file IGame.h
\brief Main IGame scene access including node and materials
*/
#ifndef __IGAME__H
#define __IGAME__H
#pragma once
#include "IGameControl.h"
#include "IGameMaterial.h"
#include "IGameObject.h"
#define IGAMEEEXPORT __declspec( dllexport )
class GMatrix;
//!A simple wrapper for max nodes
/*!
IGameNode provides simplified access to many of Max's standard Node. The user can use this class to gain access
to Controllers and Objects, plus many basic node properties. An instance of this class is available through the IGameScene
interfaces.
\sa class IGameScene class IGameObject
*/
class IGameNode
{
public:
//! Get the IGameControl Interface for this node
/*! The IGameControl provides access to the key frame data for the node
\return An IGameControl pointer.
*/
virtual IGameControl * GetIGameControl() =0;
//! Get the actual object
/*! The is the object used by IGame, all the basic objects supported by IGame derive from IGameObject
You can use IGameObject::GetIGameType to determine how to cast the returned pointer.
\return An IGameObject pointer
*/
virtual IGameObject * GetIGameObject()=0;
//! Release the IGameObject obtained from GetIGameObject
/*! This will release all the memory used by the object, but it will not effect any controller or transfrom
data. Remember to call GetIGameObject if you want to use it again.
*/
virtual void ReleaseIGameObject()=0;
//! the node name
/*! The name of the node as used in max
\return The name of the object
*/
virtual TCHAR * GetName() = 0;
//! the unique Node ID
/*! This provideds access to the node handle used in max. This value will be unique for the file
\return The node id (node handle)
*/
virtual int GetNodeID() =0;
//! Access to the max node, if further processing is required
/*! if need be the node can be accessed here - this is so that IGame can be intergrated into existing pipelines
\return A pointer to a Max node
*/
virtual INode * GetMaxNode()=0;
//! World TM
/*!
\param t the Time to retrieve the WorldTM. If no time is passed in then the global static frame is used
\return A matrix containing the World TM
*/
// virtual Matrix3 GetWorldTM(TimeValue t=TIME_NegInfinity)=0;
virtual GMatrix GetWorldTM(TimeValue t=TIME_NegInfinity)=0;
//! Local TM
/*!
\param t the Time to retrieve the LocalTM. If no time is passed in then the global static frame is used
\return A Matrix containing the local TM
*/
//virtual Matrix3 GetLocalTM(TimeValue t=TIME_NegInfinity)=0;
virtual GMatrix GetLocalTM(TimeValue t=TIME_NegInfinity)=0;
//! Object TM
/*!
\param t the Time to retrieve the LocalTM. If no time is passed in then the global static frame is used
\return A Matrix containing the Object TM. This is the TM after any world space transforms have been applied
*/
virtual GMatrix GetObjectTM(TimeValue t=TIME_NegInfinity)=0;
//! Get the nodes parent
/*! If this is a top level node, then it will not have any parents
\returns If there is a parent a valid pointer will be returned, else NULL
*/
virtual IGameNode * GetNodeParent() =0;
//! The number of direct children to the parent. This does not include children of children
/*!
\return The number of children
*/
virtual int GetChildCount()=0;
//! Access the n'th child node of the parent node
/*!
\param index The index to the child to retrieve
\return IGameNode pointer to the child
*/
virtual IGameNode * GetNodeChild(int index) =0;
//! The index into the material array for this node's material
/*!
\return The index of material used by this node
*/
virtual int GetMaterialIndex() =0;
//! Direct access to the actual material used by the node
/*!
\return The IGameMaterial pointer for this node.
*/
virtual IGameMaterial * GetNodeMaterial() =0;
//! Is this a Target Node
/*!Can be used for exporting targets. Exporters often treat targets separately to standard nodes
choosing to export them as part of the node that uses them as targets for example lights and cameras
\return true if it is a target
*/
virtual bool IsTarget()=0;
//! Is this node a Group Head
/*! A group in max has an owner, a Group Head, this is a dummy node. The children of a Group Head are the members of the
group. So when you encounter one of these, look for the children as these will be the members of the group.
\return Is it a "Group Head". True if it is.
*/
virtual bool IsGroupOwner()=0;
//!Is the node hidden
/*!This allows access to the hidden property of the node. A developer may choose to ignore any node that is hidden. However
this can be dangerous as many dummy objects get hidden but actually define animation - especially in IK situations
\return true is hidden
*/
virtual bool IsNodeHidden()=0;
};
//!Main scene access
/*! IGameScene is the main entry point for an exporter. It contains the initialisation routines and access to
the nodes and materials of the scene. The user can ask IGame to emeumerate the whole scene, selected nodes or
single nodes, with or with out hierarchy.
*/
class IGameScene
{
public:
//!Set the Property File to use
/*!You can define the name of the file to use, including full path, that IGame uses to parse for the supported
parameters. This means that you could have multiple configs depending on the various games in development. <b>You must call this
before you call InitialiseIGame(). </b> By default the the filename will be the maxroot\plugcfg\IGameProp.XML.
\param fileName The name of the property file to use inthis session.
*/
virtual void SetPropertyFile(const TCHAR * fileName) = 0;
//! Initialise IGame
/*! IGame can be initialised specifying whether to search for selected nodes only
\param selected True is selected are searched for - default false
\return True if the scene was enumerated - A Possible reason for failure is that the Parameter
XML file was not found or parsed correctly
*/
virtual bool InitialiseIGame(bool selected = false)=0;
//!Initialise IGame with a specific node.
/*!Developers can specify a single node to parse.
\param root The actual node to parse
\param Hierarchy lets IGame know to initialise the children of the node
\return True if the scene was enumerated - A Possible reason for failure is that the Parameter
XML file was not found or parsed correctly
*/
virtual bool InitialiseIGame(INode * root, bool Hierarchy = true)=0;
//!Initialise IGame with a specific set of nodes.
/*!Developers can specify a set of nodes to parse. The could be implemented by creating a Tab using
the max sdk. Look at Interface::GetSelNodes() and Interface::GetSelNodeCount().
\param nodes The actual tab containing the nodes to parse
\param Hierarchy lets IGame know to initialise the children of the node
\return True if the scene was enumerated - A Possible reason for failure is that the Parameter
XML file was not found or parsed correctly
*/
virtual bool InitialiseIGame(Tab<INode *> nodes, bool Hierarchy = true) = 0;
//!Get the active filename
/*!
\return The current filename
*/
virtual TCHAR * GetSceneFileName() =0;
//!Set the static frame
/*! Specify the frame to use for Time access functions
\param frameNum The static frame to use - Internally this will be converted to Ticks
*/
virtual void SetStaticFrame(int frameNum)=0;
//!The start of the animation range
/*!This provides the animation start time in ticks
\return The start time in ticks
*/
virtual TimeValue GetSceneStartTime() =0;
//!The end of the animation range
/*!This provides the animation end time in ticks
\return The end time in ticks
*/
virtual TimeValue GetSceneEndTime() =0;
//!THe number of ticks per frame
/*!
\return The number of ticks per frame
*/
virtual int GetSceneTicks()=0;
// Get the number of Top level Parent Node
/*! All node access is provides by parent nodes. This does not include the Root node as in Max. This method
can be used to traverse the scene
\return The number of parent nodes
*/
virtual int GetTopLevelNodeCount()=0;
//! Returns the complete number of nodes.
/*! The is useful if you want to use a progress bar in the exporter
\return The total node count
*/
virtual int GetTotalNodeCount()=0;
//! Access the actual toplevel node
/*!
A Top level node is a node at the top of the Hierarchy, i.e it has no Parent.
\param index The index into the the toplevel parent list
\return A pointer to a IGameNode
\sa IGameNode
*/
virtual IGameNode * GetTopLevelNode(int index) =0;
//! The total number of parent materials
/*! This does not include sub materials - just the number of actual material containers
\return The total number of parent materials
*/
virtual int GetRootMaterialCount() = 0;
//! Access to the Root Material
/*! This is the parent material that is stored on the Node. The material will host any sub materials and access
is provided by the IGameMaterial interface.
\param index The root material to access
\return A Pointer to an IGameMaterial
\sa IGameMaterial
*/
virtual IGameMaterial * GetRootMaterial(int index) =0;
//! Access the IGameNode from the supplied INode
/*! Some IGame methods provide access to INode lists. You can use this method to retrieve the IGameNode equivelent
IGame must be initialised first, as the node must be in the Database
\param node The max node to find
\return A pointer to IGameNode, or NULL if not found
*/
virtual IGameNode * GetIGameNode(INode * node) =0;
//! Access the IGameNode from the supplied Node ID
/*! You can use this method to retrieve the IGameNode based on a Node ID IGame must be initialised first, as the node must be in the Database
\param NodeID The Node ID to find
\return A pointer to IGameNode, or NULL if not found
*/
virtual IGameNode * GetIGameNode(ULONG NodeID) =0;
//! Access the set IGameNodes from the specified IGame Type
/*! You can use this method to retrieve the IGameNode based on IGameObject::ObjectTypes. IGame must be initialised first, as the node must be in the Database
\param Type The IGameObject::ObjectTypes to find
\return A Tab of IGameNodes. The developer should check the Count() method to see if any were found
*/
virtual Tab<IGameNode*> GetIGameNodeByType(IGameObject::ObjectTypes Type) = 0;
//! Releases IGame and free all associated memory
/*! This must be called after you have finished with IGame. It makes sure all data is freed and general clean up is performed.
Without calling this you run the risk of corrupting memory, and causing incorrect data to returned the next time IGame is run
*/
virtual void ReleaseIGame()=0;
};
/*!\fn IGameScene *GetIGameInterface()
\brief A global function to IGameScene, the main starting point in IGame
\return A Pointer to IGameScene
*/
IGAMEEEXPORT IGameScene *GetIGameInterface();
/*!\fn float GetIGameVersion()
\brief Provides a way to query for the version of IGame the DLL has been built against
\return A float value with the IGame Version
*/
IGAMEEEXPORT float GetIGameVersion();
/*!\fn float GetSupported3DSVersion()
\brief Provides a way to query for the version of 3ds max that the IGame DLL is compatible with
\return A float value with the 3ds max version. This currently can either be 4.2,5.1 or 6.0 If it is 6.0 then it
will be compiled with the VC7.0 compiler
*/
IGAMEEEXPORT float GetSupported3DSVersion();
#endif // __IGAME__H

View File

@ -0,0 +1,497 @@
/**********************************************************************
*<
FILE: IGameControl.h
DESCRIPTION: Controller interfaces for IGame
CREATED BY: Neil Hazzard, Discreet
HISTORY: created 02/02/02
IGame Version: 1.122
*> Copyright (c) 2002, All Rights Reserved.
**********************************************************************/
/*!\file IGameControl.h
\brief High level access to MAX's controllers, including Biped and constraints and list controllers
High level access to MAX's controllers, including Biped and constraints and list controllers
<b> Please note that Point4 controller access is only available for 3ds max 6 and above</b>
*/
#ifndef __IGAMECONTROL__H
#define __IGAMECONTROL__H
#pragma once
#include "max.h"
#include "ISTDPLUG.H"
#include "IGameProperty.h"
#include "IConversionManager.h"
class IGameNode;
//! An enum of basic controller types used by IGame
/*! These controllers types are used to define the type of controller being queried.
*/
enum IGameControlType{
IGAME_POS, /*!<Position Controller*/
IGAME_ROT, /*!<Rotation Controller*/
IGAME_SCALE, /*!<Scale Controller*/
IGAME_FLOAT, /*!<Float Controller*/
IGAME_POINT3, /*!<Point3 Controller*/
IGAME_TM, /*!<Used for sampling the node transformation matrix. This is the only time this control
type can be used*/
IGAME_EULER_X, /*!<Euler X controller*/
IGAME_EULER_Y, /*!<Euler Y controller*/
IGAME_EULER_Z, /*!<Euler Z controller*/
IGAME_POINT4, /*!<Point4 based controllers - This is available from 3ds max 6*/
};
class IGameConstraint;
class GMatrix;
//! A generic animation key wrapper class
/*! A generic TCB key class for IGame
*/
class IGameTCBKey {
public:
//! access to basic TCB data
/*! This provides access to the Tension, continuity, bias and easein/out properties of a TCB Key
*/
float tens, cont, bias, easeIn, easeOut;
//! float based value,
/*! This would be accessed when using the IGAME_FLOAT specifier
*/
float fval;
//! Point3 based value,
/*! This would be accessed when using the IGAME_POS or IGAME_POINT3 specifiers
*/
Point3 pval;
//! Point4 based value,
/*! This would be accessed when using the IGAME_POINT4 specifiers
*/
Point4 p4val;
//! Ang Axis based value,
/*! This would be accessed when using the IGAME_ROT specifier
*/
AngAxis aval;
//! scale based value,
/*! This would be accessed when using the IGAME_SCALE specifier
*/
ScaleValue sval;
};
//! A generic animation key wrapper class
/*! A generic Bezier Key class for IGame
*/
class IGameBezierKey {
public:
//! float based In and out tangents
/*! This would be accessed when using the IGAME_FLOAT specifier
*/
float fintan, fouttan;
//! float based value,
/*! This would be accessed when using the IGAME_FLOAT specifier
*/
float fval;
//! float based tangent lengths
/*! This would be accessed when using the IGAME_FLOAT specifier
*/
float finLength, foutLength;
//! Point3 based In and out tangents
/*! This would be accessed when using the IGAME_POS or IGAME_POINT3 specifiers
*/
Point3 pintan, pouttan;
//! Point3 based value,
/*! This would be accessed when using the IGAME_POS or IGAME_POINT3 specifiers
*/
Point3 pval;
//! Point3 based tangent lengths
/*! This would be accessed when using the IGAME_POS or IGAME_POINT3 specifiers
*/
Point3 pinLength, poutLength;
//! Quaternion based value,
/*! This would be accessed when using the IGAME_ROT specifier
*/
Quat qval;
//! scale based value,
/*! This would be accessed when using the IGAME_SCALE specifier
*/
ScaleValue sval;
//! Point4 based In and out tangents
/*! This would be accessed when using the IGAME_POINT4 specifier
*/
Point4 p4intan, p4outtan;
//! Point4 based tangent lengths
/*! This would be accessed when using IGAME_POINT4 specifier
*/
Point4 p4inLength, p4outLength;
//! Point4 based value,
/*! This would be accessed when using the IGAME_POINT4 specifier
*/
Point4 p4val;
};
//! A generic animation key wrapper class
/*! A generic Linear Key class for IGame
*/
class IGameLinearKey {
public:
//! float based value,
/*! This would be accessed when using the IGAME_FLOAT specifier
*/
float fval;
//! Point3 based value,
/*! This would be accessed when using the IGAME_POS or IGAME_POINT3 specifiers
*/
Point3 pval;
//! Quaternion based value,
/*! This would be accessed when using the IGAME_ROT specifier
*/
Quat qval;
//! scale based value,
/*! This would be accessed when using the IGAME_SCALE specifier
*/
ScaleValue sval;
};
//! A generic animation key wrapper class
/*! A generic Sample Key class for IGame. This is used for unknown controllers or controllers that
simply need to be sampled, this can includes Biped
*/
class IGameSampleKey{
public:
//! Point3 value, used with IGAME_POINT3 and IGAME_POS
Point3 pval;
//! Point4 value, used with IGAME_POINT4
Point4 p4val;
//! float value, used with IGAME_FLOAR
float fval;
//! Quaternion value, used with IGAME_ROT
Quat qval;
//! Scale value, used with IGAME_SCALE
ScaleValue sval;
//! GMatrix, used with IGAME_TM
GMatrix gval;
};
//!Main animation key container
/*! A simple container class for direct Key access of all the available Key types
*/
class IGameKey
{
public:
//! The time the key was set
TimeValue t;
//! Flags various selection states for the key.
DWORD flags;
//!The TCB Keys
/*! This key access would be used if you used one of the GetTCBKeys methods
*/
IGameTCBKey tcbKey;
//!The Bezier Keys
/*! This key access would be used if you used one of the GetBezierKeys methods
*/
IGameBezierKey bezierKey;
//!The Linear Keys
/*! This key access would be used if you used one of the GetLinearKeys methods
*/
IGameLinearKey linearKey;
//!The Sampled Keys
/*! This key access would be used if you used one of the GetSampledKeys methods
*/
IGameSampleKey sampleKey;
};
/*!\var typedef Tab<IGameKey> IGameKeyTab
\brief A Tab of IGameKey.
Uses <A HREF="sdk.chm::/html/idx_R_template_class_tab.htm">Max's Template class Tab</A>
*/
typedef Tab<IGameKey> IGameKeyTab;
//!A simple access class for controllers.
/*! IGameControl provides a simplified access to the various key frame controllers used throughout max. In max a controller
needs to be queried for the key interface and then its class ID checked before casting to the appropriate Key class. This class
provide the developer with all the keys based on the key type being asked for. As the game engine may only support certain type
of max controllers it is far more efficient for a developer to ask IGame for all the Bezier Postion keys then to check with max for
the controller type. This class also provides direct support for Euler Rotation controllers. The developer can use GetControlType
to see if the rotation is Euler and can then can use IGAME_EULER_X in the appropriate control access type to retrieve the keys.
\br
In 3ds max some controllers such as TCB, Linear and Bezier support direct access to their keys. Other controllers are more private
and usually base them selves on a float or Point3 controller. If there is no direct access then sampling is the easiest choice. IGame
supports two types - Full and Quick. Full samples across the full animation range, whilst Quick only samples where keys are found. The
limitation of Quick, is that it does not support IGAME_TM or controllers that do not set keys.
\sa <A HREF="sdk.chm::/html/idx_R_template_class_tab.htm">Max's Template class Tab</a>
\sa GMatrix
\sa IGameProperty
*/
class IGameControl
{
public:
enum MaxControlType{
IGAME_UNKNOWN, /*!<An unknown controller type*/
IGAME_MAXSTD, /*!<A Standard max key frame controller*/
IGAME_BIPED, /*!<A Biped Controller*/
IGAME_EULER, /*!<An Euler Controller*/
IGAME_ROT_CONSTRAINT, /*!<A Rotation constraint*/
IGAME_POS_CONSTRAINT, /*!<A Position constraint*/
IGAME_LINK_CONSTRAINT, /*!<A Link Constraint*/
IGAME_LIST, /*!<A List Controller*/
};
//! An enum of Euler Orderings
/*! These are the rotation orders for an Euler Controller
*/
enum EulerOrder{
XYZ, /*!<XYZ Ordering*/
XZY, /*!<XZY Ordering*/
YZX, /*!<YZX Ordering*/
YXZ, /*!<YXZ Ordering*/
ZXY, /*!<ZXY Ordering*/
ZYX, /*!<ZYX Ordering*/
XYX, /*!<XYX Ordering*/
YZY, /*!<YZY Ordering*/
ZXZ, /*!<ZXZ Ordering*/
BAD /*!<If this is not a Euler Controller*/
};
//! Return the Bezier Keys
/*! IGameControl will check the appropriate control and fill the IGameKeyTab with the Key data. To access the
keys you would look in the bezierKey Tab maintained by IGameKey.
\param &gameKeyTab The Tab to receive the data
\param Type The controller type (based on Transform style) to query. This can be one of the following\n
IGAME_POS\n
IGAME_ROT\n
IGAME_SCALE\n
IGAME_FLOAT\n
IGAME_POINT3\n
IGAME_EULER_X\n
IGAME_EULER_Y\n
IGAME_EULER_Z\n
\return TRUE is the controller was accessed successfully.
*/
virtual bool GetBezierKeys(IGameKeyTab &gameKeyTab,IGameControlType Type)=0;
//! Return the Linear Keys
/*! IGameControl will check the appropriate control and fill the IGameKeyTab with data
\param &gameKeyTab The tab to receive the data
\param Type The controller type to query. See IGameControl::GetBezierKeys for more info
\return TRUE is the controller was accessed successfully.
*/
virtual bool GetLinearKeys(IGameKeyTab &gameKeyTab, IGameControlType Type)=0;
//! Return the TCB Keys
/*! IGameControl will check the appropriate control and fill the IGameKeyTab with data
\param &gameKeyTab The tab to receive the data
\param Type The controller type to query. See IGameControl::GetBezierKeys for more info
\return TRUE is the controller was accessed successfully.
*/
virtual bool GetTCBKeys(IGameKeyTab &gameKeyTab, IGameControlType Type)=0;
//! Return the Sampled Keys
/*! IGameControl will sample the control based on the type supplied. It will sample the node TM , float or point3
controllers. The TM sample will be in the Coord System that you defined when initialising IGame. This method
will sample the controller across the complete animation range. The method of access can be provided (absolute and
relative) It is important to read the max sdk docs on Control::GetValue to understand the usage when used with non IGAME_TM
controllers. IGame will still however fill out the respective structures even when the max sdk docs mention Matrix3 access
It is set to Relative as default, as this was the default for IGAME_TM usage before the method changed. If you are sampling
anything else than IGAME_TM this should be set to false to behave like the max default and IGame before this change.
\param &sample The tab to receive the data
\param frameRate This is the number frames that the controller will be sampled at. It will be converted to Ticks internally
\param Type The controller type to query. This can be any of the standard type but also include IGAME_TM
\param Relative This defines whether the controller is sampled for relative or absolute values. It defaults to
relative true. Please read the max sdk section on Control::GetValue for details on the internal usage.
\return TRUE is the controller was accessed successfully.
*/
virtual bool GetFullSampledKeys(IGameKeyTab &sample, int frameRate, IGameControlType Type, bool Relative = true) =0;
//! Return the Sampled Keys
/*! IGameControl will sample the control based on the type supplied. It will sample float or point3
controllers. The TM sample will be in the Coord System that you defined when initialising IGame. This
method only samples the controller where a key is Set, so it will not support the IGAME_TM type. If the
controller does not support setting of keys, it will return false. This method will only sample the controller
at times where keys exist. This is useful to limit the data where controller can not be accessed directly
\param &sample The tab to receive the data
\param Type The controller type to query. This can be any of the standard type but also include IGAME_TM
\return TRUE is the controller was accessed successfully.
*/
virtual bool GetQuickSampledKeys(IGameKeyTab &sample, IGameControlType Type) =0;
//! Return an individual IGameKey
/*! fills out the supplied IGameKEy with the bezier data for the key index supplied
\param Type The controller type to query. See IGameControl::GetBezierKeys for more info
\param &bezKey
\param index The key to retrieve
\return TRUE if successful
*/
virtual bool GetBezierIGameKey(IGameControlType Type, IGameKey &bezKey, int index) =0 ;
//! Return an individual IGameKey
/*! fills out the supplied IGameKey with the TCB data for the key index supplied
\param Type The controller type to query. See IGameControl::GetBezierKeys for more info
\param &tcbKey
\param index The key to retrieve
\return TRUE if successful
*/
virtual bool GetTCBIGameKey(IGameControlType Type, IGameKey &tcbKey, int index)=0 ;
//! Return an individual IGameKey
/*! fills out the supplied IGameKey with the Linear data for the key index supplied
\param Type The controller type to query. See IGameControl::GetBezierKeys for more info
\param &linearKey
\param index The key to retrieve
\return TRUE if successful
*/
virtual bool GetLinearIGameKey(IGameControlType Type, IGameKey &linearKey, int index)=0;
//! The total number of keys for this controller
/*! This return the total number of keys for the controller supplied.
\param Type The controller type to query. See IGameControl::GetBezierKeys for more info
\return The total number of keys
*/
virtual int GetIGameKeyCount(IGameControlType Type)=0;
//!The controller type
/*!Retrieves what type of IGame Controller it is based on transformation style..
\param Type The controller to query. See IGameControl::GetBezierKeys for more info
\return The type of controller, It can be one of the following\n
IGAME_UNKNOWN\n
IGAME_MAXSTD\n
IGAME_BIPED\n
IGAME_ROT_CONSTRAINT\n
IGAME_POS_CONSTRAINT\n
*/
virtual MaxControlType GetControlType(IGameControlType Type)=0;
//!Access to the Constraints
/*! If a controller has a constraint system, then this will provide access to it
\param Type The controller to check. THis can be either of\
IGAME_POS\n
IGAME_ROT\n
\return A Pointer to IGameConstraint, or NULL if not available
*/
virtual IGameConstraint * GetConstraint(IGameControlType Type)=0;
//! The order of Rotation
/*! This provides a way of determining the order of rotation for Euler controllers. THis is important
so that the rotation can be rebuilt correctly on import.\nThis data is also important when accessing the
controller keys. You still access the Euler data bsed on X,Y and Z - but you would use the ordering to
work out the meaning of each controller. So if EulerOrder was ZXZ, then controller access would mean
x=z, y=x, z=z.
\return The order of Rotation. This can be a value from the EulerOrder
*/
virtual EulerOrder GetEulerOrder()=0;
/*! Get access to the actual max controller
\param Type This can be either\n
IGAME_POS\n
IGAME_ROT\n
IGAME_SCALE\n
\return The max controller
*/
virtual Control * GetMaxControl(IGameControlType Type)=0;
//! Access the list controller
/*! Access the n'th controller from the List controller.
\param index The index into the list controller
\param Type The Control type to access
\return An IGameControl interface
*/
virtual IGameControl * GetListSubControl(int index, IGameControlType Type)=0;
//! The number of controllers maintained by the list controller
/*! The number of controllers maintained by the list controller for the Controller type being queried
\param Type The controller to type
\return The number of controllers in the list controller
*/
virtual int GetNumOfListSubControls(IGameControlType Type)=0;
};
//! simple wrapper class for constraints
/*! A unified wrapper around the various constraints that are available in Max. There is access to the type of constraint
in use, plus easier access to the constraints. If further access it needed, the IPropertyContainer interface can be used
and additions made to property file used to access other data, as the source fro these constraints is available in the SDK.
*/
class IGameConstraint : public IExportEntity
{
public:
//! An enum of Max Constraint
/*! These are the constraints supported by IGame
*/
enum ConstraintType{
IGAME_PATH, /*!<Path Constraint*/
IGAME_ORIENTATION, /*!<Orientation Constraint*/
IGAME_LOOKAT, /*!<look At Constraint*/
IGAME_POSITION, /*!<Position Constraint*/
IGAME_LINK, /*!<A TM link constraint*/
IGAME_UNKNOWN, /*!<Unknown Constraint*/
};
//!Number of constraining Node
/*!The number of nodes in use by the Constraint system
\return The number fo nodes
*/
virtual int NumberOfConstraintNodes()=0;
//!The constraint Node
/*! The actual node of the index passed in that is working in the system
\param index The index of the node to retrieve
\return A pointer to IGameNode
*/
virtual IGameNode * GetConstraintNodes(int index)=0;
//!The influence of the bone
/*! This is the weight, or influence the specified node has in the constraint system. The index used here is the same
as the index used in GetConstraintNodes, otherwise the weights will not match. This has no effect for a Link Constraint
\param nodeIndex The node index to query
\return The weight value
*/
virtual float GetConstraintWeight(int nodeIndex)=0;
//!Get the start frame for the Link constraint
/*!This specifies when the link for the n'th node will start.
\param index The node index
\return The start frame for the node queried.
*/
virtual int GetLinkConstBeginFrame(int index) = 0;
//! The type of Constraint
/*! This defines the actual constraint being used on the controller
\return The type of max constraint. It can be one ConstraintType enum
*/
virtual ConstraintType GetConstraintType()=0;
};
#endif

View File

@ -0,0 +1,87 @@
/**********************************************************************
*<
FILE: IGameError.h
DESCRIPTION: Access to the IGame Errors.
CREATED BY: Neil Hazzard, Discreet
HISTORY: created 02/02/02
IGame Version: 1.122
*> Copyright (c) 2002, All Rights Reserved.
**********************************************************************/
/*!\file IGameError.h
\brief IGame Error Access.
Internal IGame methods maintain a global error state, these methods provide access to this data. Many IGame methods return
pointers or boolean status flags. If either of these are null or false, then you can use these method to access the error.
*/
#ifndef __IGAMEERROR__H
#define __IGAMEERROR__H
#include "max.h"
#pragma once
#define IGAMEEEXPORT __declspec( dllexport )
//!Enumeration of the Error codes produced by IGame
enum IGameError{
IG_NO_ERROR, /*!<No Error*/
IG_NO_KEY_INTERFACE, /*!<No Key interface for the controller*/
IG_INDEX_OUT_OF_BOUNDS, /*!<The index into the array is out of bounds*/
IG_ERROR_LOADING_PROPERTIES_FILE, /*!<Errors finding or parsing the Properties file*/
IG_COM_ERROR, /*!<Various COM errors*/
IG_NODE_NOT_FOUND, /*!<IGameNode not found*/
IG_UNSUPPORTED_CONT, /*!<The controller for the basic type is not supported*/
IG_OBJECT_NOT_SUPPORTED, /*!<Object not supported by IGame*/
IG_MAPPING_CHANNEL_ERROR, /*!<Mapping Channel not found*/
IG_MATERIAL_ERROR, /*!<Material not found*/
IG_NO_SKIN_MOD, /*!<No skin modifier*/
IG_NO_CONTROLLER_KEY, /*!<No Keys set on the controller*/
IG_NO_NORMALS, /*!<No indexed normal array created*/
};
//!Error callback
/*!Define a callback for error reporting. This will be called when ever an error has been reported by the system.
The developer can then call GetIGameErrorText to retrieve a more detailed error description. The callback can be
set by using SetErrorCallBack()
*/
class IGameErrorCallBack
{
public:
//!The error callback
/*!This needs to be implemented by the developer and is used by the system to report the error
\param error The error code of the last error
*/
virtual void ErrorProc(IGameError error)=0;
};
/*! Retrieve the last error set by the system
\returns The error code
*/
IGAMEEEXPORT IGameError GetLastIGameError();
/*! Get the detailed description of the last error set by the system
\returns The error text
*/
IGAMEEEXPORT TCHAR * GetLastIGameErrorText();
/*! Set the callback for the error logging
\param *proc A pointer the the IGameErrorCallback object created by the developer
*/
IGAMEEEXPORT void SetErrorCallBack(IGameErrorCallBack * proc);
/*! Resets the last error stored by the system. The global error will only change when IGame sets the last error.
Using this method will override this.
*/
IGAMEEEXPORT void ResetError();
#endif

View File

@ -0,0 +1,310 @@
/**********************************************************************
*<
FILE: IGameMaterial.h
DESCRIPTION: Material interfaces for IGame
CREATED BY: Neil Hazzard, Discreet
HISTORY: created 02/02/02
IGame Version: 1.122
*> Copyright (c) 2002, All Rights Reserved.
**********************************************************************/
/*!\file IGameMaterial.h
\brief IGame material and texture Interfaces.
*/
#ifndef __IGAMEMATERIAL__H
#define __IGAMEMATERIAL__H
#pragma once
#include "max.h"
#include "stdmat.h"
#include "IGameProperty.h"
// copied here from stdmat.h -- this is just to allow IGame to be self contained
#define ID_AM 0 // ambient
#define ID_DI 1 // diffuse
#define ID_SP 2 // specular
#define ID_SH 3 // shininesNs
#define ID_SS 4 // shininess strength
#define ID_SI 5 // self-illumination
#define ID_OP 6 // opacity
#define ID_FI 7 // filter color
#define ID_BU 8 // bump
#define ID_RL 9 // reflection
#define ID_RR 10 // refraction
#define ID_DP 11 // displacement
class IGameBitmapTex;
class IGameTextureMap;
class IGameUVGen;
//!Simple wrapper for max materials
/*! IGameMaterial An IGame Wrapper around a basic Material. It provides access to the basic material properties and
Bitmap Textures used by the material. Any material will be wrapped in this class, but only Standard Material is directly supported
with API access to the properties. If the material is not directly supported then the data can be access via the IPropertyContainer
interface.
\sa IGameProperty, IGameScene
*/
class IGameMaterial : public IExportEntity
{
public:
//! Is the material a Multi Material type - This could be for a Blend or Mix material
/*!
\return TRUE is Multi material
*/
virtual bool IsMultiType()=0;
//! Is the material a SubObject style Multi Material This could be for Max's Multi Subobject material
/*!
\return TRUE is a Subobject material
*/
virtual bool IsSubObjType()=0;
//! The material name as seen in the Material Editor
/*!
\return the name of the material
*/
virtual TCHAR * GetMaterialName()=0;
//! The number of sub materials this material maintains
/*! The value is used by IGameScene::GetSubMaterial
\return The number of Sub material
\sa GetSubMaterial
*/
virtual int GetSubMaterialCount()=0;
//! Access to any sub material.
/*! The sub material is any material used by a multi material For example, a Top/Bottom material the sub materials
would be the top and bottom
\param index Index into the submaterial
\return A Pointer to a IGameMaterial
\sa IGameMaterial, IGameScene::GetRootMaterial
*/
virtual IGameMaterial * GetSubMaterial(int index) =0;
//! For subobject materials get the MatID for the actual material.
/*! This value represents the MatID used on objects to define what faces receive this material
\param subIndex The index of the submaterial to retrieve
\return The MatID of the material
*/
virtual int GetMaterialID(int subIndex)=0;
//! Get the Ambient Data
/*!
\return A pointer to IGameProperty
*/
virtual IGameProperty * GetAmbientData()=0;
//! Get the Diffuse Data
/*!
\return A pointer to IGameProperty
*/
virtual IGameProperty * GetDiffuseData()=0;
//! Get the Emissive Data
/*!
\return A pointer to IGameProperty
*/
virtual IGameProperty * GetEmissiveData()=0;
//! Get the Specular Data
/*!
\return A pointer to IGameProperty
*/
virtual IGameProperty * GetSpecularData()=0;
//! Get the Opacity Data
/*!
\return A pointer to IGameProperty
*/
virtual IGameProperty * GetOpacityData()=0;
//! Get the Glossiness Data
/*!
\return A pointer to IGameProperty
*/
virtual IGameProperty * GetGlossinessData()=0;
//! Get the Specular Level Data
/*!
\return A pointer to IGameProperty
*/
virtual IGameProperty * GetSpecularLevelData()=0;
//! Get the Emissive Amount Data
/*!
\return A pointer to IGameProperty
*/
virtual IGameProperty * GetEmissiveAmtData()=0;
//! Get the number of Textures used by the material
/*!
\return The texture count.
*/
virtual int GetNumberOfTextureMaps()=0;
//!Access to the actual Texture Map
/*!
\param index The index to the Texture Map to retrieve
\return A pointer to a IGameTextureMap
*/
virtual IGameTextureMap * GetIGameTextureMap(int index) =0;
//! Access to the actual Max material definition
/*! This allows developer access to the complete max object if further data access is needed
\return A pointer to a standard max Mtl class
\sa IGameBitmapTex
*/
virtual Mtl * GetMaxMaterial()=0;
};
//!Simple wrapper for max textures
/*! A generic class that wraps all the max texture maps. This class directly supports the Bitmap Texture. This can be
tested for by calling IsObjectSupported. If it is not supported then access to the paramblocks, if defined can be obtained
by using the properties interface. The usual texture map properties including coordinate rollout access are provide here
*/
class IGameTextureMap : public IExportEntity
{
public:
/*! The name of the TextureMap as seen in the material editor/material browser.
\returns The name of the texture map
*/
virtual TCHAR * GetTextureName() = 0;
//!Provide access to the actual max definition
/*! This allows the developer to get hold of extra data such as Texture Transforms, specified from the
Coordinates rollout. You can use the max method of GetUVGen or GetXYZGen for more advanced access
\return A pointer to a max class Texmap
*/
virtual Texmap * GetMaxTexmap() = 0;
//!Access to the Coordinate Rollout
/*!If the developer needs access to the transforms applied to the texture, then this can be accessed here.
\returns A pointer to IGameUVGen
*/
virtual IGameUVGen * GetIGameUVGen()=0;
//! This returns the slot that the bitmap was found in.
/*! It uses the standard Max convention ID_BU for bump etc.. If this is -1 then it means either the hosting material
was not a standard material and the channel conversion could not be performed based on the active shader.
\return the Slot definition. This can be -1 signifying an unsupported material.
*/
virtual int GetStdMapSlot()=0;
//! The filename of the bitmap used by the Bitmap Texture
/*!
\return The name of bitmap file
*/
virtual TCHAR * GetBitmapFileName()=0;
//! Get the Clip U Data from a the Bitmap Texture
/*!
\return A pointer to IGameProperty
*/
virtual IGameProperty * GetClipUData()=0;
//! Get the Clip V Data from a the Bitmap Texture
/*!
\return A pointer to IGameProperty
*/
virtual IGameProperty * GetClipVData()=0;
//! Get the Clip H Data from a the Bitmap Texture
/*!
\return A pointer to IGameProperty
*/
virtual IGameProperty * GetClipHData()=0;
//! Get the Clip W Data from a the Bitmap Texture
/*!
\return A pointer to IGameProperty
*/
virtual IGameProperty * GetClipWData()=0;
};
//! class IGameBitmapTex
/*! An IGame wrapper class for basic Bitmap Texture access. Properties such as tiling are also provided
\sa IGameMaterial, IGameProperty
*/
/*
class IGameBitmapTex : public IExportEntity
{
public:
virtual BitmapTex* GetMaxBitmapTex()=0;
};
*/
//!simple wrapper for UVGen type data
/*!This is basically a helper class to access some data from the Coordinate Rollout panel. All data is extracted
from the paramblock, and access is provided by support methods that handle the Property Container Access. This data
is used to extract the actual Matrix used. However it can be animated, so using this data the matrix can be recontructed.
\sa IGameBitmapTex, IGameProperty
*/
class IGameUVGen : public IExportEntity
{
public:
//! Get the U Offset Data
/*!
\return A pointer to IGameProperty
*/
virtual IGameProperty * GetUOffsetData() = 0;
//! Get the V Offset Data
/*!
\return A pointer to IGameProperty
*/
virtual IGameProperty * GetVOffsetData() = 0;
//! Get the U Tiling Data
/*!
\return A pointer to IGameProperty
*/
virtual IGameProperty * GetUTilingData() = 0;
//! Get the V Tiling Data
/*!
\return A pointer to IGameProperty
*/
virtual IGameProperty * GetVTilingData() = 0;
//! Get the U Angle Data
/*!
\return A pointer to IGameProperty
*/
virtual IGameProperty * GetUAngleData() = 0;
//! Get the V Angle Data
/*!
\return A pointer to IGameProperty
*/
virtual IGameProperty * GetVAngleData() = 0;
//! Get the W Angle Data
/*!
\return A pointer to IGameProperty
*/
virtual IGameProperty * GetWAngleData() = 0;
//! Get the actual UV transform.
/*! The UV transform that is the result of the Coordinate data.
\returns A GMatrix representation of the matrix
*/
virtual GMatrix GetUVTransform() = 0;
};
#endif

View File

@ -0,0 +1,282 @@
/**********************************************************************
*<
FILE: IGameModifier.h
DESCRIPTION: Modifier interfaces for IGame
CREATED BY: Neil Hazzard, Discreet
HISTORY: created 02/02/02
IGame Version: 1.122
*> Copyright (c) 2002, All Rights Reserved.
**********************************************************************/
/*!\file IGameModifier.h
\brief IGame Modifier Interfaces including direct access skin,physique and the morphing based operators.
High level access to MAX's modifier, with specific exposure for Skin and Morph modifiers. This includes the Morph compound object
*/
#ifndef __IGAMEMODIFIER__H
#define __IGAMEMODIFIER__H
#pragma once
#include "max.h"
#include "IGameProperty.h"
#include "IConversionManager.h"
class IGameProperty;
class IGameNode;
//!Simple wrapper for max modifiers
/*! This is an IGame wrapper for the basic max modifier class. This is provided so that the developer does not need
to walk the modifier stack and look for derived objects. An instance of this class is obtained from IGameObject class
\sa IGameObject
*/
class IGameModifier : public IExportEntity
{
private:
Modifier * gameMod;
INode * gameNode;
TSTR intName;
public:
//! An enum of Modifier Types
/*! These are the modifier known to IGame
*/
enum ModType{
IGAME_SKINNING, /*!<A skinning Modifier*/
IGAME_MORPHER, /*!<A Morphing based Modifier/Object*/
IGAME_GENERAL, /*!<A generic Max modifier*/
};
IGameModifier(Modifier * mod, INode * node);
/*! Return the Type of Modifier IGameModifier represents
\return The modifier type This is value from the ModType Enum
*/
virtual ModType GetModifierType() =0;
//!Get the modifier Name
/*!The name as viewed in StackView
\return The name
*/
virtual TCHAR * GetUIName() ;
//!Get the modifier Name
/*!The internal name of the modifier
\return The name
*/
virtual TCHAR * GetInternalName() ;
//! Access to the max modifier
/*! This is provided so the developer can get to any LocalModData that may have been added to the modifier
\return The pointer a standard max modifier.
*/
virtual Modifier * GetMaxModifier();
//! Access to the nodes this modifier is applied to,
/*! This enumerates all the nodes that are effected by this modifier.
\param &nodeList The tab to receive the node list. This will always be at least 1 in size, as it will contain the
original node.
*/
virtual void EffectedNodes(Tab<INode*> &nodeList);
//! Defines whether the modifier is a skinning modifier
/*!
\return TRUE if the modifier is a skinning modifier
*/
virtual bool IsSkin();
//! Defines whether the modifier is the morpher modifier
/*!
\return TRUE if the modifier is the morpher modifier
*/
virtual bool IsMorpher();
virtual ~IGameModifier();
};
//! A skin wrapper Class
/*! This class provides an unified interface to the various skin options present in Max. This include Physique and Skin
All the data from skin and physique are stored in the same way, but options exist to find out what skinning option was used
The vertex indexes used here are the same as those for the actual mesh, so this provides a one to one corelation.
\n
The version of the Character Studio that is used for IGame is 3.2.1 - Anything earlier will cause problems
\n
NB: The bones need to be parsed by IGame before this interface can be used.
\sa IGameModifier
*/
class IGameSkin : public IGameModifier
{
public:
//! An enum of Skin Modifier Types
/*! These are the Skin modifiers known to IGame
*/
enum SkinType{
IGAME_PHYSIQUE, /*!<A Physique Modifier*/
IGAME_SKIN, /*!<A Max skin Modifier*/
};
//! An enum of Vertex types
/*! These are the types used by the modifiers
*/
enum VertexType{
IGAME_RIGID, /*!<A RIGID vertex*/
IGAME_RIGID_BLENDED, /*!<A BLENED vertex*/
IGAME_UNKNOWN /*!<Error or unsupported vertex*/
};
//! the numbers of vertices effected by this instance of the modifier.
/*! If the modifier is attached to more than one node, then this will be the count of vertices on the current node
\return the number of vertices
*/
virtual int GetNumOfSkinnedVerts()=0;
//! the numbers of bones effecting the vertex
/*!
\param vertexIndex The index of the vertex
\return the number of bones
*/
virtual int GetNumberOfBones(int vertexIndex)= 0;
//! Get the weight for the bone and vertex index passed in
/*!
\param vertexIndex The index of the vertex
\param boneIndex The bone index
\return The weight
*/
virtual float GetWeight(int vertexIndex,int boneIndex) = 0;
//! Get the max bone effecting the vertex
/*!
\param vertexIndex The index of the vertex
\param boneIndex The bone index
\return A pointer to a max INode for the bone
*/
virtual INode * GetBone(int vertexIndex,int boneIndex)= 0;
//! Get the IGameNode equivalent of the bone effecting the vertex
/*!
\param vertexIndex The index of the vertex
\param boneIndex The bone index
\return A pointer to a IGameNode for the bone
*/
virtual IGameNode * GetIGameBone(int vertexIndex,int boneIndex)= 0;
//! Get the IGameNode ID equivalent of the bone effecting the vertex
/*! The IGameNode ID can be used if you pass out the nodes first
// and use this value as an index when you import
\param vertexIndex The index of the vertex
\param boneIndex The bone index
\return A Node ID
*/
virtual int GetBoneID(int vertexIndex, int boneIndex) =0;
//! Specifies whether the Vertex is either Rigid or blended
/*!
\param vertexIndex The vertex to query
\return The vertex type. It can be one of the following\n
IGAME_RIGID\n
IGAME_RIGID_BLENDED\n
*/
virtual VertexType GetVertexType(int vertexIndex)=0;
//! What skinning technique is used
/*! This can be used to find out whether Max's skin or Physique was used
\return The skinning type. It can be one of the following\n
IGAME_PHYSIQUE\n
IGAME_SKIN\n
*/
virtual SkinType GetSkinType()=0;
//! The bone TM when skin was added
/*! This provides access to the intial Bone TM when the skin modifier was applied.
\param boneNode THe IGameNode bone whose matrix is needed
\param &intMat THe matrix to receive the intial TM
\return True if the bone was found
*/
virtual bool GetInitBoneTM(IGameNode * boneNode, GMatrix &intMat)=0;
//! The bone TM when skin was added
/*! This provides access to the intial Bone TM when the skin modifier was applied.
\param boneNode The Max INode bone whose matrix is needed
\param &intMat The matrix to receive the intial TM
\return True if the bone was found
*/
virtual bool GetInitBoneTM(INode * boneNode, GMatrix &intMat)=0;
//! The original TM for the node with skin.
/*! This provides access to the intial node TM when the skin modifier was applied.
\param &intMat The matrix to receive the intial TM
*/
virtual void GetInitSkinTM(GMatrix & intMat) = 0;
IGameSkin(Modifier * mod, INode * node):IGameModifier(mod, node){};
};
//! An IGame wrapper around the Morph Compound Object and the Morpher Modifier
/*!
*/
class IGameMorpher : public IGameModifier
{
public:
//! A morph type enumeration
/*! This provides details about the type of morph operator being accessed
*/
enum MorphType{
MORPHER_OBJECT, /*!<A Morph Compound Object*/
MORPHER_MODIFIER, /*!<A Morph Modifier*/
};
//! The number of morph Targets
/*! The number of targets used by the morpher. There is a slight difference between the morph methods. The compound
morpher include the original object as a target, where as the morpher modifier only show the actual physical targets. So
to provide the same result the compound will show one more target
\returns The number of morph targets
*/
virtual int GetNumberOfMorphTargets() = 0;
//! The morph target used by the morpher
/*! This method provides the actual morph target used by the system. In the case of the compound object, it does its best to find the node
but, the compound morpher only exposes the actual "Object" and in max the object could have multiple nodes.
\param index The index of the target to retrieve
\returns An IGameNode representing the target
*/
virtual IGameNode * GetMorphTarget(int index) = 0;
//! The weight associated with the target
/*!
\param index The index of the target whose weight is being accessed
\returns An IGameControl os the keys. The actual value of the keys provides the weight value - this value can not be consider normalised
*/
virtual IGameControl * GetMorphWeight(int index)= 0;
//! The type of morpher represented by this interface - this can either be the Compound Morpher or the Morpher Modifier
virtual MorphType GetMorphType() = 0;
IGameMorpher(Modifier * mod, INode * node):IGameModifier(mod, node){};
};
//! A generic Modifier class
/*! Any modifier that is not known to IGame will be implemented as a "Generic" modifier, so that basic access can be provided
*/
class IGameGenMod : public IGameModifier
{
public:
IGameGenMod(Modifier * mod, INode * node):IGameModifier(mod, node){};
};
#endif

View File

@ -0,0 +1,905 @@
/**********************************************************************
*<
FILE: IGameObject.h
DESCRIPTION: Object interfaces for IGame
CREATED BY: Neil Hazzard, Discreet
HISTORY: created 02/02/02
IGame Version: 1.122
*> Copyright (c) 2002, All Rights Reserved.
**********************************************************************/
/*!\file IGameObject.h
\brief IGame supported Object Interfaces.
*/
#ifndef __IGAMEOBJECT__H
#define __IGAMEOBJECT__H
#pragma once
#include "Max.h"
#include "IGameProperty.h"
#define IGAMEEXPORT __declspec( dllexport )
class IGameNode;
class IGameModifier;
class IGameSkin;
//!Simple wrapper for max objects
/*! This is heart of the interaction with Max objects. Max objects are converted to IGame objects to provide
simpler interfaces. Specific support is given to Meshes, Splines, Helper (including bones) and Cameras. Any object
that is not supported by IGame directly is supported as a generic object, so that properties can be extracted easily. At the present time IGame only
supports Geom Objects that can be converted to a Tri Object.
\n
A note about XRef items. IGame will search out XRef Objects and performs the operations on the original Object, so any
modifiers will be extracted and the original object data such as mesh will be evaluated. Currently IGame does not support
the actual XRefObject in the scene, so external file names and proxies are not available.
\n
NB: Some of the interfaces returned by IGameObject require that the nodes be parsed by IGame first.
\sa IGameNode, IGameMesh, IGameLight, IGameCamera, IGameSupportObject
\sa IExportEntity
*/
class IGameObject : public IExportEntity
{
Tab <IGameModifier *> gameModTab;
Object * gameObject;
protected:
INode * gameNode;
void SetNode (INode * n);
public:
//!default constructor
IGameObject();
//! Various IGame Object types
/*! These are the objects supported by IGame
*/
enum ObjectTypes{
IGAME_UNKNOWN, /*!< An unknown object*/
IGAME_LIGHT, /*!< A Light Object */
IGAME_MESH, /*!< A Mesh Object */
IGAME_SPLINE, /*!< A Spline Object */
IGAME_CAMERA, /*!< A Camera Object */
IGAME_HELPER, /*!< A Helper Object */
IGAME_BONE, /*!< A Bone Object */
IGAME_IKCHAIN /*!< An IK Chain Object*/
};
//! Various Max Object types
/*! These are Max object - Developers can use this to cast the Object pointer to one of the relevent Max classes
*/
enum MaxType{
IGAME_MAX_UNKNOWN, /*!< An unknown object*/
IGAME_MAX_GEOM, /*!< A Geom Object*/
IGAME_MAX_SHAPE, /*!< A Shape Object*/
IGAME_MAX_LIGHT, /*!< A Light Object*/
IGAME_MAX_CAMERA, /*!< A Camera Object*/
IGAME_MAX_BONE, /*!< A Bone Object*/
IGAME_MAX_HELPER, /*!< A Helper Object*/
};
//! The bounding box
/*! The bounding box of the object
\param bb The box3 to receive the value
*/
IGAMEEXPORT void GetBoundingBox(Box3 & bb);
//!Is this object renderable
/*!
\return TRUE if it is renderable
*/
IGAMEEXPORT bool IsRenderable();
/*! Return the Type of IGameObject it represents
\return The object type This is value from the ObjectTypes Enum
*/
virtual ObjectTypes GetIGameType() =0;
//IGameObject();
/*! This provide access to the actual max object, if the developer wants further direct access
\return a pointer to a max Object class
*/
IGAMEEXPORT Object * GetMaxObject();
/*! This lets the developer know what type of object - Light, Geom, Helper etc...
This is different to the IGame types, as these may group more than one type of max object together
the information here can be used to cast Object returned from GetMaxObject to the appropriate class.
\return The type of max object. THis is defined as the MaxObject enum
*/
IGAMEEXPORT MaxType GetMaxType() ;
/*! The number of modifiers active on this object
\return The number of modifiers
*/
IGAMEEXPORT int GetNumModifiers();
/*! Get a pointer to the IGame representation of the modifier
\param index The index of the modifier to return
\return A pointer to the IGameModifier
*/
IGAMEEXPORT IGameModifier * GetIGameModifier(int index);
/*! The IGameObject constructor
\param *node The max node to initialise
*/
IGAMEEXPORT IGameObject(INode * node);
//! Does this object cast shadows
/*!
\return true if is casts shadows
*/
IGAMEEXPORT bool CastShadows();
/*! Is this object skinned with either Physique of Skin
\return TRUE if skinned
*/
IGAMEEXPORT bool IsObjectSkinned();
/*! Provide access to the skin interface
\return a pointer to IGameSkin or NULL if not present
*/
IGAMEEXPORT IGameSkin * GetIGameSkin();
/*! Is this an XRef Object. This will in future allow access to additional XRef data, but for now you just know
what you are getting
\returns TRUE if it is an XRef Object
*/
IGAMEEXPORT bool IsObjectXRef();
/*! Get the ObjectTM. This is the matric needed to calculated world space
\return A matrix containing the Object TM. Use this to calculate world space.
*/
IGAMEEXPORT GMatrix GetIGameObjectTM();
//! This will tell the object to extract the max data into IGame data
/*! Some extraction processes are time and memory consuming. This method allows the developer to specify when
they want the data to be converted - this prevents any unwanted data being converted. This is important for
IGameMesh class - if you are just after parameter data, you don't want the whole vertex array being sorted. Calling
this tells the object that you want the data converted.
\returns It will return FALSE when data has not been converted, this object should not be exported. Usually this is
due to a standin or in the case of a GeomObject, it can't be converted to a Tri Object.
*/
virtual bool InitializeData(){return false;}
virtual ~IGameObject() = 0;
};
//!Simple wrapper for light objects
/*! An IGame Wrapper around Max's lights. This is a generic interface for all the lights
*/
class IGameLight : public IGameObject {
public:
//! Various Light types used by Max
enum LightType{
IGAME_OMNI, /*!< Omnidirectional Light*/
IGAME_TSPOT, /*!< Targeted Spot Light*/
IGAME_DIR, /*!< Directional Light*/
IGAME_FSPOT, /*!< Free spot Light*/
IGAME_TDIR, /*!< Targeted Directional Light*/
};
//! Get the Light Color Data
/*!
\return A pointer to IGameProperty
*/
virtual IGameProperty * GetLightColor()=0;
//! Get the Light Multiplier Data
/*!
\return A pointer to IGameProperty
*/
virtual IGameProperty * GetLightMultiplier()=0;
//! Get the Light Attenuation End Data
/*!
\return A pointer to IGameProperty
*/
virtual IGameProperty * GetLightAttenEnd()=0;
//! Get the Light Attenuation Start Data
/*!
\return A pointer to IGameProperty
*/
virtual IGameProperty * GetLightAttenStart()=0;
//! Get the Light Falloff Data
/*!
\return A pointer to IGameProperty
*/
virtual IGameProperty * GetLightFallOff()=0;
//! Get the Light Hot spot Data
/*!
\return A pointer to IGameProperty
*/
virtual IGameProperty * GetLightHotSpot()=0;
//! Get the Aspect Ratio Data
/*!
\return A pointer to IGameProperty
*/
virtual IGameProperty * GetLightAspectRatio()=0;
//! Get the Light type as defined in the UI
/*!
\return the Light Type - This can be OMNI_LIGHT etc..
*/
virtual LightType GetLightType()=0;
/*! Does the light overshoot
\return TRUE if the light supports overshoot
*/
virtual int GetLightOvershoot()=0;
/*! The shape of the light
\return The shape can be one of the following
\n
RECT_LIGHT\n
CIRCLE_LIGHT\n
*/
virtual int GetSpotLightShape()=0;
/*! If the light is of type Spot light then this provides access to the target
\return a pointer to IGameNode for the target. This will be NULL for non target lights
*/
virtual IGameNode * GetLightTarget()=0;
/*! Is the light on or not
\return True if it is on
*/
virtual bool IsLightOn() = 0;
/*! This determines whether the exclude list actually maintains a list that is infact included by the light
\return TRUE if it maintains an included list
*/
virtual bool IsExcludeListReversed()=0;
/*! Get the number of excluded nodes from the light. This list contains nodes that should not be included in lighting
calculations. It can also contain a list of only those lights that SHOULD be included. This all depends on the state
of IsExcludedListReversed.
\return The total number of excluded nodes
*/
virtual int GetExcludedNodesCount() = 0;
/*! Get the excluded node based on the index pass in
\param index The index of the node to access
\return An IGameNode pointer for the excluded node
*/
virtual IGameNode * GetExcludedNode(int index) = 0;
};
//!Simple wrapper for camera objects
/*! An IGame Wrapper around Max's cameras. This is a generic interface for all the cameras
*/
class IGameCamera : public IGameObject {
public:
//! Get the Camera Field of View Data
/*!
\return A pointer to IGameProperty
*/
virtual IGameProperty * GetCameraFOV()=0;
//! Get the Camera Far Clip plane Data
/*!
\return A pointer to IGameProperty
*/
virtual IGameProperty * GetCameraFarClip()=0;
//! Get the Camera Near Clip plane Data
/*!
\return A pointer to IGameProperty
*/
virtual IGameProperty * GetCameraNearClip()=0;
//! Get the Camera Target Distance
/*!
\return A pointer to IGameProperty
*/
virtual IGameProperty * GetCameraTargetDist()=0;
/*! If the camera is target camera then this provides access to the target
\return a pointer to IGameNode for the target. This will be NULL for non target cameras
*/
virtual IGameNode * GetCameraTarget()=0;
};
//!Simple extension to the max Face class
/*!simple class to store extended data about the face. The indexing works as a regular
max Face but mirroring has been taken account of, in the construction.
*/
class FaceEx
{
public:
//! Index into the vertex array
DWORD vert[3];
//! Index into the standard mapping channel
DWORD texCoord[3];
//! Index into the normal array. <b>In 3ds max 6 and above this can be used to index the Binormal and Tangent arrays</b>\n
/*!
This is ONLY used if SetCreateOptimizedNormalArray() has been called.
*/
DWORD norm[3];
//! Index into the vertex color array
DWORD color[3];
//! Index into the vertex illumination array
DWORD illum[3];
//! Index into the vertex alpha array
DWORD alpha[3];
//! The smoothing group
DWORD smGrp;
//! The material ID of the face
int matID;
//! additional flags
DWORD flags;
//! index of corresponding face in the original mesh
int meshFaceIndex;
};
//!Simple wrapper for tri mesh objects
/*! An IGame wrapper around the standard max Mesh class. It provides unified support for Vertex colors and normals
Mirroring is taken into account so the data you retrieve is swapped to take this into account.\n
Many of the geometry lookups used by IGameObject use the Max Template Class Tab. You can use the Tab returned to find out whether the call
was successful as the Tab count would be greater then zero.\n
In 3ds max 6 and above version of IGame, Tangent space is calculated. For this to work, each face <b>must</b> be a member of a smoothing group.
*/
class IGameMesh: public IGameObject {
public:
//! Number of Vertices
/*! The total number of vertices found in the mesh
\return The number of Vertices
*/
virtual int GetNumberOfVerts()=0;
//! Number of Texture Vertices
/*! The total number of Texture vertices found in the mesh
\return The number of TextureVertices
*/
virtual int GetNumberOfTexVerts()=0;
//!Get the actual Vertex
/*! Get the vertex at the specified index. This is in the World Space Coordinate System
\param index The index of the vertex
\param ObjectSpace Defines whats space the vertex is in. This defaults to World space to be compatible
with previous versions \return A Point3 representing the position of the vertex
*/
virtual Point3 GetVertex(int index, bool ObjectSpace = false)=0;
//!Get the actual Vertex
/*! Get the vertex at the specified index. This is in the World Space Coordinate System
\param index The index of the vertex
\param &vert A Point3 to receive the data
\param ObjectSpace Defines whats space the vertex is in. This defaults to World space to be compatible
with previous versions
\return TRUE if successful
*/
virtual bool GetVertex(int index, Point3 & vert, bool ObjectSpace = false) = 0;
//!Get the actual Texture Vertex
/*! Get the Texture vertex at the specified index
\param index The index of the Texture vertex
\return A Point2 representing the Texture vertex
*/
virtual Point2 GetTexVertex(int index)=0;
//!Get the actual Texture Vertex
/*! Get the Texture vertex at the specified index
\param index The index of the Texture vertex
\param &tex A Point2 to receive the data.
\return TRUE if successful
*/
virtual bool GetTexVertex(int index, Point2 & tex) = 0;
//! Specifies whether normals are calculated based on face angles
/*! To tell IGame to calculate normals based on a weight made from the angle of the edges at the vertex, the developer
needs to call this <b><i>before</i></b> IGameObject::InitializeData() is called. The default is not to use weighted normals
which is also the default in 3ds max 4
*/
virtual void SetUseWeightedNormals() = 0;
//! Number of Normals
/*! The total number of normals found in the mesh
\return The number of normals
*/
virtual int GetNumberOfNormals()=0;
//!Get the actual normal
/*! Get the normal at the specified index.This is only available if SetCreateOptimizedNormalList()
has been set. IGame will return set an error, and return Point3(0,0,0);
\param index The index of the normal
\return A Point3 representing the normal
*/
virtual Point3 GetNormal(int index)=0;
//!Get the actual normal
/*! Get the normal at the specified index. This is only available if SetCreateOptimizedNormalList()
has been set. IGame will return set an error, and false will be returned
\param index The index of the normal
\param &norm A Point3 to receive the data.
\return TRUE if successful
*/
virtual bool GetNormal(int index, Point3 & norm) = 0;
//!Get the normal based on face and corner
/*!
\param faceIndex The index into the face array
\param corner The vertex whose normal is requested
\param &norm A point3 to receive the data
\return TRUE if successful
*/
virtual bool GetNormal(int faceIndex, int corner, Point3 & norm) = 0;
//!Get the normal based on face and corner
/*!
\param face The pointer of the face whose normals are to be accessed
\param corner The vertex whose normal is requested
\return A Point3 containing the normal
*/
virtual Point3 GetNormal ( FaceEx * face, int corner) = 0;
//!Get the normal based on face and corner
/*!
\param face The pointer of the face whose normals are to be accessed
\param corner The vertex whose normal is requested
\param &norm A point3 to receive the data
\return TRUE if successful
*/
virtual bool GetNormal(FaceEx * face, int corner, Point3 &norm) =0;
//!Get the normal based on face and corner
/*!
\param faceIndex The index into the face array
\param corner The vertex whose normal is requested
\return A Point3 containing the normal
*/
virtual Point3 GetNormal(int faceIndex, int corner) = 0;
//! Number of Illuminated Vertices
/*! The total number of Illuminated Vertices found in the mesh
\return The number of Illuminated Vertices
*/
virtual int GetNumberOfIllumVerts()=0;
//! Number of Alpha Vertices
/*! The total number of Alpha Vertices found in the mesh
\return The number of Alpha Vertices
*/
virtual int GetNumberOfAlphaVerts()=0;
//! Number of Vertex Colors
/*! The total number of Vertex Colors found in the mesh
\return The number of Vertex Colors
*/
virtual int GetNumberOfColorVerts()=0;
//!Get the actual Color Vertex
/*! Get the color vertex at the specified index
\param index The index of the color vertex
\return A Point3 representing the color of the vertex. This will be Point3(-1,-1,-1) if the index is invalid
*/
virtual Point3 GetColorVertex(int index)=0;
//!Get the actual Color Vertex
/*! Get the color vertex at the specified index
\param index The index of the color vertex
\param &col A Point3 to receive the color data
\return TRUE if successful
*/
virtual bool GetColorVertex(int index, Point3 & col) = 0;
//!Get the actual Alpha Vertex
/*! Get the Alpha vertex at the specified index
\param index The index of the Alpha vertex
\return A float representing the Alpha value of the vertex. This will be -1 if the index is invalid
*/
virtual float GetAlphaVertex(int index)=0;
//!Get the actual Alpha Vertex
/*! Get the Alpha vertex at the specified index
\param index The index of the Alpha vertex
\param &alpha A float to receive the value
\return TRUE if successful
*/
virtual bool GetAlphaVertex(int index, float & alpha) = 0;
//!Get the actual Illuminated Vertex
/*! Get the Illuminated vertex at the specified index
\param index The index of the Illuminated vertex
\return A float representing the Illuminated value of the vertex. This will be -1 if the index is invalid
*/
virtual float GetIllumVertex(int index)=0;
//!Get the actual Illuminated Vertex
/*! Get the Illuminated vertex at the specified index
\param index The index of the Illuminated vertex
\param &illum A float to receive the data
\return TRUE if successful
*/
virtual bool GetIllumVertex(int index, float &illum) = 0;
//! The num of faces in the mesh
/*! The total number of faces contained in the mesh
\return The number of faces
*/
virtual int GetNumberOfFaces()=0;
//! The actual face
/*! The face represented by the index. The data in FaceEx can be used to lookup into the various arrays
\param index The index of the face to return
\return A pointer to FaceEx, or NULL if an invalid index is passed in
*/
virtual FaceEx * GetFace(int index)=0;
//!The number of verts in a mapping channel
/*! Get the number of the vertices for a particular mapping channel
\param ch The mapping channel to use
\return The number of verts
*/
virtual int GetNumberOfMapVerts(int ch) = 0;
//! The mapping vert
/*! Get the actual mapping vert for the channel
\param ch The channel to query
\param index The vertex index
\return The actual mapping data. This will be zero if the Mapping channel is not found
*/
virtual Point3 GetMapVertex(int ch, int index) = 0;
//! The mapping vert
/*! Get the actual mapping vert for the channel
\param ch The channel to query
\param index The vertex index
\param &mVert A Point3 to receive the data
\return TRUE if successful
*/
virtual bool GetMapVertex(int ch, int index, Point3 & mVert) = 0;
//!The number of Binormals <b><i>This function is only available in 3ds max 6.0 and above</i></b>
/*! Get the number of the binormals
\return The number of binormals
*/
virtual int GetNumberOfBinormals() = 0;
//!Get the actual Binormal <b><i>This function is only available in 3ds max 6.0 and above</i></b>
/*! Get the Binormal at the specified index
\param index The index of the Binormal
\return A Point3 representing the Binormal
*/
virtual Point3 GetBinormal(int index)=0;
//!Get the actual Binormal <b><i>This function is only available in 3ds max 6.0 and above</i></b>
/*! Get the Binormal at the specified index
\param index The index of the Binormal
\param biNormal A point3 to receive the Binormal
\return TRUE if successful
*/
virtual bool GetBinormal(int index, Point3 & biNormal) = 0;
//!The number of Tangents <b><i>This function is only available in 3ds max 6.0 and above</i></b>
/*! Get the number of the Tangents
\return The number of Tangents
*/
virtual int GetNumberOfTangents() = 0;
//!Get the actual Tangent <b><i>This function is only available in 3ds max 6.0 and above</i></b>
/*! Get the Tangent at the specified index
\param index The index of the Tangent
\return A Point3 representing the Tangent
*/
virtual Point3 GetTangent(int index)=0;
//!Get the actual Tangent <b><i>This function is only available in 3ds max 6.0 and above</i></b>
/*! Get the Tangent at the specified index
\param index The index of the Tangent
\param Tangent A point3 to receive the Tangent
\return TRUE if successful
*/
virtual bool GetTangent(int index, Point3 & Tangent) = 0;
//! The the active mapping channels
/*! Extracts the active mapping channels in use by the object. This will not include the standard channels such as
Texture Coordinates and Vertex Colors, Illum, and Alpha.
\return A tab containing the active Mapping channels. The size of the Tab will be zero if no channels were found
*/
virtual Tab<int> GetActiveMapChannelNum() = 0;
//! Get the face index into the mapping channel array
/*! Get the actual index into the mapping channel for the supplied face.
\param ch The mapping channel to use
\param faceNum The face to use
\param index An array of three indices to receive the indexing into the vertices
\return TRUE if the channel was accessed correctly. False will mean that the channel was not present.
*/
virtual bool GetMapFaceIndex(int ch, int faceNum, DWORD *index) = 0;
//!Get all the smoothing groups found on a mesh
/*!
\return A tab containing the smoothing groups. If the count is zero it means that no smoothing groups were found
*/
virtual Tab<DWORD> GetActiveSmgrps() = 0;
//!Get all the material IDs found on a mesh
/*!
\return A tab containing the Material IDs
*/
virtual Tab<int> GetActiveMatIDs() = 0;
//!Get the face for a particular smoothing group
/*! Get all the faces belonging to a particular smoothing group
\param smgrp THe smoothing group to use
\return A tab containing all the faces
*/
virtual Tab<FaceEx *> GetFacesFromSmgrp(DWORD smgrp) = 0;
//!Get the face index for a particular smoothing group
/*! Get all the faces belonging to a particular smoothing group as a set of indexes into the main face list
\param smgrp THe smoothing group to use
\return A tab containing all the indexes
*/
virtual Tab<int> GetFaceIndexFromSmgrp(DWORD smgrp)=0;
//! Get the faces for a particular Material ID
/*! Get all the faces belonging to a particular material ID
\param matID The material ID to use
\return A tab containing all the faces
*/
virtual Tab<FaceEx *> GetFacesFromMatID(int matID) = 0;
//!The actual material used by the Face
/*!This will provide access to the material used by the Face whose index is passed in. This means the mesh can be broken down
into smaller meshes if the material is a subObject material. This can be used in conjunction with GetFacesFromMatID() to rebuild a face
with the material assigned via a material ID.
\param FaceNum The index of the face whose material is needed.
\returns A pointer to a material. The is the actual material, so in the case of the SubObject material the material whose mat ID
matches.
*/
virtual IGameMaterial * GetMaterialFromFace(int FaceNum) = 0;
//!The actual material used by the Face
/*!This will provide access to the material used by the Face. This means the mesh can be broken down
into smaller meshes if the material is a subObject material. This can be used in conjunction with GetFacesFromMatID() to rebuild a face
with the material assigned via a material ID.
\param face A pointer to the face whose material is needed.
\returns A pointer to a material. The is the actual material, so in the case of the SubObject material the material whose mat ID
matches.
*/
virtual IGameMaterial * GetMaterialFromFace(FaceEx * face) = 0;
//! The actual max Mesh representation
/*! The Mesh pointer used by max. This allows the developer further access if required to the mesh or data structures
\return A Mesh pointer
*/
virtual Mesh * GetMaxMesh()=0;
//! Access the color data for the face specified.
/*! The surface color can be obtained from the RenderedSurface interface. Before this function can be used the Surface
data needs to be initialised before hand. Please see the IGameRenderedSurface for more information
\param FaceIndex The face index whose color is being evaluated
\param *result A pointer to a Color Array that receives the 3 vertices for the face. This should initialised as Color res[3]
\return TRUE is successful. Possible errors include the object not being renderable or is hidden.
\sa IGameRenderedSurface
*/
virtual bool EvaluateSurface(int FaceIndex, Color * result) = 0;
//!Tell IGame to create a flattened Normals Array <b><i>This function is only available in 3ds max 6.0 and above</i></b>
/*!IGame can create a a flattened list of normals for export much like Vertices and Texture Coordinates. However this
operation can be expensive especially on large objects with mixed smoothing groups. This flag determines whether this is
available for use. <b>If it is not set, then vertex normals can only be looked up on a per face basis </b>.<br><br>
Due to some internal changes, this method is not really needed. However some builds of IGame did require it so it has
been kept in. This method should ideally "ALWAYS" be called so as to provide the full IGameMesh support.
*/
virtual void SetCreateOptimizedNormalList() = 0;
};
//!Simple wrapper for spline knots
/*! An IGame wrapper for Knot information
*/
class IGameKnot
{
public:
enum KnotType{
KNOT_AUTO, /*!< Auto generate Knot*/
KNOT_CORNER, /*!< A corner knot*/
KNOT_BEZIER, /*!< A bezier knot*/
KNOT_BEZIER_CORNER, /*!< A bezier corner knot*/
};
enum KnotData{
KNOT_INVEC, /*!< The in vector*/
KNOT_OUTVEC, /*!< The out vector*/
KNOT_POINT, /*!< The actual knot position*/
};
//! Get the in vector
/*!
\return the in vector
*/
virtual Point3 GetInVec()=0;
//! Get the out vector
/*!
\return the out vector
*/
virtual Point3 GetOutVec()=0;
//! Get actual knot position
/*!
\return The knot position
*/
virtual Point3 GetKnotPoint()=0;
//! The type of knot
/*!
\return The knot as a KnotType
*/
virtual KnotType GetKnotType()=0;
//! The knot controller
/*! Get the actual IGameController for the knot - this provides access to any animated data
\param kd THe knot to access
\return The controller for the specified knot
*/
virtual IGameControl * GetKnotControl(KnotData kd)=0;
};
//! A wrapper class for splines
/*! This provides information about the actual splines making up the spline object in Max. Access to the knot data is
provided with this class
*/
class IGameSpline3D
{
public:
//! Access the individual knot
/*!
\return The knot for the index passed in
*/
virtual IGameKnot * GetIGameKnot(int index) = 0;
//! The knot count
/*!
\return The total number of knots in the spline
*/
virtual int GetIGameKnotCount()=0;
};
//!Simple wrapper for Splines
/*! An IGame wrapper around the standard Max spline object. IGameSpline acts as a container for all the individual splines
that make up the object
*/
class IGameSpline : public IGameObject
{
public:
//! The number of splines
/*! The number of splines that make up this object
\return The total number of splines
*/
virtual int GetNumberOfSplines()=0;
//! Get an individual Spline
/*! Get a spline based on the index.
\param index The index of the spline to access
\return a pointer to the spline.
*/
virtual IGameSpline3D * GetIGameSpline3D(int index) =0;
//! Get the Max object
/*!
\return The ShapeObject used by max
*/
virtual ShapeObject * GetMaxShape()=0;
// IGameSpline(INode * node) : IGameObject(node){};
};
//!Simple wrapper for IKChains
/*! An IGame wrapper around the IKChain object.
\br
This object be used as a basis for character export. All nodes used in the chain are maintained by the IGameIKChain
interface. This allows animation to be exported based on whether it is in IK or FK mode. If the IK is enabled then
the IGameControl retrieved from the IGameNode will be that of the End Effector for the chain. If it is in FK mode then
the IGameControl from the nodes in the chain would be used for the FK calculation.
*/
class IGameIKChain : public IGameObject
{
public:
//! The number of nodes that make up the chain
/*!
\return The number of nodes in the chain
*/
virtual int GetNumberofBonesinChain() =0;
//! Access to the n'th node in the chain
/*!
\param index The index of the node to access
\return An IGameNode representation of the node
*/
virtual IGameNode * GetIGameNodeInChain(int index) =0;
//! The swivel data
/*! The swivel data used in the IK calculation
\return The IGameProperty for the swivel data
*/
virtual IGameProperty * GetSwivelData() = 0;
//! The controller for the IK enable
/*! Access to the Enabled controller - this defines whether IK or FK are used. When IK the end effector
is used to control the transforms, in FK the individual nodes can be positioned independent of the effector
\return An IGameControl pointer for the Enabled controller. This controller does not have direct access, so
should be sampled using IGAME_FLOAT
*/
virtual IGameControl * GetIKEnabledController() = 0;
};
//! Base class for "support" objects, such as bone, helpers dummies etc..
/*!These types of objects are really supported for their parameter access. However a pointer
to the Mesh representation is provided if for example bone geometry is needed. This class can be used
to check for BONES, DUMMYS etc..
*/
class IGameSupportObject : public IGameObject
{
public:
//! Access to the mesh
/*! If required access to the mesh is provided here
\return A pointer to an IGameMesh object
*/
virtual IGameMesh * GetMeshObject() = 0;
//!Is the bone a funky r4 bone with wings ?
/*!
\return TRUE if it is an R4 bone.
*/
virtual bool PreR4Bone() = 0;
};
//! An interface into an XRef Object Currently not implemented
class IGameXRefObject : public IGameObject
{
public:
virtual TCHAR * GetOriginalFileName() = 0;
};
//! A Generic Object for IGame
/*! This object represents any object that is unknown to IGame - this could be a new pipeline object for example
It will return IGAME_UNKOWN for its ObjectTypes
*/
class IGameGenObject : public IGameObject
{
public:
virtual IPropertyContainer * GetIPropertyContainer()=0;
};
#endif

View File

@ -0,0 +1,255 @@
/**********************************************************************
*<
FILE: IGameProperty.h
DESCRIPTION: IGameProperty interfaces for IGame
CREATED BY: Neil Hazzard, Discreet
HISTORY: created 02/02/02
IGame Version: 1.122
*> Copyright (c) 2002, All Rights Reserved.
**********************************************************************/
#ifndef __IGAMEPROPERTY__H
#define __IGAMEPROPERTY__H
#pragma once
/*!\file IGameProperty.h
\brief IParamBlock and IParamBlock2 property access.
All properties found by IGame are stored as an IGameProperty. This gives developers a unified way of accessing
IParamBlock and IParamBlock2 based properties used in max
*/
enum PropType{
IGAME_UNKNOWN_PROP, /*!<Unkown property Type*/
IGAME_FLOAT_PROP, /*!<Property of Type float*/
IGAME_POINT3_PROP, /*!<Property of Type Point3*/
IGAME_INT_PROP, /*!<Property of Type int*/
IGAME_STRING_PROP, /*!<Property of Type TCHAR*/
IGAME_POINT4_PROP, /*!<Property of Type Point4*/
};
class IGameControl;
//!Main property definition
/*! IGameProperty provides a wrapper around the standard max ParamBlock system. It works for both
IParamBlock and IParamBlock2. It provides access to IGameControl and also data access for floats, ints, and Point3
It performs the type checking for you so the Paramblock system will not assert if you ask for the wrong data type
The properties the IGame stores are defined in the IGameProp.XML file. The data there is used to find the parameters
in the various paramblock hosted by the objects,
\n
The data is provided by look up from the IGameProperties.xml file. This provides the properties that IGame will look for in
its evaluation. This included User Properties and general Paramblock data.
*/
class IGameProperty
{
public:
//!The name of the Property
/*! This is the name defined in the XML file
\return The parameter name
*/
virtual TCHAR * GetName() =0;
//! Is the parameter a IParamBlock2 or not
/*!
\return TRUE if IParamBlock2 else it is a IParamBlock
*/
virtual bool IsPBlock2()=0;
//! Is is animated
/*! Use this to decided whether you want to access the controller
\return TRUE if animated
*/
virtual bool IsPropAnimated()=0;
//! The controller for the Property
/*!
\return A pointer to IGameContorl
*/
virtual IGameControl * GetIGameControl() =0;
//! Direct access to the IParamBlock2
/*! for those who like a little more control
\return a pointer to IParamBlock2
*/
virtual IParamBlock2 * GetMaxParamBlock2() =0;
//! Direct access to the IParamBlock
/*! for those who like a little more control
\return a pointer to IParamBlock
*/
virtual IParamBlock * GetMaxParamBlock() =0;
//! Is the parameter ParamBlock based
/*! Specifies whether this parameter is based on either IParamBlock, or IParamBlock2. This is useful as some IGameProperties
are based on Non paramblocks. For example node/user data is accessed as an IGame Property but in max has no Paramblock representation
\return TRUE if it is based on a either IParamBlock or IParamBlock2.
*/
virtual bool IsParamBlock()=0;
//! The data type of the Property
/*! This is used to find out the data type of the property. It is used so the correct GetPropertyValue method can be
used
\return The data type. This will be a value from PropType enumeration.
*/
virtual PropType GetType() =0;
//! Whether this is Parameter is directly supported and has a entry in the Properties file
/*! Uses this method to decide whether a property is directly supported via the XML file
\return True if it directly supported with access from the XML file
*/
virtual bool IsParameterSupported() = 0;
//! The index of the parameter
/*! The actual index of the parameter as used by the Paramblock system. This can be used for direct access to the
property from the parmblock container. This can be used for GetValue/SetValue calls.
\return The index in the parameter block
*/
virtual int GetParamBlockIndex() = 0;
//! Access to the actual Parameter Data
/*!
\param &f The float to receive the data
\param t The time to retrieve the value. If the default is used then the static frame is used. This is set by SetStaticFrame
\return TRUE if succesful
\sa IGameScene::SetStaticFrame
*/
virtual bool GetPropertyValue(float &f, TimeValue t=TIME_NegInfinity)=0;
//! Access to the actual Parameter Data
/*!
\param &i The int to receive the data
\param t The time to retrieve the value. If the default is used then the static frame is used. This is set by SetStaticFrame
\return TRUE if succesful
\sa IGameScene::SetStaticFrame
*/
virtual bool GetPropertyValue(int &i, TimeValue t=TIME_NegInfinity)=0;
//! Access to the actual Parameter Data
/*!
\param &p The Point3 to receive the data
\param t The time to retrieve the value. If the default is used then the static frame is used. This is set by SetStaticFrame
\return TRUE if succesful
\sa IGameScene::SetStaticFrame
*/
virtual bool GetPropertyValue(Point3 &p, TimeValue t=TIME_NegInfinity)=0;
//! Access to the actual Parameter Data <b><i>This function is only available in 3ds max 6.0 and above</i></b>
/*!
\param &p The Point4 to receive the data
\param t The time to retrieve the value. If the default is used then the static frame is used. This is set by SetStaticFrame
\return TRUE if succesful
\sa IGameScene::SetStaticFrame
*/
virtual bool GetPropertyValue(Point4 &p, TimeValue t=TIME_NegInfinity)=0;
//! Access to the actual Parameter Data -
/*!
\param v The TCHAR to receive the data
\param t The time to retrieve the value. If the default is used then the static frame is used. This is set by SetStaticFrame
\return TRUE if successful
\sa IGameScene::SetStaticFrame
*/
virtual bool GetPropertyValue(TCHAR*& v, TimeValue t=TIME_NegInfinity)=0;
};
//!Property Enumeration
/*! PropertyEnum allows a developer to define a callback for use with EnumerateProperties. It will be called for
every parameter stored in the system
*/
class PropertyEnum
{
public:
//! The call back function
/*! This is called for every property in the system, providing a way of stopping the enumeration if need be
\param *prop The actual property found
\return TRUE to stop the enumeration
*/
virtual bool Proc(IGameProperty* prop) = 0;
};
//! Property container
/*! This class provide an extension mechanism that IGame can use - an Entity is free to use them
the idea here, is that a developer can extend the properties that are "known" to IGame
this way the property can be retrieved directly by the developer. As it is "known" to
the developer the property type is also known and can be accessed directly
*/
class IPropertyContainer
{
public:
//! Property Access
/*!Using the unique ID in the XML file, the property can be queried directly
\param PropID The identifier used in the XML file
\return A pointer to IGameProperty if found - NULL if not
*/
virtual IGameProperty * QueryProperty(DWORD PropID) {return NULL;}
//! The number of Properties for the Entity
/*!
\return The number of properties found. The default is 0. This only counts the supported properties as defined
in the property file
*/
virtual int GetNumberOfProperties(){return 0;}
//!Direct Property Access
/*! The property can be accessed directly from the index provided from the XML file. You can use the IGame Editor to
write out the index for the properties as a Header file for easy access. This only works for Supported Parameters,
i.e. Properties found in the properties file
\param index The index of the property to return
\return A pointer to the IGameProperty. The default is NULL
*/
virtual IGameProperty * GetProperty(int index) {return NULL;}
//! Property Access
/*!Using the name in the XML file, the property can be queried directly
\param propName The name identifier used in the XML file
\return A pointer to IGameProperty if found The default is NULL
*/
virtual IGameProperty * QueryProperty(const TCHAR * propName) {return NULL;}
//!Enumerate the Properties
/*!All properties can be enumerated by using this method. A user defined callback is used to provide access to
the properties.
\param &Enum The callback object to use.
*/
virtual void EnumerateProperties(PropertyEnum & Enum) = 0;
};
//!Main property access
/*!base Class used by all exporters wanting to take part in the properties system
*/
class IExportEntity
{
public:
//!Retrieve the Property Container
/*!
\return The PropertyContainer for this entity.
*/
virtual IPropertyContainer * GetIPropertyContainer(){return NULL;}
//! Is the Entity directly supported
/*!IGame provides direct support for certain max object and materials. If the IGameProp.xml file
contains additional properties on unknown ClassIDs, for example a new Object then this method is used to find out whether IGame supports
them directly. IGame supports the standard material directly, i.e provides direct API calls to get the properties. If a material was
found that was not a standard material, then the parameters can be access by using the IGameProp file and the IPropertyContainer file.
\return TRUE if IGame supports the parameters for a particular ClassID directly through its API
*/
virtual bool IsEntitySupported() {return false;}
};
#endif

View File

@ -0,0 +1,70 @@
/**********************************************************************
*<
FILE: IGameRenderedSurface.h
DESCRIPTION: IGameRenderSurface interfaces for IGame. This interface
provide access to the lighting and color of an object at the face level.
Any IGame Object can provide access to the data calculated here. It uses
the same basic approach as the Vertex Color Utility
CREATED BY: Neil Hazzard, Discreet
HISTORY: created 12/11/02
IGame Version: 1.122
*> Copyright (c) 2002, All Rights Reserved.
**********************************************************************/
#ifndef __IGAMERENDERSURFACE__H
#define __IGAMERENDERSURFACE__H
#pragma once
/*!\file IGameRenderedSurface.h
\brief Access to the main render routines to calculate surface data such as Lighting and color.
Lighting and color can be calculated on a per face/vertex level. This data is the same technique that
the Apply Vertex color utility uses. The difference here is that you are provided the color independently of the
vertex color channel. THis leaves that channel for other data and provides more options at export time.
*/
#define EVAL_MAPS (1<<0)
#define EVAL_SHADOWS (1<<1)
//!class IGameRenderedSurface
/*! Access to the main render surface interface. Methods are available to setup the system and define the lighting models
used. Actual access to the data is provided through the IGameMesh class
*/
class IGameRenderedSurface
{
public:
enum LightingModel{
SHADED,
LIGHTING_ONLY,
SHADED_ONLY
};
//! Setup the database for rendering.
virtual bool InitialiseRenderedSurfaceData() = 0;
//! Clean it all up
virtual void ReleaseRenderedSurfaceData() = 0 ;
//! Define the type of model be used in the render
virtual void SetLightingModel(LightingModel lm) = 0;
//! Defines the usage of Maps and shadows
virtual void SetFlag(DWORD mask) = 0;
//! defines the usage of Maps and shadows
virtual void ClearFlag(DWORD mask) = 0;
};
//! Get the main interface pointer.
IGAMEEEXPORT IGameRenderedSurface *GetIGameRenderedSurfaceInterface();
#endif