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

📄 hxform.h

📁 Lido PXA270平台开发板的最新BSP,包括源代码
💻 H
📖 第 1 页 / 共 2 页
字号:
/* ************************************************************************* *\
**
**    INTEL Corporation Proprietary Information
**
**    This listing is supplied under the terms of a license
**    agreement with INTEL Corporation and may not be copied
**    nor disclosed except in accordance with the terms of
**    that agreement.
**
**    Copyright (c) 2003 Intel Corporation.
**    All Rights Reserved.
**
** ************************************************************************* **
   FILE: HXForm.h
   DESCRIPTION: Defines the public interface for the HXForm library.
      Defines Creation, Destruction, and processing functions.

   INPUT ARRAY FORMATS:



   VERTEX TRANSFORM

      The vertex transform matrix is composed of the Model Matrix(M),
      View Matrix(V), Projection Matrix(P), Viewport matrix (VP),
      Device Matrix (D).

      M * V * P * LH * VP * D *

      If the graphics api is a assuming a Right Handed coordinate system then
      the Z axes must be inverted.

      The Viewport Transform should be composed into a matrix of the form:

         W,    0,    0     0
         0,    H,    0     0
         0,    0,    ZRange,  0
         X,    Y,    MinZ, 1

         W = Viewport Width
         H = Viewport Height
         X = Viewport X
         Y = Viewport Y
         MinZ = Viewport
         ZRange = Viewport MaxZ - Viewport MinZ

   LIGHTING:
      Lighting is done in model space. The light positions and directions
      must be transformed in to model space. Assuming that the Light Position
      and direction is in View space (as in OpenGL). The the light position
      must be transformed by the inverse of M*V.

      TBD
         Light Types


   PRIMITIVE ASSEMBLY:


   ERROR HANDLING:

      This library is designed primarily for speed, as a result there is not
      much internal error checking. Every effort has been made to insure that
      this library is correct and will not fail unless bad data is provided.
      Since it is expensive and not practical to test all of the input data
      for validity, it is recommended that all calls to this library be
      wrapped in an exception handler(C++ or SEH) to handle any of these
      unforseen events.

   AUTHOR: Cian Montgomery
   DATE: June 06, 2003

 *  $Date: 5/24/04 3:11p $ $Revision: 22 $
 *  $Log: /Intel_Development/Drivers/Marathon/WinCE42/opengles/HXForm.h $
 * 
 * 22    5/24/04 3:11p Clmontgo
 * Fixes for Frustrum Calculation Overflow and Attenuation initialization
 * problem
 *
 * 21    5/16/04 12:53p Clmontgo
 *
 * 20    4/05/04 2:19p Clmontgo
 * Fixes for Light w/ w != 0 or 1 and Attenuation > 1.0
 *
 * 19    3/25/04 1:27p Clmontgo
 * Optimization of Clip flag generation and VP XForm. Fix for Clipping
 * issue observed in previous version.
\* ************************************************************************* */
#ifndef __HXFORM_H__
#define __HXFORM_H__
#include "HXFTypes.h"
#include "XPL.h"
#include "CTL.h"

//
typedef struct GLESHWContext_TAG GLESHWContext;

/* ************************************************************************* *\
** ************************************************************************* **
** Common HXFState Value Macros
** ************************************************************************* **
\* ************************************************************************* */
#define HXF_MAX_LIGHTS (8)

/* ************************************************************************* *\
   General Flags
\* ************************************************************************* */
#define HXF_HAS_PRIMITIVE_SIZE      (0x00000001)
#define HXF_INVERT_NORMALS          (0x00000002) // indicates that Two sided lighting is on and the Culling is set to front faces
#define HXF_SPECULAR_ENABLE      (0x00000004)
// Free Bits                     (0x00000008)

// Culling flags
#define HXF_CULL_NONE            (0x00000000)
#define HXF_CULL_CCW          (0x00000010)
#define HXF_CULL_CW              (0x00000020)
#define HXF_CULL_BAD          (0x00000030) // extra combination not used
#define HXF_CULL_MASK            (0x00000030)

#define HXF_CULL_FLIP_2SIDED     (0x00000040)

#define HXF_SEPERATE_SPECULAR    (0x00000080)

// HXF_PRIMITIVE_TYPE
typedef enum _HXF_PRIMITIVE_TYPE
{
   HXF_PT_POINT_LIST =        (0x00000000),
   HXF_PT_LINE_LIST  =        (0x00000001),
   HXF_PT_LINE_STRIP =        (0x00000002),
   HXF_PT_LINE_LOOP  =        (0x00000003),
   HXF_PT_TRI_LIST      =        (0x00000004),
   HXF_PT_TRI_STRIP  =        (0x00000005),
   HXF_PT_TRI_FAN    =        (0x00000006),
   HXF_PT_NONE             =                       (0x00000007),
   HXF_NUM_PRIMITIVE_TYPES
} HXF_PRIMITIVE_TYPE;

#define HXF_PT_MASK              (0x00000F00)
#define HXF_PT_SHIFT          (8)
#define HXF_GET_PT(x)            (((x) & HXF_PT_MASK) >> HXF_PT_SHIFT)
#define HXF_SET_PT(x)            ((x)<<HXF_PT_SHIFT)

#define HXF_TEXTURE1_TRANSFORM_ENABLE  (0x00001000)
#define HXF_TEXTURE2_TRANSFORM_ENABLE  (0x00002000)

#define HXF_LIGHT_ENABLE            (0x00004000)
#define HXF_FOG_ENABLE              (0x00008000)

// Bits 0x00010000 are Free
#define HXF_OUTPUT_SPECULAR            (0x00020000)
#define HXF_OUTPUT_TEX1             (0x00040000)
#define HXF_OUTPUT_TEX2             (0x00080000)
#define HXF_OUTPUT_MASK             (0x000F0000)

#define HXF_LM_COLOR_CONSTANT       (0x00100000)
// Bits  0x00600000 are free

#define HXF_LIGHTING_TWO_SIDED         (0x00800000) // indicates that Two sided lighting is on and the Culling is set to front faces
// FIXME Verify use of bits
// Bits  0xFF000000 are free

#define HXF_NORMAL_NORMALIZE     (0x01000000)

/* ************************************************************************* *\
** ************************************************************************* **
** Output Vertex Format and size
** ************************************************************************* **
\* ************************************************************************* */
typedef enum HXF_VERTEX_FORMAT_E
{
   HXF_VF_NONE  = 0,
   HXF_VF_FIXED = 1,
   HXF_VF_FLOAT = 2,
   HXF_VF_INT16 = 3,
   HXF_VF_INT8 =  4,
   HXF_VF_UINT8 = 5,
   HXF_VF_PACKED = 6, // Format for HXFCOLOR4S or HXFNORMAL
   HXF_NUM_VTX_FORMATS
} HXF_VERTEX_FORMAT;

// Vertex size
#define HXF_VTX_BASE_SIZE  (16)     // Minimum size of output vertex (x,y,z,w)
#define HXF_VTX_DIFFUSE_SIZE (4)    // Added for diffuse components
#define HXF_VTX_SPECULAR_SIZE (4)      // Added for specular components
#define HXF_VTX_TEX1_SIZE    (8)    // Added for Tex1 components
#define HXF_VTX_TEX2_SIZE   (8)     // Added for Tex2 components
#define HXF_VTX_CLIP_POS_SIZE (16)     // Added if clipping is enabled (x,y,z,w)

#define HXF_VTX_MAX_SIZE (HXF_VTX_BASE_SIZE + HXF_VTX_DIFFUSE_SIZE         \
                     + HXF_VTX_SPECULAR_SIZE + HXF_VTX_TEX1_SIZE     \
                     + HXF_VTX_TEX2_SIZE + HXF_VTX_CLIP_POS_SIZE)

/* ************************************************************************* *\
** ************************************************************************* **
** Type forward declarations.
** ************************************************************************* **
\* ************************************************************************* */
typedef struct _HXFState HXFState;
typedef struct _HXFLight HXFLight;

/* ************************************************************************* *\
** ************************************************************************* **
** TnL Helper Procs
** ************************************************************************* **
\* ************************************************************************* */
typedef void (*HXFTNLPROC)(void);

// Lookup tables for TnL helper functions
extern HXFTNLPROC g_pfLoadPositionProcs[HXF_NUM_PRIMITIVE_TYPES][3];

extern HXFTNLPROC g_pfCopyColorProcs[HXF_NUM_PRIMITIVE_TYPES];
extern HXFTNLPROC g_pfLoadColorProcs[HXF_NUM_PRIMITIVE_TYPES];

extern HXFTNLPROC g_pfLoadNormalProcs[HXF_NUM_PRIMITIVE_TYPES];
extern HXFTNLPROC g_pfLoadNormalizeNormalProcs[HXF_NUM_PRIMITIVE_TYPES];

extern HXFTNLPROC g_pfLoadTexCoordsProcs[HXF_NUM_PRIMITIVE_TYPES][3];
extern HXFTNLPROC g_pfTransformTexCoordsProcs[HXF_NUM_PRIMITIVE_TYPES][3];

#define HXF_NUM_LIGHT_TYPES 4
extern HXFTNLPROC g_pfLightProcs[HXF_NUM_LIGHT_TYPES][4];

void HXFFogLinearProc(void);
void HXFFogExpProc(void);
void HXFFogExp2Proc(void);

// Slave port DrawVertex3 functions
typedef void* (*HXFSPProc)(void*, void*, void*, void*);
extern HXFSPProc s_SPProcs[];

/* ************************************************************************* *\
** ************************************************************************* **
** HXFLight - WARNING when this structure is modified then the offsets in
**       HXFState.inc must be updated for the assembly interface to
**       continue working.
** NOTE: This structure must be 8byte aligned and a multiple of 8 bytes in size.
** ************************************************************************* **
\* ************************************************************************* */
typedef struct _HXFLight
   {
/*00*/ HVECTOR4FX Position;   //  8Byte Align
/*10*/ HXFNORMAL Direction;      //  8Byte Align

   // These colors are actually stored as 4.12 bit of a deviation from the HXFCOLOR4S spec.
/*18*/ HXFCOLOR4S Ambient;       //  8Byte Align
/*20*/ HXFCOLOR4S Diffuse;       //  8Byte Align
/*28*/ HXFCOLOR4S Specular;      //  8Byte Align

/*30*/ HFIXED CosSpotCutoff;     //  Cosine of the spot cutoff - Set to HFX_MAX to disable Spoteffect
/*34*/ HFIXED SpotExponent;      //

/*38*/ HFIXED Attenuation[3];    // if Constant Att(att[0]) < 0 then att is disabled.
/*44*/ HXFTNLPROC pfLightProc;
/*48*/ HXFLight* pNext; // Pointer to the next active light, Null if last active light

/*4c*/ HUINT32 Pad1;

/*50*/ HXFALIGNEDCOLOR4S sAmbient;
/*64*/ HXFALIGNEDCOLOR4S sDiffuse;
/*78*/ HXFALIGNEDCOLOR4S sSpecular;

/*8c*/ HUINT32 Pad2;

⌨️ 快捷键说明

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