Skip to content
Snippets Groups Projects
Commit f4fe4ce0 authored by Shon Ferguson's avatar Shon Ferguson
Browse files

Made some more DLL-related changes. The Maya plug-in now compiles (and works!) in DLL mode.

To allow for DLL mode, the IDENTITY constants in the Matrix classes were made private and are now accessible through the Identity() function of each matrix class.  This may affect the 3ds Max plug-in as well.
parent 5761aae3
No related branches found
No related tags found
No related merge requests found
......@@ -41,9 +41,9 @@ public:
*/
struct SkinInfluence {
/*! Constructor */
SkinInfluence() : influenceIndex(CS_NO_INDEX) {}
NIFLIB_API SkinInfluence() : influenceIndex(CS_NO_INDEX) {}
/*! Destructor */
~SkinInfluence() {}
NIFLIB_API ~SkinInfluence() {}
/*!
* Index into the ComplexShape::skinInfluences array of the bone
* influence for this skin weight.
......@@ -73,9 +73,9 @@ public:
*/
struct TexCoordIndex {
/*! Constructor */
TexCoordIndex() : texCoordSetIndex(CS_NO_INDEX), texCoordIndex(CS_NO_INDEX) {}
NIFLIB_API TexCoordIndex() : texCoordSetIndex(CS_NO_INDEX), texCoordIndex(CS_NO_INDEX) {}
/*! Destructor */
~TexCoordIndex() {}
NIFLIB_API ~TexCoordIndex() {}
/*!
* Index into the ComplexShape::texCoordSets array of texture
* coordinate sets.
......@@ -97,9 +97,9 @@ public:
*/
struct ComplexPoint {
/*! Constructor */
ComplexPoint() : vertexIndex(CS_NO_INDEX), normalIndex(CS_NO_INDEX), colorIndex(CS_NO_INDEX) {}
NIFLIB_API ComplexPoint() : vertexIndex(CS_NO_INDEX), normalIndex(CS_NO_INDEX), colorIndex(CS_NO_INDEX) {}
/*! Destructor */
~ComplexPoint() {}
NIFLIB_API ~ComplexPoint() {}
/*!
* Index into the ComplexShape::vertices array which stores the
* position and any associated skin weights for this point.
......@@ -131,9 +131,9 @@ public:
*/
struct ComplexFace {
/*! Constructor */
ComplexFace() : propGroupIndex(CS_NO_INDEX) {}
NIFLIB_API ComplexFace() : propGroupIndex(CS_NO_INDEX) {}
/*! Destructor */
~ComplexFace() {}
NIFLIB_API ~ComplexFace() {}
/*! A list of points which make up this polygon */
vector<ComplexPoint> points;
/*!
......@@ -172,7 +172,7 @@ public:
* information.
* \return A referene to the root NiAVObject that was created.
*/
Ref<NiAVObject> Split(
NIFLIB_API Ref<NiAVObject> Split(
Ref<NiNode> & parent,
Matrix44 & transform,
int max_bones_per_partition = 4,
......@@ -188,32 +188,32 @@ public:
* or a NiNode that is a split mesh proxy.
* \sa NiNode::IsSplitMeshProxy
*/
void Merge( const Ref<NiAVObject> & root );
NIFLIB_API void Merge( const Ref<NiAVObject> & root );
/*
* Clears out all the data stored in this ComplexShape
*/
void Clear();
NIFLIB_API void Clear();
//Setters
void SetName( const string & n );
void SetVertices( const vector<WeightedVertex> & n );
void SetColors( const vector<Color4> & n );
void SetNormals( const vector<Vector3> & n );
void SetTexCoordSets( const vector<TexCoordSet> & n );
void SetFaces( const vector<ComplexFace> & n );
void SetPropGroups( const vector< vector< Ref<NiProperty> > > & n );
void SetSkinInfluences( const vector< Ref<NiNode> > & n );
NIFLIB_API void SetName( const string & n );
NIFLIB_API void SetVertices( const vector<WeightedVertex> & n );
NIFLIB_API void SetColors( const vector<Color4> & n );
NIFLIB_API void SetNormals( const vector<Vector3> & n );
NIFLIB_API void SetTexCoordSets( const vector<TexCoordSet> & n );
NIFLIB_API void SetFaces( const vector<ComplexFace> & n );
NIFLIB_API void SetPropGroups( const vector< vector< Ref<NiProperty> > > & n );
NIFLIB_API void SetSkinInfluences( const vector< Ref<NiNode> > & n );
//Getters
string GetName() const;
vector<WeightedVertex> GetVertices() const;
vector<Color4> GetColors() const;
vector<Vector3> GetNormals() const;
vector<TexCoordSet> GetTexCoordSets() const;
vector<ComplexFace> GetFaces() const;
vector< vector< Ref<NiProperty> > > GetPropGroups() const;
vector< Ref<NiNode> > GetSkinInfluences() const;
NIFLIB_API string GetName() const;
NIFLIB_API vector<WeightedVertex> GetVertices() const;
NIFLIB_API vector<Color4> GetColors() const;
NIFLIB_API vector<Vector3> GetNormals() const;
NIFLIB_API vector<TexCoordSet> GetTexCoordSets() const;
NIFLIB_API vector<ComplexFace> GetFaces() const;
NIFLIB_API vector< vector< Ref<NiProperty> > > GetPropGroups() const;
NIFLIB_API vector< Ref<NiNode> > GetSkinInfluences() const;
private:
vector<WeightedVertex> vertices;
......
......@@ -316,8 +316,8 @@ struct NIFLIB_API Float2 {
/*! Stores a 2 by 2 matrix used for bump maps. */
struct Matrix22 {
/*! The 2x2 identity matrix */
static const Matrix22 IDENTITY;
/*! Get the 2x2 identity matrix */
NIFLIB_API static const Matrix22 & Identity();
Float2 rows[2]; /*!< The two rows of Float2 structures which hold two floating point numbers each. */
......@@ -372,6 +372,9 @@ struct Matrix22 {
throw std::out_of_range("Index out of range for MatrixRow3");
return rows[n];
}
private:
/*! The 2x2 identity matrix constant */
static const Matrix22 IDENTITY;
};
/* Stores three floating point numbers. Used as a row of a Matrix33 and to store the data in attr_vector3 and attr_color3 type attributes. */
......@@ -432,8 +435,8 @@ struct NIFLIB_API Float3 {
/*! Stores a 3 by 3 matrix used for rotation. */
struct Matrix33 {
/*! The 3x3 identity matrix */
static const Matrix33 IDENTITY;
/*! Returns the 3x3 identity matrix */
NIFLIB_API static const Matrix33 & Identity();
Float3 rows[3]; /*!< The three rows of Float3 structures which hold three floating point numbers each. */
......@@ -521,6 +524,10 @@ struct Matrix33 {
throw std::out_of_range("Index out of range for MatrixRow3");
return rows[n];
}
private:
/*! The 3x3 identity matrix constant*/
static const Matrix33 IDENTITY;
};
......@@ -586,8 +593,8 @@ struct NIFLIB_API Float4 {
/*! Stores a 4 by 4 matrix used for combined transformations. */
struct Matrix44 {
/*! The 4x4 identity matrix */
static const Matrix44 IDENTITY;
/*! Returns the 4x4 identity matrix */
NIFLIB_API static const Matrix44 & Identity();
Float4 rows[4]; /*!< The three rows of Float3 structures which hold three floating point numbers each. */
......@@ -808,6 +815,9 @@ struct Matrix44 {
throw std::out_of_range("Index out of range for Matrix44");
return rows[n];
}
/*! The 4x4 identity matrix constant */
static const Matrix44 IDENTITY;
};
/*! Stores a color along with alpha translucency */
......@@ -941,17 +951,17 @@ struct NIFLIB_API Quaternion {
//These operators cause SWIG warnings
#ifndef SWIG
ostream & operator<<( ostream & out, TexCoord const & val );
ostream & operator<<( ostream & out, Triangle const & val );
ostream & operator<<( ostream & out, Vector3 const & val );
ostream & operator<<( ostream & out, Float2 const & val );
ostream & operator<<( ostream & out, Matrix22 const & val );
ostream & operator<<( ostream & out, Float3 const & val );
ostream & operator<<( ostream & out, Matrix33 const & val );
ostream & operator<<( ostream & out, Float4 const & val );
ostream & operator<<( ostream & out, Color3 const & val );
ostream & operator<<( ostream & out, Color4 const & val );
ostream & operator<<( ostream & out, Quaternion const & val );
NIFLIB_API ostream & operator<<( ostream & out, TexCoord const & val );
NIFLIB_API ostream & operator<<( ostream & out, Triangle const & val );
NIFLIB_API ostream & operator<<( ostream & out, Vector3 const & val );
NIFLIB_API ostream & operator<<( ostream & out, Float2 const & val );
NIFLIB_API ostream & operator<<( ostream & out, Matrix22 const & val );
NIFLIB_API ostream & operator<<( ostream & out, Float3 const & val );
NIFLIB_API ostream & operator<<( ostream & out, Matrix33 const & val );
NIFLIB_API ostream & operator<<( ostream & out, Float4 const & val );
NIFLIB_API ostream & operator<<( ostream & out, Color3 const & val );
NIFLIB_API ostream & operator<<( ostream & out, Color4 const & val );
NIFLIB_API ostream & operator<<( ostream & out, Quaternion const & val );
#endif
......
......@@ -76,8 +76,8 @@ public:
NIFLIB_API void AddProperty( const Ref<NiProperty> & obj );
NIFLIB_API void RemoveProperty( Ref<NiProperty> obj );
NIFLIB_API void ClearProperties();
vector< Ref<NiProperty> > GetProperties() const;
Ref<NiProperty> GetPropertyByType( const Type & compare_to );
NIFLIB_API vector< Ref<NiProperty> > GetProperties() const;
NIFLIB_API Ref<NiProperty> GetPropertyByType( const Type & compare_to );
NIFLIB_API unsigned short GetFlags() const;
NIFLIB_API void SetFlags( unsigned short n );
......
......@@ -32,56 +32,54 @@ public:
NIFLIB_HIDDEN virtual void FixLinks( const map<unsigned int,NiObjectRef> & objects, list<unsigned int> & link_stack, unsigned int version, unsigned int user_version );
NIFLIB_HIDDEN virtual list<NiObjectRef> GetRefs() const;
enum BlendMode
{
BM_ONE = 0x00,
BM_ZERO = 0x01,
BM_SRC_COLOR = 0x02,
BM_ONE_MINUS_SRC_COLOR = 0x03,
BM_DST_COLOR = 0x04,
BM_ONE_MINUS_DST_COLOR = 0x05,
BM_SRC_ALPHA = 0x06,
BM_ONE_MINUS_SRC_ALPHA = 0x07,
BM_DST_ALPHA = 0x08,
BM_ONE_MINUS_DST_ALPHA = 0x08,
BM_SRC_ALPHA_SATURATE = 0x09,
};
enum TestMode
{
TM_ALWAYS = 0x00,
TM_LESS = 0x01,
TM_EQUAL = 0x02,
TM_LEQUAL = 0x03,
TM_GREATER = 0x04,
TM_NOTEQUAL = 0x05,
TM_GEQUAL = 0x06,
TM_NEVER = 0x07,
};
BlendMode GetSourceBlendMode() const;
void SetSourceBlendMode(BlendMode value);
BlendMode GetDestBlendMode() const;
void SetDestBlendMode(BlendMode value);
TestMode GetTestMode() const;
void SetTestMode(TestMode value);
bool GetAlphaBlend() const;
void SetAlphaBlend(bool value);
bool GetAlphaTest() const;
void SetAlphaTest(bool value);
bool GetAlphaSort() const;
void SetAlphaSort(bool value);
unsigned short GetFlags() const;
void SetFlags( unsigned short n );
byte GetAlphaTestThreshold() const;
void SetAlphaTestThreshold( byte n );
enum BlendMode {
BM_ONE = 0x00,
BM_ZERO = 0x01,
BM_SRC_COLOR = 0x02,
BM_ONE_MINUS_SRC_COLOR = 0x03,
BM_DST_COLOR = 0x04,
BM_ONE_MINUS_DST_COLOR = 0x05,
BM_SRC_ALPHA = 0x06,
BM_ONE_MINUS_SRC_ALPHA = 0x07,
BM_DST_ALPHA = 0x08,
BM_ONE_MINUS_DST_ALPHA = 0x08,
BM_SRC_ALPHA_SATURATE = 0x09,
};
enum TestMode {
TM_ALWAYS = 0x00,
TM_LESS = 0x01,
TM_EQUAL = 0x02,
TM_LEQUAL = 0x03,
TM_GREATER = 0x04,
TM_NOTEQUAL = 0x05,
TM_GEQUAL = 0x06,
TM_NEVER = 0x07,
};
NIFLIB_API BlendMode GetSourceBlendMode() const;
NIFLIB_API void SetSourceBlendMode(BlendMode value);
NIFLIB_API BlendMode GetDestBlendMode() const;
NIFLIB_API void SetDestBlendMode(BlendMode value);
NIFLIB_API TestMode GetTestMode() const;
NIFLIB_API void SetTestMode(TestMode value);
NIFLIB_API bool GetAlphaBlend() const;
NIFLIB_API void SetAlphaBlend(bool value);
NIFLIB_API bool GetAlphaTest() const;
NIFLIB_API void SetAlphaTest(bool value);
NIFLIB_API bool GetAlphaSort() const;
NIFLIB_API void SetAlphaSort(bool value);
NIFLIB_API unsigned short GetFlags() const;
NIFLIB_API void SetFlags( unsigned short n );
NIFLIB_API byte GetAlphaTestThreshold() const;
NIFLIB_API void SetAlphaTestThreshold( byte n );
protected:
NI_ALPHA_PROPERTY_MEMBERS
private:
......
......@@ -19,10 +19,10 @@ typedef Ref<NiMaterialProperty> NiMaterialPropertyRef;
class NiMaterialProperty : public NI_MATERIAL_PROPERTY_PARENT {
public:
NiMaterialProperty();
~NiMaterialProperty();
NIFLIB_API NiMaterialProperty();
NIFLIB_API ~NiMaterialProperty();
//Run-Time Type Information
static const Type & TypeConst() { return TYPE; }
NIFLIB_API static const Type & TypeConst() { return TYPE; }
private:
static const Type TYPE;
public:
......
......@@ -68,9 +68,9 @@ public:
NIFLIB_HIDDEN virtual void FixLinks( const map<unsigned int,NiObjectRef> & objects, list<unsigned int> & link_stack, unsigned int version, unsigned int user_version ) {}
//Reference Counting
NIFLIB_HIDDEN void AddRef() const; //Should not be called directly
NIFLIB_HIDDEN void SubtractRef() const; //Should not be called directly
NIFLIB_HIDDEN unsigned int GetNumRefs() { return _ref_count; }
NIFLIB_API void AddRef() const; //Should not be called directly
NIFLIB_API void SubtractRef() const; //Should not be called directly
NIFLIB_API unsigned int GetNumRefs();
/*! Returns A new object that contains all the same data that this object does,
* but occupies a different part of memory. The data stored in a NIF file varies
......
......@@ -12,13 +12,25 @@ const Matrix44 Matrix44::IDENTITY( 1.0f, 0.0f, 0.0f, 0.0f,
0.0f, 0.0f, 1.0f, 0.0f,
0.0f, 0.0f, 0.0f, 1.0f );
const Matrix44 & Matrix44::Identity() {
return IDENTITY;
};
const Matrix33 Matrix33::IDENTITY( 1.0f, 0.0f, 0.0f,
0.0f, 1.0f, 0.0f,
0.0f, 0.0f, 1.0f );
const Matrix33 & Matrix33::Identity() {
return IDENTITY;
};
const Matrix22 Matrix22::IDENTITY( 1.0f, 0.0f,
0.0f, 1.0f );
const Matrix22 & Matrix22::Identity() {
return IDENTITY;
};
/* TexCoord Methods
*
*/
......
......@@ -98,4 +98,8 @@ NiObjectRef NiObject::Clone( unsigned int version, unsigned int user_version ) {
const Type & NiObject::GetType() const {
return TYPE;
};
\ No newline at end of file
};
unsigned int NiObject::GetNumRefs() {
return _ref_count;
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment