MD2Normal.cpp
上传用户:hkb425
上传日期:2007-06-16
资源大小:34191k
文件大小:7k
- // MD2Normal.cpp: implementation of the CMD2Normal class.
- //
- //////////////////////////////////////////////////////////////////////
- #include "stdafx.h"
- #include "MD2Normal.h"
- //////////////////////////////////////////////////////////////////////
- // Construction/Destruction
- //////////////////////////////////////////////////////////////////////
- float *CMD2Normal::m_pMD2Normal=NULL;
- int CMD2Normal::m_numUser=0;
- CMD2Normal::CMD2Normal()
- {
- if(m_numUser==0)
- {
- m_pMD2Normal=new float [256*3];
- ////////////md2 normal/////////
- float md2_Normal[256][3]=
- {
- {-0.525731f, 0.000000f, 0.850651f},
- {-0.442863f, 0.238856f, 0.864188f},
- {-0.295242f, 0.000000f, 0.955423f},
- {-0.309017f, 0.500000f, 0.809017f},
- {-0.162460f, 0.262866f, 0.951056f},
- {0.000000f, 0.000000f, 1.000000f},
- {0.000000f, 0.850651f, 0.525731f},
- {-0.147621f, 0.716567f, 0.681718f},
- {0.147621f, 0.716567f, 0.681718f},
- {0.000000f, 0.525731f, 0.850651f},
- {0.309017f, 0.500000f, 0.809017f},
- {0.525731f, 0.000000f, 0.850651f},
- {0.295242f, 0.000000f, 0.955423f},
- {0.442863f, 0.238856f, 0.864188f},
- {0.162460f, 0.262866f, 0.951056f},
- {-0.681718f, 0.147621f, 0.716567f},
- {-0.809017f, 0.309017f, 0.500000f},
- {-0.587785f, 0.425325f, 0.688191f},
- {-0.850651f, 0.525731f, 0.000000f},
- {-0.864188f, 0.442863f, 0.238856f},
- {-0.716567f, 0.681718f, 0.147621f},
- {-0.688191f, 0.587785f, 0.425325f},
- {-0.500000f, 0.809017f, 0.309017f},
- {-0.238856f, 0.864188f, 0.442863f},
- {-0.425325f, 0.688191f, 0.587785f},
- {-0.716567f, 0.681718f, -0.147621f},
- {-0.500000f, 0.809017f, -0.309017f},
- {-0.525731f, 0.850651f, 0.000000f},
- {0.000000f, 0.850651f, -0.525731f},
- {-0.238856f, 0.864188f, -0.442863f},
- {0.000000f, 0.955423f, -0.295242f},
- {-0.262866f, 0.951056f, -0.162460f},
- {0.000000f, 1.000000f, 0.000000f},
- {0.000000f, 0.955423f, 0.295242f},
- {-0.262866f, 0.951056f, 0.162460f},
- {0.238856f, 0.864188f, 0.442863f},
- {0.262866f, 0.951056f, 0.162460f},
- {0.500000f, 0.809017f, 0.309017f},
- {0.238856f, 0.864188f, -0.442863f},
- {0.262866f, 0.951056f, -0.162460f},
- {0.500000f, 0.809017f, -0.309017f},
- {0.850651f, 0.525731f, 0.000000f},
- {0.716567f, 0.681718f, 0.147621f},
- {0.716567f, 0.681718f, -0.147621f},
- {0.525731f, 0.850651f, 0.000000f},
- {0.425325f, 0.688191f, 0.587785f},
- {0.864188f, 0.442863f, 0.238856f},
- {0.688191f, 0.587785f, 0.425325f},
- {0.809017f, 0.309017f, 0.500000f},
- {0.681718f, 0.147621f, 0.716567f},
- {0.587785f, 0.425325f, 0.688191f},
- {0.955423f, 0.295242f, 0.000000f},
- {1.000000f, 0.000000f, 0.000000f},
- {0.951056f, 0.162460f, 0.262866f},
- {0.850651f, -0.525731f, 0.000000f},
- {0.955423f, -0.295242f, 0.000000f},
- {0.864188f, -0.442863f, 0.238856f},
- {0.951056f, -0.162460f, 0.262866f},
- {0.809017f, -0.309017f, 0.500000f},
- {0.681718f, -0.147621f, 0.716567f},
- {0.850651f, 0.000000f, 0.525731f},
- {0.864188f, 0.442863f, -0.238856f},
- {0.809017f, 0.309017f, -0.500000f},
- {0.951056f, 0.162460f, -0.262866f},
- {0.525731f, 0.000000f, -0.850651f},
- {0.681718f, 0.147621f, -0.716567f},
- {0.681718f, -0.147621f, -0.716567f},
- {0.850651f, 0.000000f, -0.525731f},
- {0.809017f, -0.309017f, -0.500000f},
- {0.864188f, -0.442863f, -0.238856f},
- {0.951056f, -0.162460f, -0.262866f},
- {0.147621f, 0.716567f, -0.681718f},
- {0.309017f, 0.500000f, -0.809017f},
- {0.425325f, 0.688191f, -0.587785f},
- {0.442863f, 0.238856f, -0.864188f},
- {0.587785f, 0.425325f, -0.688191f},
- {0.688191f, 0.587785f, -0.425325f},
- {-0.147621f, 0.716567f, -0.681718f},
- {-0.309017f, 0.500000f, -0.809017f},
- {0.000000f, 0.525731f, -0.850651f},
- {-0.525731f, 0.000000f, -0.850651f},
- {-0.442863f, 0.238856f, -0.864188f},
- {-0.295242f, 0.000000f, -0.955423f},
- {-0.162460f, 0.262866f, -0.951056f},
- {0.000000f, 0.000000f, -1.000000f},
- {0.295242f, 0.000000f, -0.955423f},
- {0.162460f, 0.262866f, -0.951056f},
- {-0.442863f, -0.238856f, -0.864188f},
- {-0.309017f, -0.500000f, -0.809017f},
- {-0.162460f, -0.262866f, -0.951056f},
- {0.000000f, -0.850651f, -0.525731f},
- {-0.147621f, -0.716567f, -0.681718f},
- {0.147621f, -0.716567f, -0.681718f},
- {0.000000f, -0.525731f, -0.850651f},
- {0.309017f, -0.500000f, -0.809017f},
- {0.442863f, -0.238856f, -0.864188f},
- {0.162460f, -0.262866f, -0.951056f},
- {0.238856f, -0.864188f, -0.442863f},
- {0.500000f, -0.809017f, -0.309017f},
- {0.425325f, -0.688191f, -0.587785f},
- {0.716567f, -0.681718f, -0.147621f},
- {0.688191f, -0.587785f, -0.425325f},
- {0.587785f, -0.425325f, -0.688191f},
- {0.000000f, -0.955423f, -0.295242f},
- {0.000000f, -1.000000f, 0.000000f},
- {0.262866f, -0.951056f, -0.162460f},
- {0.000000f, -0.850651f, 0.525731f},
- {0.000000f, -0.955423f, 0.295242f},
- {0.238856f, -0.864188f, 0.442863f},
- {0.262866f, -0.951056f, 0.162460f},
- {0.500000f, -0.809017f, 0.309017f},
- {0.716567f, -0.681718f, 0.147621f},
- {0.525731f, -0.850651f, 0.000000f},
- {-0.238856f, -0.864188f, -0.442863f},
- {-0.500000f, -0.809017f, -0.309017f},
- {-0.262866f, -0.951056f, -0.162460f},
- {-0.850651f, -0.525731f, 0.000000f},
- {-0.716567f, -0.681718f, -0.147621f},
- {-0.716567f, -0.681718f, 0.147621f},
- {-0.525731f, -0.850651f, 0.000000f},
- {-0.500000f, -0.809017f, 0.309017f},
- {-0.238856f, -0.864188f, 0.442863f},
- {-0.262866f, -0.951056f, 0.162460f},
- {-0.864188f, -0.442863f, 0.238856f},
- {-0.809017f, -0.309017f, 0.500000f},
- {-0.688191f, -0.587785f, 0.425325f},
- {-0.681718f, -0.147621f, 0.716567f},
- {-0.442863f, -0.238856f, 0.864188f},
- {-0.587785f, -0.425325f, 0.688191f},
- {-0.309017f, -0.500000f, 0.809017f},
- {-0.147621f, -0.716567f, 0.681718f},
- {-0.425325f, -0.688191f, 0.587785f},
- {-0.162460f, -0.262866f, 0.951056f},
- {0.442863f, -0.238856f, 0.864188f},
- {0.162460f, -0.262866f, 0.951056f},
- {0.309017f, -0.500000f, 0.809017f},
- {0.147621f, -0.716567f, 0.681718f},
- {0.000000f, -0.525731f, 0.850651f},
- {0.425325f, -0.688191f, 0.587785f},
- {0.587785f, -0.425325f, 0.688191f},
- {0.688191f, -0.587785f, 0.425325f},
- {-0.955423f, 0.295242f, 0.000000f},
- {-0.951056f, 0.162460f, 0.262866f},
- {-1.000000f, 0.000000f, 0.000000f},
- {-0.850651f, 0.000000f, 0.525731f},
- {-0.955423f, -0.295242f, 0.000000f},
- {-0.951056f, -0.162460f, 0.262866f},
- {-0.864188f, 0.442863f, -0.238856f},
- {-0.951056f, 0.162460f, -0.262866f},
- {-0.809017f, 0.309017f, -0.500000f},
- {-0.864188f, -0.442863f, -0.238856f},
- {-0.951056f, -0.162460f, -0.262866f},
- {-0.809017f, -0.309017f, -0.500000f},
- {-0.681718f, 0.147621f, -0.716567f},
- {-0.681718f, -0.147621f, -0.716567f},
- {-0.850651f, 0.000000f, -0.525731f},
- {-0.688191f, 0.587785f, -0.425325f},
- {-0.587785f, 0.425325f, -0.688191f},
- {-0.425325f, 0.688191f, -0.587785f},
- {-0.425325f, -0.688191f, -0.587785f},
- {-0.587785f, -0.425325f, -0.688191f},
- {-0.688191f, -0.587785f, -0.425325f}
- };
- //////////////////copy data
- for(int i=0;i<256;i++)
- for(int j=0;j<3;j++)
- m_pMD2Normal[i*3+j]=md2_Normal[i][j];
- ///////////////////////////////
- }
- m_numUser++;
- }
- CMD2Normal::~CMD2Normal()
- {
- m_numUser--;
- if(m_pMD2Normal!=NULL && (m_numUser==0))
- {
- delete [] m_pMD2Normal;
- }
- }