⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 icezcbbreaker.h

📁 使用stl技术,(还没看,是听说的)
💻 H
📖 第 1 页 / 共 2 页
字号:
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
 *	Contains code to import ZCB files.
 *	\file		IceZCBBreaker.h
 *	\author		Pierre Terdiman
 *	\date		April, 4, 2000
 */
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/*
  Usage:
  1) Use ZCBBreaker as a base class and override all app-dependent methods. They'll get called during the import.
  2) Call the Import(filename) method.

  That's it!
  ...poorly designed, but does the job...
*/

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Include Guard
#ifndef __ICEZCBBREAKER_H__
#define __ICEZCBBREAKER_H__

	#ifndef ICERENDERMANAGER_API
	#define ICERENDERMANAGER_API
	#endif

	enum ZCBError
	{
		ZCB_ERROR_OK				= 0,
		ZCB_ERROR_FILE_NOT_FOUND	= 1,
		ZCB_ERROR_OUT_OF_MEMORY		= 2,
		ZCB_ERROR_INVALID_FILE		= 3,
		ZCB_ERROR_CANT_DEPACK		= 4,
		ZCB_ERROR_UNKNOWN_VERSION	= 5,
		ZCB_ERROR_CHUNK_NOT_FOUND	= 6,
		ZCB_ERROR_OBSOLETE_FILE		= 7,

		ZCB_ERROR_FORCE_DWORD		= 0x7fffffff
	};

	class ICERENDERMANAGER_API ZCBComponents
	{
		public:
		// Constructor/Destructor
									ZCBComponents();
		virtual						~ZCBComponents();
		// ZCB file components
				udword				mNbMeshes;			//!< Number of geomobjects (meshes) found
				udword				mNbDerived;			//!< Number of derived objects found (actually number of skins)
				udword				mNbCameras;			//!< Number of cameras found
				udword				mNbLights;			//!< Number of lights found
				udword				mNbShapes;			//!< Number of shapes found
				udword				mNbHelpers;			//!< Number of helpers found
				udword				mNbControllers;		//!< Number of controllers found
				udword				mNbMaterials;		//!< Number of materials found
				udword				mNbTextures;		//!< Number of textures found
				udword				mNbUnknowns;		//!< Number of unknown nodes found
				udword				mNbInvalidNodes;	//!< Number of invalid nodes found
	};

	class ICERENDERMANAGER_API ZCBSceneInfo : public ZCBComponents
	{
		public:
		// Constructor/Destructor
									ZCBSceneInfo();
		virtual						~ZCBSceneInfo();
		// Time-related info
				udword				mFirstFrame;		//!< Timeline's first frame number
				udword				mLastFrame;			//!< Timeline's last frame number
				udword				mFrameRate;			//!< Global frame rate
				udword				mDeltaTime;			//!< Ticks per frame
		// Environment
				Point				mBackColor;			//!< Background color
				Point				mAmbientColor;		//!< Global ambient color
		// Scene info
				String				mSceneInfo;			//!< The scene information string
				String				mSceneHelpText;		//!< A possible help string (describing controls for current scene, etc)
				udword				mTesselation;		//!< Global scene tesselation
				udword				mLightingMode;		//!< Scene lighting mode
		// Scene physics
				Point				mGravity;			//!< Global world gravity
				float				mRestitution;		//!< Global world restitution
				float				mStaticFriction;	//!< Global world static friction
				float				mFriction;			//!< Global world friction
				bool				mGroundPlane;		//!< Use a ground plane or not
				bool				mCollisionDetection;//!< Allow/ban collision detection
		// Global scale
				float				mGlobalScale;		//!< Global scaling used for exporting
	};

	class ICERENDERMANAGER_API ZCBBaseInfo
	{
		public:
		// Constructor/Destructor
									ZCBBaseInfo();
		virtual						~ZCBBaseInfo();

		// Database information
				String				mName;				//!< Object's name
				sdword				mID;				//!< Object's ID
				sdword				mParentID;			//!< Parent's ID
				sdword				mTargetID;			//!< Target ID
				sdword				mMasterID;			//!< Master ID
				bool				mGroup;				//!< true if the object belongs to a group
				bool				mIsHidden;			//!< true if the object was hidden
		// Position/Rotation/Scale = PRS
				PRS					mPrs;
		// Pivot
				Point				mPivotPos;			//!< Global position
				Quat				mPivotRot;			//!< Global rotation
		// Rendering information
				udword				mWireColor;			//!< The wireframe color
				bool				mLocalPRS;			//!< true for local PRS
				bool				mD3DCompliant;		//!< true if converted to D3D frame
		// User properties
				String				mUserProps;			//!< The user-defined properties
		// Extra physics properties
				float				mDensity;
				float				mMass;
				udword				mSamplingDensity;
				bool				mResetPivot;
				bool				mIsCollidable;
				bool				mLockPivot;

				bool				Import(CustomArray& importer);
	};

	class ICERENDERMANAGER_API ZCBCameraInfo : public ZCBBaseInfo
	{
		public:
		// Constructor/Destructor
									ZCBCameraInfo();
		virtual						~ZCBCameraInfo();

		// Camera parameters
				ZCBCameraType		mType;					//!< Camera type
				bool				mOrthoCam;				//!< Camera type: ortographic (true) or perspective (false)
				float				mFOV;					//!< Field-Of-View (degrees) or Width for ortho cams		[Animatable]
				ZCBFOVType			mFOVType;				//!< FOV Type
				float				mNearClip;				//!< Near/hither clip										[Animatable]
				float				mFarClip;				//!< Far/yon clip											[Animatable]
				float				mTDist;					//!< Distance to target										[Animatable]
				long				mHLineDisplay;			//!< Horizon Line Display
				float				mEnvNearRange;			//!< Environment near range									[Animatable]
				float				mEnvFarRange;			//!< Environment far range									[Animatable]
				long				mEnvDisplay;			//!< Environment display
				long				mManualClip;			//!< Manual clip
	};

	// NB: mIsSpot and mIsDir are dumped from MAX, but they may not match D3D's definitions...
	class ICERENDERMANAGER_API ZCBLightInfo : public ZCBBaseInfo
	{
		public:
		// Constructor/Destructor
									ZCBLightInfo();
		virtual						~ZCBLightInfo();

		// Light parameters
				ZCBLightType		mLightType;						//!< Light's type
				bool				mIsSpot;						//!< Is the light a spotlight?
				bool				mIsDir;							//!< Is the light a directional?
				Point				mColor;							//!< Light's color											[Animatable]
				float				mIntensity;						//!< Light's intensity										[Animatable]
				float				mContrast;						//!< Light's contrast										[Animatable]
				float				mDiffuseSoft;					//!< Light's diffuse soft									[Animatable]
				bool				mLightUsed;						//!< Is the light used?
				bool				mAffectDiffuse;					//!< Does the light affect diffuse?
				bool				mAffectSpecular;				//!< Does the light affect specular?
				bool				mUseAttenNear;					//
				bool				mAttenNearDisplay;				//
				bool				mUseAtten;						//!< Is attenuation used?
				bool				mShowAtten;						//
				float				mNearAttenStart;				//!< Near atten start										[Animatable]
				float				mNearAttenEnd;					//!< Near atten end											[Animatable]
				float				mAttenStart;					//!< Atten start											[Animatable]
				float				mAttenEnd;						//!< Atten end (use that as a range for non-dir lights)		[Animatable]
				char				mDecayType;						//!< Light's decay type
				float				mHotSpot;						//!< Light's hotspot										[Animatable]
				float				mFallsize;						//!< Light's falloff										[Animatable]
				float				mAspect;						//!< Light's aspect											[Animatable]
				ZCBSpotShape		mSpotShape;						//!< Light's spot shape
				long				mOvershoot;						//!< Light's overshoot
				bool				mConeDisplay;					//
				float				mTDist;							//!< Distance to target										[Animatable]
				long				mShadowType;					//!< Light's shadow type
				long				mAbsMapBias;					//!< Light's absolute map bias
				float				mRayBias;						//!< Raytrace bias											[Animatable]
				float				mMapBias;						//!< Map bias												[Animatable]
				float				mMapRange;						//!< Map range												[Animatable]
				long				mMapSize;						//!< Map size												[Animatable]
				bool				mCastShadows;					//!< Cast shadows
				float				mShadowDensity;					//!< Shadow density											[Animatable]
				Point				mShadowColor;					//!< Shadow color											[Animatable]
				bool				mLightAffectsShadow;			//!< Light affects shadow or not
				sdword				mProjMapID;						//!< Projector texture map
				sdword				mShadowProjMapID;				//!< Shadow projector texture map
	};

	//! A possible texture matrix.
	struct ICERENDERMANAGER_API TextureMatrix
	{
		TextureMatrix()
		{
			ZeroMemory(m, 3*4*sizeof(float));
			m[0][0] = m[1][1] = m[2][2] = 1.0f;
		}
		//! Warning: that's a direct dump from MAX (untransformed)
		float m[4][3];
	};

	//! Crop values. Useful for T-pages. Warning: equations to use them are weird.
	struct ICERENDERMANAGER_API TextureCrop
	{
		TextureCrop() : mOffsetU(0.0f), mOffsetV(0.0f), mScaleU(1.0f), mScaleV(1.0f)	{}

		float	mOffsetU;	//!< Offset for U
		float	mOffsetV;	//!< Offset for V
		float	mScaleU;	//!< Scale for U
		float	mScaleV;	//!< Scale for V
	};

	class ICERENDERMANAGER_API ZCBMaterialInfo
	{
		public:
		// Constructor/Destructor
									ZCBMaterialInfo();
		virtual						~ZCBMaterialInfo();

				bool				HasExtendedSelfIllum()	const
									{
										if(		mSelfIllumOn
											||	IR(mSelfIllumValue)
											||	IR(mSelfIllumColor.x)
											||	IR(mSelfIllumColor.y)
											||	IR(mSelfIllumColor.z)
											)
										return true;
										else return false;
									}
		// Database information
				String				mName;								//!< Material name
				sdword				mID;								//!< Material ID
		// Texture IDs
				sdword				mAmbientMapID;						//!< Ambient texture map (seems not to exist anymore in MAX 3)
				sdword				mDiffuseMapID;						//!< Diffuse texture map
				sdword				mSpecularMapID;						//!< Specular texture map
				sdword				mShininessMapID;					//!< Shininess texture map
				sdword				mShiningStrengthMapID;				//!< Shining Strength texture map
				sdword				mSelfIllumMapID;					//!< Self Illum texture map
				sdword				mOpacityMapID;						//!< Opacity texture map
				sdword				mFilterMapID;						//!< Filter texture map
				sdword				mBumpMapID;							//!< Bump texture map
				sdword				mReflexionMapID;					//!< Reflexion texture map
				sdword				mRefractionMapID;					//!< Refraction texture map
				sdword				mDisplacementMapID;					//!< Displacement texture map
		// Amounts
				float				mAmbientCoeff;						//!< Ambient texture %									[Animatable]
				float				mDiffuseCoeff;						//!< Diffuse tetxure %									[Animatable]
				float				mSpecularCoeff;						//!< Specular texture %									[Animatable]
				float				mShininessCoeff;					//!< Shininess texture %								[Animatable]
				float				mShiningStrengthCoeff;				//!< Shining Strength texture %							[Animatable]
				float				mSelfIllumCoeff;					//!< Self Illum texture %								[Animatable]
				float				mOpacityCoeff;						//!< Opacity texture %									[Animatable]
				float				mFilterCoeff;						//!< Filter texture %									[Animatable]
				float				mBumpCoeff;							//!< Bump texture %										[Animatable]
				float				mReflexionCoeff;					//!< Reflexion texture %								[Animatable]
				float				mRefractionCoeff;					//!< Refraction texture %								[Animatable]
				float				mDisplacementCoeff;					//!< Displacement texture %								[Animatable]
		// Colors
				Point				mMtlAmbientColor;					//!< Ambient Color										[Animatable]
				Point				mMtlDiffuseColor;					//!< Diffuse Color										[Animatable]
				Point				mMtlSpecularColor;					//!< Specular Color										[Animatable]
				Point				mMtlFilterColor;					//!< Filter Color										[Animatable]
		// Static properties
				ZCBShadingMode		mShading;							//!< Material Shading
				bool				mSoften;							//!< MaterialSoften
				bool				mFaceMap;							//!< MaterialFaceMap
				bool				mTwoSided;							//!< true for two-sided materials
				bool				mWire;								//!< true for wireframe mode
				bool				mWireUnits;							//!< Wire Units
				bool				mFalloffOut;						//!< MaterialFalloffOut
				ZCBTranspaType		mTransparencyType;					//!< MaterialTransparencyType
		// Dynamic properties
				float				mShininess;							//!< MaterialShininess									[Animatable]
				float				mShiningStrength;					//!< MaterialShiningStrength							[Animatable]
				float				mSelfIllum;							//!< MaterialSelfIllum									[Animatable]
				float				mOpacity;							//!< MaterialOpacity									[Animatable]
				float				mOpaFalloff;						//!< MaterialOpacityFalloff								[Animatable]
				float				mWireSize;							//!< MaterialWireSize									[Animatable]
				float				mIOR;								//!< MaterialIOR										[Animatable]
		// Dynamic properties
				float				mBounce;							//!< Bounce												[Animatable]
				float				mStaticFriction;					//!< Static Friction									[Animatable]
				float				mSlidingFriction;					//!< Sliding Friction									[Animatable]
		// Crop values & texture matrix (for diffuse map)
		// Valid if mDiffuseMapID!=INVALID_ID
				TextureCrop			mCValues;							//!< Cropping values
				TextureMatrix		mTMtx;								//!< Texture matrix
				bool				mWrapU;
				bool				mMirrorU;
				bool				mWrapV;
				bool				mMirrorV;
		// Extended self-illum
				bool				mSelfIllumOn;						//!< true => use SelfIllumColor, else use SelfIllumValue
				float				mSelfIllumValue;					//!< SelfIllum value
				Point				mSelfIllumColor;					//!< SelfIllum color
		// Flexporter specific
				String				mShaderFile;						//!< Shader filename
				String				mUserProps;							//!< User properties
				sdword				mDecalMapID;						//!< Decal texture map
				sdword				mDetailMapID;						//!< Detail texture map
				sdword				mBillboardMapID;					//!< Billboard texture map
	};

	class ICERENDERMANAGER_API ZCBTextureInfo
	{
		public:
		// Constructor/Destructor
									ZCBTextureInfo();
		virtual						~ZCBTextureInfo();

		// Database information
				String				mName;							//!< Texture name & path
				sdword				mID;							//!< Texture ID
		// Crop values & texture matrix
				TextureCrop			mCValues;						//!< Cropping values
				TextureMatrix		mTMtx;							//!< Texture matrix
				bool				mWrapU;
				bool				mMirrorU;
				bool				mWrapV;
				bool				mMirrorV;
		// Bitmap data
				udword				mWidth;							//!< Texture's width
				udword				mHeight;						//!< Texture's height
				ubyte*				mBitmap;						//!< Texture in R,G,B,A order. (always contains Alpha)
				bool				mHasAlpha;						//!< True => Alpha is valid.
				bool				mIsBitmapIncluded;				//!< True if previous fields are valid, else must be read from disk
	};

	struct ICERENDERMANAGER_API FaceProperties
	{
		sdword	MatID;		//!< Material ID
		udword	Smg;		//!< Smoothing groups
		ubyte	EdgeVis;	//!< Edge visibility code
	};

	struct ICERENDERMANAGER_API BasicBone
	{
		udword	CSID;		//!< Character Studio ID
		udword	pCSID;		//!< Parent's CSID
	};

	class ICERENDERMANAGER_API ZCBNativeMeshInfo
	{
		public:
		// Constructor/Destructor
									ZCBNativeMeshInfo();
		virtual						~ZCBNativeMeshInfo();

		// Useful figures
				udword				mNbFaces;					//!< Number of faces in MAX native data
				udword				mNbVerts;					//!< Number of vertices.
				udword				mNbTVerts;					//!< Number of texture-vertices (mapping coordinates)
				udword				mNbCVerts;					//!< Number of vertex-colors
		// ZCB Flags
				udword				mFlags;						//!< See ZCB flags
		// Topologies
				udword*				mFaces;						//!< List of faces
				udword*				mTFaces;					//!< List of texture-faces
				udword*				mCFaces;					//!< List of color-faces
				FaceProperties*		mFaceProperties;			//!< List of face properties
		// Geometries
				Point*				mVerts;						//!< List of vertices (null for skins, use offset vectors)
				Point*				mTVerts;					//!< List of texture-vertices
				Point*				mCVerts;					//!< List of vertex-colors
				float*				mVertexAlpha;				//!< List of mNbVerts vertex alpha
		// Skin-related information
				udword*				mBonesNb;					//!< Number of bones for each vertex, or null if one bone/vertex. (only for skins)
				udword*				mBonesID;					//!< IDs of driving bones. (only for skins)
				Point*				mOffsetVectors;				//!< Character Studio's offset vectors. (only for skins)
				float*				mWeights;					//!< Bones weights when there's more than one bone/vertex, else null. (only for skins)
		// Skeleton-related information
				udword				mNbBones;					//!< Number of bones in the skeleton below (only for skins)
				BasicBone*			mSkeleton;					//!< Skeletal information (only for skins)
		// Possible convex hull
				udword				mNbHullVerts;				//!< Number of vertices in the convex hull
				udword				mNbHullFaces;				//!< Number of faces in the convex hull
				Point*				mHullVerts;					//!< Convex hull vertices
				udword*				mHullFaces;					//!< Convex hull faces
		// Possible bounding sphere

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -