SMFNormal.cpp
上传用户:hkb425
上传日期:2007-06-16
资源大小:34191k
文件大小:7k
- // SMFNormal.cpp: implementation of the CSMFNormal class.
- //
- //////////////////////////////////////////////////////////////////////
- #include "stdafx.h"
- #include "SMFNormal.h"
- //////////////////////////////////////////////////////////////////////
- // Construction/Destruction
- //////////////////////////////////////////////////////////////////////
- float *CSMFNormal::m_pSMFNormal=NULL;
- int CSMFNormal::m_numUser=0;
- CSMFNormal::CSMFNormal()
- {
- if(m_numUser==0)
- {
- m_pSMFNormal=new float [162*3];
- ////////////md2 normal/////////
- float SMF_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<162;i++)
- for(int j=0;j<3;j++)
- m_pSMFNormal[i*3+j]=SMF_Normal[i][j];
- ///////////////////////////////
- }
- m_numUser++;
- }
- CSMFNormal::~CSMFNormal()
- {
- m_numUser--;
- if(m_pSMFNormal!=NULL && (m_numUser==0))
- {
- delete [] m_pSMFNormal;
- }
- }