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

📄 hxform.h

📁 Lido PXA270平台开发板的最新BSP,包括源代码
💻 H
📖 第 1 页 / 共 2 页
字号:
/*90*/

   } HXFLight;

CT_ASSERT( 0 == ( sizeof( HXFLight ) & 7 ));


HINT32 HXFPackAttF(float);
HINT32 HXFPackAttFX(HFIXED);


typedef struct _CTLState
   {
/* 00*/ HFIXED FogStart;

/* 04*/ CTLU32 u32ScreenWidth;
/* 08*/ CTLU32 u32ScreenHeight;

/* 0c*/ CTL_ROTATION eRotation;

/* 10*/ CTL_VIEWPORT sViewport;

/* 28*/ CTLFLOAT fPointSize;
/* 2c*/ CTLFLOAT fLineWidth;

/* 30*/ CTLMATRIX44 mScreen;
/* 70*/ CTLMATRIX44 mView;
/* b0*/ CTLMATRIX44 mProj;

/*0f0*/ CTL_LIGHT    asLights[CTLLIGHT_MAX_NUM];
/*430*/ CTL_MATERIAL sMaterial;
/*478*/ CTLU32       bfLightEnable;

/*47c*/ void* pvRasterHandle;

/*480*/ CTL_RASTER_CALLBACKS sRasterCallbacks;

/*490*/ HXFALIGNEDCOLOR4S sAmbient;

/*4a4*/ HXFLight* pLights;

/*4a8*/ CTLCOLOR4 sColorCurrent;
/*4b8*/

   } CTLState;

CT_ASSERT( 0x4b8 == sizeof( CTLState ));


/* ************************************************************************* *\
** ************************************************************************* **
** HXFState - WARNING when this structure is modified then the offsets in
**       HXFState.inc must be updated for the assembly interface to
**       continue working.
** The entire structure must be 8 byte aligned.
** ************************************************************************* **
\* ************************************************************************* */
typedef struct _HXFState
   {
/* 00*/ HUINT32 NumVertices;     //
/* 04*/ HUINT32 NumPrimitives;   //
/* 08*/ HUINT32 Flags;           //   General State Flags
/* 0c*/ HUINT32 Pad1[1];

   /* ********************************************************************* *\
   Input data is accepted as arrays of data with strides.

   Color iterators are used to map the material source color.
   if the Color is a constant then the iterator should be set to point
   to a HUINT32 value with the color value packed in the bytes in RGBA
   ordering. The stride should then be set to 0.

   If Lighting is disabled only the diffuse and specular iterators are
   used. The diffuse for the output vertex diffuse color and if seperate
   specular is enabled then the specular pointer is used for the vertex
   specular value.
   \* ********************************************************************* */
/* 10*/ const HBYTE* pIndices;   //  Must be 16 bit indices
/* 14*/ HUINT32      BaseIndex;  // Value to add to

   // Pairs must be 8 byte aligned
/* 18*/ const HBYTE* pInPosition;            //
/* 1c*/ HUINT32 InPositionStride;            //
/* 20*/ const HBYTE* pInNormal;              //
/* 24*/ HUINT32 InNormalStride;              //
/* 28*/ const HBYTE* pInDiffuse;             // if !HXF_LM_COLOR_CONSTANT -- Used as ambient
/* 2c*/ HUINT32 InDiffuseStride;             //
/* 30*/ const HBYTE* pInSpecular;            //
/* 34*/ HUINT32 InSpecularStride;            //
/* 38*/ const HBYTE* pInTextureCoordinate1;  //
/* 3c*/ HUINT32 InTextureCoordinate1Stride;  //
/* 40*/ const HBYTE* pInTextureCoordinate2;  //
/* 44*/ HUINT32 InTextureCoordinate2Stride;  //

   /* ********************************************************************* *\
   Output Iterators -- By definition the output vertices are in an interleaved
   format. The Offset variables tell the offsets of the different attributes
   in to the vertex. If an offset is set to 0 then that attribute is not present.

   The output vertex format is (optional attributes are in []):
   HVECTOR4 DevicePosition - always present
   FIXME May be able to remove z for w Buffering
   HUINT32  Diffuse
   [HUINT32  Specular] - Assume Diffuse is present if specular is present
   [HVECTOR2FX Tex1]
   [HVECTOR2FX Tex2] - Assume not present if Tex1 is not present

   The presents of the optional attributes is determined by whether the
   corresponding offsets are 0 or !0. If the offset is 0 then the attribute is
   assumed to not be present.

   This ordering of the data members can not be changed.

   \* ********************************************************************* */
/* 48*/ HBYTE* pOutVertices;           //  must be 8 byte aligned
/* 4c*/ HUINT32 OutVertexSize;         //   the size of the interleaved output vertex
/* 50*/ HUINT32 OutScreenVertexSize;   //   the size of the output vertex to be transmitted to marathon
/* 54*/ HUINT8* pOutClipFlags;         //   Byte array must have 1 entry for each vertex

   // Offsets from pOutVertices - OutPosition Must be present --
/* 58*/ HUINT32 OutDiffuseOffset;   //
/* 5c*/ HUINT32 OutSpecularOffset;  //
/* 60*/ HUINT32 OutTex1Offset;      //
/* 64*/ HUINT32 OutTex2Offset;      //
/* 68*/ HUINT32 OutClipPosOffset;   //

/* 6c*/ HBYTE* pEndOutVertex; // Pointer to the vtx past the last vertex
   // so pOutVertices can serve as a loop counter
   /* ********************************************************************* *\
   TnL parameters
   \* ********************************************************************* */
   // [0] = Model/View/Projection/View/Device Matricies concatinated
   // [1] = Texture matrix 1
   // [2] = Texture matrix 2
   // Must be DWORD(8 byte) aligned.
/* 70*/ HMATRIX4FX* pTransformMatrix; 

   /* ********************************************************************* *\
   Lighting
   \* ********************************************************************* */
/* 74*/ HXFLight*  pLights;            // Light Data
/* 78*/ HXFNORMAL  EyeVector;          // Must be DWORD(8 byte) aligned.
/* 80*/ HXFCOLOR4S MaterialEmissive;   // Must be DWORD(8 byte) aligned.
/* 88*/ HXFCOLOR4S MaterialAmbient;    // Must be DWORD(8 byte) aligned.
/* 90*/ HFIXED     MaterialPower;      //

   /* ********************************************************************* *\
   Fogging
   \* ********************************************************************* */
/* 94*/ HFIXED FogDensity;   // -FogDensity
/* 98*/ HFIXED FogXForm[4];  // Transform to calculate the z position in view space - Must be DWORD(8 byte) aligned.
/*0a8*/ HFIXED FogEnd;       // FogEnd in Model Space - Must be DWORD(8 byte) aligned.
/*0ac*/ HFIXED FogInvRange;  // 1/(FogEnd - FogStart) (in Model Space)

   /* ********************************************************************* *\
   Viewport - Contains X,Y,Z Scale factors and X,Y,Z Translations Factors.
   \* ********************************************************************* */
/*0b0*/ HFIXED Viewport[6];  //   viewport x1, x2, y1, y2, z1, z2 -- Must DWORD(8Byte) Align

   /* ********************************************************************* *\
   Storage
   \* ********************************************************************* */
   // using storage here to avoid the stack - allowing all memory referenced
   // to be in this single contiguous block
/*0c8*/ HVECTOR4FX StorageInPos; // DWORD Align temp storage for the vertex positions during lighting
/*0d8*/ HUINT32    StorageLR[2];

   /* ********************************************************************* *\
   Slaveport Interface Variables
   \* ********************************************************************* */
/*0e0*/ HUINT32 reserved0[6];

/*0f8*/ float PrimitiveSize;       // Size for Points and Lines

/*0fc*/ HUINT32 reserved1[1];

   /* ********************************************************************* *\
   Helper Procs
   \* ********************************************************************* */
/*100*/ HXFTNLPROC pfLoadPositionProc;
/*104*/ HXFTNLPROC pfLoadDiffuseProc;
/*108*/ HXFTNLPROC pfLoadSpecularProc;
/*10c*/ HXFTNLPROC pfLoadNormalProc;
/*110*/ HXFTNLPROC pfFogProc;
/*114*/ HXFTNLPROC pfLoadTex1Proc;
/*118*/ HXFTNLPROC pfLoadTex2Proc;

   /* ********************************************************************* *\
   Clipping related variables.
   \* ********************************************************************* */
/*11c*/ HUINT32 NumClippedPrimitives; //
/*120*/ HUINT32 NumClippedVertices;   //

   // List of vertex pointers to the making up the triangles that have been clipped
   // this is an array of pointers to vertices either in the clip vertices array or the
   // out vertices array
/*124*/ void** pClippedIndices; 
   
   // Array of vertices of the same format as the out vertices
/*128*/ HUINT8* pClippedVertices; 
   
/*12c*/ void* pClipSegments; //   Clip Segment List

   /* ********************************************************************* *\
   Temp Memory buffer
   \* ********************************************************************* */
/*130*/ HUINT32 FreeBufferSize;    //
/*134*/ HBYTE* pFreeBuffer;        //

/*138*/ CTLState ctl;
/*   */

   } HXFState;

CT_ASSERT( 0 == ( sizeof( HXFState ) & 7 ));

// Check offsets of variables that must be 8-byte aligned
CT_ASSERT( 0 == ( __offsetof( HXFState, Viewport ) & 7 ));
CT_ASSERT( 0 == ( __offsetof( HXFState, pInPosition ) & 7 ));
CT_ASSERT( 0 == ( __offsetof( HXFState, pInNormal ) & 7 ));
CT_ASSERT( 0 == ( __offsetof( HXFState, pInDiffuse ) & 7 ));
CT_ASSERT( 0 == ( __offsetof( HXFState, pInSpecular ) & 7 ));
CT_ASSERT( 0 == ( __offsetof( HXFState, pInTextureCoordinate1 ) & 7 ));
CT_ASSERT( 0 == ( __offsetof( HXFState, pInTextureCoordinate2 ) & 7 ));
CT_ASSERT( 0 == ( __offsetof( HXFState, pOutVertices ) & 7 ));
CT_ASSERT( 0 == ( __offsetof( HXFState, EyeVector ) & 7 ));
CT_ASSERT( 0 == ( __offsetof( HXFState, FogXForm ) & 7 ));
CT_ASSERT( 0 == ( __offsetof( HXFState, FogEnd ) & 7 ));
CT_ASSERT( 0 == ( __offsetof( HXFState, StorageInPos ) & 7 ));
CT_ASSERT( 0 == ( __offsetof( HXFState, Viewport ) & 7 ));


/* ************************************************************************* *\
** ************************************************************************* **
** HXForm Functions
** ************************************************************************* **
\* ************************************************************************* */
HXFState* HXFAllocateState(void);
void      HXFFreeState(HXFState*);
HBOOL     HXFDrawPrimitives(HXFState*);

/* ************************************************************************* *\
** ************************************************************************* **
** Utility Functions
** ************************************************************************* **
\* ************************************************************************* */
void HXFCountVertices(const HUINT16* pIndices, HUINT32 NumIndices,
                 HUINT32* out_pMinIndex, HUINT32* out_pMaxIndex);
// Gather the min and max indices and convert the indices to 16 bit.
void HXFCountVertices_8To16(const HUINT16* pDstIndices,
               const HUINT8* pSrcIndices, HUINT32 NumIndices,
                 HUINT32* out_pMinIndex, HUINT32* out_pMaxIndex);

/* ************************************************************************* *\
** ************************************************************************* **
** EOF
** ************************************************************************* **
\* ************************************************************************* */
#endif // __HXFORM_H__

⌨️ 快捷键说明

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