diff --git a/HouseLightingModel/.vscode/launch.json b/HouseLightingModel/.vscode/launch.json new file mode 100644 index 0000000..b5ab606 --- /dev/null +++ b/HouseLightingModel/.vscode/launch.json @@ -0,0 +1,16 @@ +{ + "configurations": [ + { + "name": "Visual Studio: Start Debugging", + "type": "cppvsdbg", + "request": "launch", + "program": "${workspaceFolder}\\Debug\\${workspaceFolderBasename}.exe", + "stopAtEntry": false, + "cwd": "${workspaceFolder}", + "console": "integratedTerminal", + "preLaunchTask": "Visual Studio: Build Solution", + "internalConsoleOptions": "neverOpen" + } + ], + "version": "0.2.0" +} \ No newline at end of file diff --git a/HouseLightingModel/.vscode/settings.json b/HouseLightingModel/.vscode/settings.json new file mode 100644 index 0000000..d47ab15 --- /dev/null +++ b/HouseLightingModel/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "git.openRepositoryInParentFolders": "never" +} \ No newline at end of file diff --git a/HouseLightingModel/.vscode/tasks.json b/HouseLightingModel/.vscode/tasks.json new file mode 100644 index 0000000..9c8418c --- /dev/null +++ b/HouseLightingModel/.vscode/tasks.json @@ -0,0 +1,23 @@ +{ + "tasks": [ + { + "type": "shell", + "label": "Visual Studio: Build Solution", + "command": "msbuild", + "args": [ + "${workspaceFolder}\\${workspaceFolderBasename}.sln", + "/p:Configuration=Debug", + "/p:Platform=Win32", + ], + "options": { + "cwd": "${workspaceFolder}" + }, + "problemMatcher": [ + "$msCompile" + ], + "group": "build", + "detail": "Task generated by Debugger." + } + ], + "version": "2.0.0" +} \ No newline at end of file diff --git a/HouseLightingModel/AET.cpp b/HouseLightingModel/AET.cpp new file mode 100644 index 0000000..e1653e6 --- /dev/null +++ b/HouseLightingModel/AET.cpp @@ -0,0 +1,27 @@ +// AET.cpp: implementation of the CAET class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "Test.h" +#include "AET.h" + +#ifdef _DEBUG +#undef THIS_FILE +static char THIS_FILE[]=__FILE__; +#define new DEBUG_NEW +#endif + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + +CAET::CAET() +{ + +} + +CAET::~CAET() +{ + +} diff --git a/HouseLightingModel/AET.h b/HouseLightingModel/AET.h new file mode 100644 index 0000000..7bc2372 --- /dev/null +++ b/HouseLightingModel/AET.h @@ -0,0 +1,27 @@ +// AET.h: interface for the CAET class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_CAET_H__D7F2123F_A3AE_40D6_81D8_E403C7E50447__INCLUDED_) +#define AFX_CAET_H__D7F2123F_A3AE_40D6_81D8_E403C7E50447__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +#include "Vector.h" + +class CAET +{ +public: + CAET(); + virtual ~CAET(); +public: + double x;//当前x + int yMax;//边的最大y值 + double k;//斜率的倒数(x的增量) + CPi2 ps;//起点坐标 + CPi2 pe;//终点坐标 + CAET *pNext; +}; + +#endif // !defined(AFX_CAET_H__D7F2123F_A3AE_40D6_81D8_E403C7E50447__INCLUDED_) diff --git a/HouseLightingModel/Bucket.cpp b/HouseLightingModel/Bucket.cpp new file mode 100644 index 0000000..646a0e5 --- /dev/null +++ b/HouseLightingModel/Bucket.cpp @@ -0,0 +1,27 @@ +// Bucket.cpp: implementation of the CBucket class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "Test.h" +#include "Bucket.h" + +#ifdef _DEBUG +#undef THIS_FILE +static char THIS_FILE[]=__FILE__; +#define new DEBUG_NEW +#endif + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + +CBucket::CBucket() +{ + +} + +CBucket::~CBucket() +{ + +} diff --git a/HouseLightingModel/Bucket.h b/HouseLightingModel/Bucket.h new file mode 100644 index 0000000..64fdd3b --- /dev/null +++ b/HouseLightingModel/Bucket.h @@ -0,0 +1,24 @@ +// Bucket.h: interface for the CBucket class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_CBUCKET_H__B36B2287_DDD5_4BE9_B57A_D359001CB0C5__INCLUDED_) +#define AFX_CBUCKET_H__B36B2287_DDD5_4BE9_B57A_D359001CB0C5__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +#include "AET.h" + +class CBucket +{ +public: + CBucket(); + virtual ~CBucket(); +public: + int ScanLine; + CAET *pET; + CBucket *pNext; +}; + +#endif // !defined(AFX_CBUCKET_H__B36B2287_DDD5_4BE9_B57A_D359001CB0C5__INCLUDED_) diff --git a/HouseLightingModel/Face.cpp b/HouseLightingModel/Face.cpp new file mode 100644 index 0000000..f6ad50c --- /dev/null +++ b/HouseLightingModel/Face.cpp @@ -0,0 +1,45 @@ +// Face.cpp: implementation of the CFace class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "Test.h" +#include "Face.h" + +#ifdef _DEBUG +#undef THIS_FILE +static char THIS_FILE[]=__FILE__; +#define new DEBUG_NEW +#endif + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + +CFace::CFace() +{ + vI=NULL; + fNormal=CVector(CP3(0.0,0.0,1.0)); +} + +CFace::~CFace() +{ + if(vI!=NULL) + { + delete []vI; + vI=NULL; + } +} + +void CFace::SetNum(int n) +{ + vN=n; + vI=new int[n]; +} + +void CFace::SetFaceNormal(CP3 pt0,CP3 pt1,CP3 pt2)//计算小面法矢量 +{ + CVector V01(pt0,pt1); + CVector V02(pt0,pt2); + fNormal=Cross(V01,V02); +} \ No newline at end of file diff --git a/HouseLightingModel/Face.h b/HouseLightingModel/Face.h new file mode 100644 index 0000000..5187461 --- /dev/null +++ b/HouseLightingModel/Face.h @@ -0,0 +1,26 @@ +// Face.h: interface for the CFace class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_FACE_H__82BF93AE_A82E_407D_AF42_6E6608253C1C__INCLUDED_) +#define AFX_FACE_H__82BF93AE_A82E_407D_AF42_6E6608253C1C__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +#include "Vector.h" + +class CFace +{ +public: + CFace(); + virtual ~CFace(); + void SetNum(int); + void SetFaceNormal(CP3,CP3,CP3);//设置小面法矢量 +public: + int vN; //小面的顶点数 + int *vI; //小面的顶点索引 + CVector fNormal;//小面的法矢量 +}; + +#endif // !defined(AFX_FACE_H__82BF93AE_A82E_407D_AF42_6E6608253C1C__INCLUDED_) diff --git a/HouseLightingModel/Light.cpp b/HouseLightingModel/Light.cpp new file mode 100644 index 0000000..9085dd1 --- /dev/null +++ b/HouseLightingModel/Light.cpp @@ -0,0 +1,79 @@ +// Light.cpp: implementation of the CLight class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "Test.h" +#include "Light.h" + +#include "math.h" +#define PI 3.14159265 + +#ifdef _DEBUG +#undef THIS_FILE +static char THIS_FILE[]=__FILE__; +#define new DEBUG_NEW +#endif + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + +CLight::CLight() +{ + L_Diffuse=CRGB(0.0,0.0,0.0);//光源的漫反射颜色 + L_Specular=CRGB(1.0,1.0,1.0);//光源镜面高光颜色 + L_Position.x=0.0,L_Position.y=0.0,L_Position.z=1000;//光源位置直角坐标 + L_R=1000,L_Phi=0,L_Theta=0;//光源位置球坐标 + L_C0=1.0;//常数衰减系数 + L_C1=0.0;//线性衰减系数 + L_C2=0.0;//二次衰减系数 + L_OnOff=TRUE;//光源开启 +} + +CLight::~CLight() +{ + +} + +void CLight::SetDiffuse(CRGB dif) +{ + L_Diffuse=dif; +} + +void CLight::SetSpecular(CRGB spe) +{ + L_Specular=spe; +} +void CLight::SetPosition(double x,double y,double z) +{ + L_Position.x=x; + L_Position.y=y; + L_Position.z=z; +} + +void CLight::SetGlobal(double r,double phi,double theta) +{ + L_R=r; + L_Phi=phi; + L_Theta=theta; +} + +void CLight::SetOnOff(BOOL onoff) +{ + L_OnOff=onoff; +} + +void CLight::SetCoef(double c0,double c1,double c2) +{ + L_C0=c0; + L_C1=c1; + L_C2=c2; +} + +void CLight::GlobalToXYZ() +{ + L_Position.x=L_R*sin(L_Phi*PI/180)*sin(L_Theta*PI/180); + L_Position.y=L_R*cos(L_Phi*PI/180); + L_Position.z=L_R*sin(L_Phi*PI/180)*cos(L_Theta*PI/180); +} \ No newline at end of file diff --git a/HouseLightingModel/Light.h b/HouseLightingModel/Light.h new file mode 100644 index 0000000..c2bdb11 --- /dev/null +++ b/HouseLightingModel/Light.h @@ -0,0 +1,36 @@ +// Light.h: interface for the CLight class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_LIGHT_H__ACA1A2A6_E72D_4EBC_B919_5C0AC538F456__INCLUDED_) +#define AFX_LIGHT_H__ACA1A2A6_E72D_4EBC_B919_5C0AC538F456__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +#include "P3.h" + +class CLight +{ +public: + CLight(); + virtual ~CLight(); + void SetDiffuse(CRGB);//设置光源的漫反射光 + void SetSpecular(CRGB);//设置光源的镜面反射光 + void SetPosition(double,double,double);//设置光源的直角坐标位置 + void SetGlobal(double,double,double);//设置光源的球坐标位置 + void SetCoef(double,double,double);//设置光强的衰减系数 + void SetOnOff(BOOL);//设置光源开关状态 + void GlobalToXYZ();//球坐标转换为直角坐标 +public: + CRGB L_Diffuse;//光的漫反射颜色 + CRGB L_Specular;//光的镜面高光颜色 + CP3 L_Position;//光源的位置 + double L_R,L_Phi,L_Theta;//光源球坐标 + double L_C0;//常数衰减系数 + double L_C1;//线性衰减系数 + double L_C2;//二次衰减系数 + BOOL L_OnOff;//光源开关 +}; + +#endif // !defined(AFX_LIGHT_H__ACA1A2A6_E72D_4EBC_B919_5C0AC538F456__INCLUDED_) diff --git a/HouseLightingModel/Lighting.cpp b/HouseLightingModel/Lighting.cpp new file mode 100644 index 0000000..759e0ff --- /dev/null +++ b/HouseLightingModel/Lighting.cpp @@ -0,0 +1,100 @@ +// Lighting.cpp: implementation of the CLighting class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "Test.h" +#include "Lighting.h" +#include "math.h" +#define PI 3.14159265 +#define MIN(a,b) ((ab)?(a):(b)) +#ifdef _DEBUG +#undef THIS_FILE +static char THIS_FILE[]=__FILE__; +#define new DEBUG_NEW +#endif + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + +CLighting::CLighting() +{ + LightNum=1; + Light=new CLight[LightNum]; + Ambient=CRGB(0.3,0.3,0.3);//环境光恒定不变 +} + +CLighting::~CLighting() +{ + if(Light) + { + delete []Light; + Light=NULL; + } +} +void CLighting::SetLightNumber(int lnum) +{ + if(Light) + { + delete []Light; + } + LightNum=lnum; + Light=new CLight[lnum]; +} + +CLighting::CLighting(int lnum) +{ + LightNum=lnum; + Light=new CLight[lnum]; + Ambient=CRGB(0.3,0.3,0.3); +} + +CRGB CLighting::Lighting(CP3 ViewPoint,CP3 Point,CVector Normal,CMaterial *pMaterial) +{ + CRGB LastC=pMaterial->M_Emit;//材质自身发散色为初始值 + for(int i=0;iM_Diffuse.red*CosTheta; + InitC.green+=Light[i].L_Diffuse.green*pMaterial->M_Diffuse.green*CosTheta; + InitC.blue+=Light[i].L_Diffuse.blue*pMaterial->M_Diffuse.blue*CosTheta; + //第2步,加入镜面反射光 + CVector VV(Point,ViewPoint);//VV为视矢量 + VV=VV.Normalize();//单位化视矢量 + CVector VH=(VL+VV)/(VL+VV).Mag();//VH为平分矢量 + double nHN=pow(MAX(Dot(VH,VN),0),pMaterial->M_n); + InitC.red+=Light[i].L_Specular.red*pMaterial->M_Specular.red*nHN; + InitC.green+=Light[i].L_Specular.green*pMaterial->M_Specular.green*nHN; + InitC.blue+=Light[i].L_Specular.blue*pMaterial->M_Specular.blue*nHN; + //第3步,光强衰减 + double c0=Light[i].L_C0;//c0为常数衰减因子 + double c1=Light[i].L_C1;//c1线性衰减因子 + double c2=Light[i].L_C2;//c2二次衰减因子 + double f=(1.0/(c0+c1*d+c2*d*d));//光强衰减函数 + f=MIN(1.0,f); + LastC+=InitC*f; + } + else + { + LastC+=Point.c;//物体自身颜色 + } + } + //第4步,加入环境光 + LastC+=Ambient*pMaterial->M_Ambient; + //第5步,颜色归一化到[0,1]区间 + LastC.Normalize(); + //第6步,返回所计算顶点的光强颜色 + return LastC; +} diff --git a/HouseLightingModel/Lighting.h b/HouseLightingModel/Lighting.h new file mode 100644 index 0000000..558e736 --- /dev/null +++ b/HouseLightingModel/Lighting.h @@ -0,0 +1,29 @@ +// Lighting.h: interface for the CLighting class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_LIGHTING_H__4E9D1F90_7696_4D33_999F_6417C555CB36__INCLUDED_) +#define AFX_LIGHTING_H__4E9D1F90_7696_4D33_999F_6417C555CB36__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +#include "Light.h" +#include "Material.h" +#include "Vector.h" + +class CLighting +{ +public: + CLighting(); + CLighting(int); + virtual ~CLighting(); + void SetLightNumber(int);//设置光源数量 + CRGB Lighting(CP3,CP3,CVector,CMaterial *);//光照 +public: + int LightNum;//光源数量 + CLight *Light;//光源数组 + CRGB Ambient;//环境光 +}; + +#endif // !defined(AFX_LIGHTING_H__4E9D1F90_7696_4D33_999F_6417C555CB36__INCLUDED_) diff --git a/HouseLightingModel/MainFrm.cpp b/HouseLightingModel/MainFrm.cpp new file mode 100644 index 0000000..4b8fbd9 --- /dev/null +++ b/HouseLightingModel/MainFrm.cpp @@ -0,0 +1,107 @@ +// MainFrm.cpp : implementation of the CMainFrame class +// + +#include "stdafx.h" +#include "Test.h" + +#include "MainFrm.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CMainFrame + +IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd) + +BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd) + //{{AFX_MSG_MAP(CMainFrame) + // NOTE - the ClassWizard will add and remove mapping macros here. + // DO NOT EDIT what you see in these blocks of generated code ! + ON_WM_CREATE() + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +static UINT indicators[] = +{ + ID_SEPARATOR, // status line indicator + ID_INDICATOR_CAPS, + ID_INDICATOR_NUM, + ID_INDICATOR_SCRL, +}; + +///////////////////////////////////////////////////////////////////////////// +// CMainFrame construction/destruction + +CMainFrame::CMainFrame() +{ + // TODO: add member initialization code here + +} + +CMainFrame::~CMainFrame() +{ +} + +int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) +{ + if (CFrameWnd::OnCreate(lpCreateStruct) == -1) + return -1; + + if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP + | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) || + !m_wndToolBar.LoadToolBar(IDR_MAINFRAME)) + { + TRACE0("Failed to create toolbar\n"); + return -1; // fail to create + } + + if (!m_wndStatusBar.Create(this) || + !m_wndStatusBar.SetIndicators(indicators, + sizeof(indicators)/sizeof(UINT))) + { + TRACE0("Failed to create status bar\n"); + return -1; // fail to create + } + + // TODO: Delete these three lines if you don't want the toolbar to + // be dockable + m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY); + EnableDocking(CBRS_ALIGN_ANY); + DockControlBar(&m_wndToolBar); + + return 0; +} + +BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) +{ + if( !CFrameWnd::PreCreateWindow(cs) ) + return FALSE; + // TODO: Modify the Window class or styles here by modifying + // the CREATESTRUCT cs + + return TRUE; +} + +///////////////////////////////////////////////////////////////////////////// +// CMainFrame diagnostics + +#ifdef _DEBUG +void CMainFrame::AssertValid() const +{ + CFrameWnd::AssertValid(); +} + +void CMainFrame::Dump(CDumpContext& dc) const +{ + CFrameWnd::Dump(dc); +} + +#endif //_DEBUG + +///////////////////////////////////////////////////////////////////////////// +// CMainFrame message handlers + diff --git a/HouseLightingModel/MainFrm.h b/HouseLightingModel/MainFrm.h new file mode 100644 index 0000000..a52d77a --- /dev/null +++ b/HouseLightingModel/MainFrm.h @@ -0,0 +1,58 @@ +// MainFrm.h : interface of the CMainFrame class +// +///////////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_MAINFRM_H__7BDF38E2_1C35_4E15_804B_2AB491FCC818__INCLUDED_) +#define AFX_MAINFRM_H__7BDF38E2_1C35_4E15_804B_2AB491FCC818__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +class CMainFrame : public CFrameWnd +{ + +protected: // create from serialization only + CMainFrame(); + DECLARE_DYNCREATE(CMainFrame) + +// Attributes +public: + +// Operations +public: + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CMainFrame) + virtual BOOL PreCreateWindow(CREATESTRUCT& cs); + //}}AFX_VIRTUAL + +// Implementation +public: + virtual ~CMainFrame(); +#ifdef _DEBUG + virtual void AssertValid() const; + virtual void Dump(CDumpContext& dc) const; +#endif + +protected: // control bar embedded members + CStatusBar m_wndStatusBar; + CToolBar m_wndToolBar; + +// Generated message map functions +protected: + //{{AFX_MSG(CMainFrame) + afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); + // NOTE - the ClassWizard will add and remove member functions here. + // DO NOT EDIT what you see in these blocks of generated code! + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +///////////////////////////////////////////////////////////////////////////// + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_MAINFRM_H__7BDF38E2_1C35_4E15_804B_2AB491FCC818__INCLUDED_) diff --git a/HouseLightingModel/Material.cpp b/HouseLightingModel/Material.cpp new file mode 100644 index 0000000..f1d482b --- /dev/null +++ b/HouseLightingModel/Material.cpp @@ -0,0 +1,56 @@ +// Material.cpp: implementation of the CMaterial class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "Test.h" +#include "Material.h" + +#ifdef _DEBUG +#undef THIS_FILE +static char THIS_FILE[]=__FILE__; +#define new DEBUG_NEW +#endif + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + +CMaterial::CMaterial() +{ + M_Ambient=CRGB(0.2,0.2,0.2);//材质对环境光的反射率 + M_Diffuse=CRGB(0.8,0.8,0.8);//材质对漫反射光的反射率 + M_Specular=CRGB(0.0,0.0,0.0);//材质对镜面反射光的反射率 + M_Emit=CRGB(0.0,0.0,0.0);//材质自身发散的颜色 + M_n=1.0;//高光指数 +} + +CMaterial::~CMaterial() +{ + +} + +void CMaterial::SetAmbient(CRGB c) +{ + M_Ambient=c; +} + +void CMaterial::SetDiffuse(CRGB c) +{ + M_Diffuse=c; +} + +void CMaterial::SetSpecular(CRGB c) +{ + M_Specular=c; +} + +void CMaterial::SetEmit(CRGB emi) +{ + M_Emit=emi; +} + +void CMaterial::SetExp(double n) +{ + M_n=n; +} \ No newline at end of file diff --git a/HouseLightingModel/Material.h b/HouseLightingModel/Material.h new file mode 100644 index 0000000..7bd8379 --- /dev/null +++ b/HouseLightingModel/Material.h @@ -0,0 +1,31 @@ +// Material.h: interface for the CMaterial class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_MATERIAL_H__1161180E_9A92_4DAE_AB2E_757671AB6E12__INCLUDED_) +#define AFX_MATERIAL_H__1161180E_9A92_4DAE_AB2E_757671AB6E12__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +#include "RGB.h" + +class CMaterial +{ +public: + CMaterial(); + virtual ~CMaterial(); + void SetAmbient(CRGB);//设置材质对环境光的反射率 + void SetDiffuse(CRGB);//设置材质对漫反射光的反射率 + void SetSpecular(CRGB);//设置材质对镜面反射光的反射率 + void SetEmit(CRGB);//设置材质自身辐射的颜色 + void SetExp(double);//设置材质的高光指数 +public: + CRGB M_Ambient;//材质对环境光的反射率 + CRGB M_Diffuse;//材质对漫反射光的反射率 + CRGB M_Specular;//材质对镜面反射光的反射率 + CRGB M_Emit;//材质自身发散的颜色 + double M_n;//材质的高光指数 +}; + +#endif // !defined(AFX_MATERIAL_H__1161180E_9A92_4DAE_AB2E_757671AB6E12__INCLUDED_) diff --git a/HouseLightingModel/P2.cpp b/HouseLightingModel/P2.cpp new file mode 100644 index 0000000..4edfa92 --- /dev/null +++ b/HouseLightingModel/P2.cpp @@ -0,0 +1,39 @@ +// P2.cpp: implementation of the CP2 class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "Test.h" +#include "P2.h" + +#ifdef _DEBUG +#undef THIS_FILE +static char THIS_FILE[]=__FILE__; +#define new DEBUG_NEW +#endif + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + +CP2::CP2() +{ + x=0; + y=0; + w=1.0; + c=CRGB(1.0,1.0,1.0); +} + +CP2::~CP2() +{ + +} + +CP2::CP2(double x,double y) +{ + this->x=x; + this->y=y; + this->w=1.0; +} + + diff --git a/HouseLightingModel/P2.h b/HouseLightingModel/P2.h new file mode 100644 index 0000000..3ede8d9 --- /dev/null +++ b/HouseLightingModel/P2.h @@ -0,0 +1,26 @@ +// P2.h: interface for the CP2 class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_P2_H__F5B8C5D7_BC9B_4346_817B_F55E89EE7598__INCLUDED_) +#define AFX_P2_H__F5B8C5D7_BC9B_4346_817B_F55E89EE7598__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +#include "RGB.h" + +class CP2 +{ +public: + CP2(); + virtual ~CP2(); + CP2(double,double); +public: + double x; + double y; + double w; + CRGB c; +}; + +#endif // !defined(AFX_P2_H__F5B8C5D7_BC9B_4346_817B_F55E89EE7598__INCLUDED_) diff --git a/HouseLightingModel/P3.cpp b/HouseLightingModel/P3.cpp new file mode 100644 index 0000000..e162ca7 --- /dev/null +++ b/HouseLightingModel/P3.cpp @@ -0,0 +1,110 @@ +// P3.cpp: implementation of the CP3 class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "Test.h" +#include "P3.h" +#include "math.h" +#ifdef _DEBUG +#undef THIS_FILE +static char THIS_FILE[]=__FILE__; +#define new DEBUG_NEW +#endif + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + +CP3::CP3() +{ + z=0.0; +} + +CP3::~CP3() +{ + +} +CP3::CP3(double x,double y,double z):CP2(x,y) +{ + this->z=z; +} + +CP3 operator +(const CP3 &p0,const CP3 &p1)//和 +{ + CP3 p; + p.x=p0.x+p1.x; + p.y=p0.y+p1.y; + p.z=p0.z+p1.z; + return p; +} + +CP3 operator -(const CP3 &p0,const CP3 &p1)//差 +{ + CP3 p; + p.x=p0.x-p1.x; + p.y=p0.y-p1.y; + p.z=p0.z-p1.z; + return p; +} + +CP3 operator *(const CP3 &p,double k)//点和常量的积 +{ + return CP3(p.x*k,p.y*k,p.z*k); +} + +CP3 operator *(double k,const CP3 &p)//点和常量的积 +{ + return CP3(p.x*k,p.y*k,p.z*k); +} + +CP3 operator /(const CP3 &p0,double k)//数除 +{ + if(fabs(k)<1e-6) + k=1.0; + CP3 p; + p.x=p0.x/k; + p.y=p0.y/k; + p.z=p0.z/k; + return p; +} + +CP3 operator+=(CP3 &p0,CP3 &p1) +{ + p0.x=p0.x+p1.x; + p0.y=p0.y+p1.y; + p0.z=p0.z+p1.z; + return p0; +} + +CP3 operator-=(CP3 &p0,CP3 &p1) +{ + p0.x=p0.x-p1.x; + p0.y=p0.y-p1.y; + p0.z=p0.z-p1.z; + return p0; +} + +CP3 operator*=(CP3 &p0,double k) +{ + p0.x=p0.x*k; + p0.y=p0.y*k; + p0.z=p0.z*k; + return p0; +} + +CP3 operator/=(CP3 &p0,double k) +{ + if(fabs(k)<1e-6) + k=1.0; + p0.x=p0.x/k; + p0.y=p0.y/k; + p0.z=p0.z/k; + return p0; +} + +double CP3::Mag()//长度 +{ + return sqrt(x*x+y*y+z*z); +} + diff --git a/HouseLightingModel/P3.h b/HouseLightingModel/P3.h new file mode 100644 index 0000000..211dac3 --- /dev/null +++ b/HouseLightingModel/P3.h @@ -0,0 +1,33 @@ +// P3.h: interface for the CP3 class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_P3_H__5B85FC65_6516_4259_941E_FAB30D13824E__INCLUDED_) +#define AFX_P3_H__5B85FC65_6516_4259_941E_FAB30D13824E__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +#include "P2.h" + +class CP3:public CP2 +{ +public: + CP3(); + virtual ~CP3(); + CP3(double,double,double); + friend CP3 operator +(const CP3 &,const CP3 &);//运算符重载 + friend CP3 operator -(const CP3 &,const CP3 &); + friend CP3 operator *(const CP3 &,double); + friend CP3 operator *(double,const CP3 &); + friend CP3 operator /(const CP3 &,double); + friend CP3 operator+=(CP3 &,CP3 &); + friend CP3 operator-=(CP3 &,CP3 &); + friend CP3 operator*=(CP3 &,double); + friend CP3 operator/=(CP3 &,double); + double Mag();//长度 +public: + double z; +}; + +#endif // !defined(AFX_P3_H__5B85FC65_6516_4259_941E_FAB30D13824E__INCLUDED_) diff --git a/HouseLightingModel/Pi2.cpp b/HouseLightingModel/Pi2.cpp new file mode 100644 index 0000000..195e88f --- /dev/null +++ b/HouseLightingModel/Pi2.cpp @@ -0,0 +1,35 @@ +// Pi2.cpp: implementation of the CPi2 class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "Test.h" +#include "Pi2.h" + +#ifdef _DEBUG +#undef THIS_FILE +static char THIS_FILE[]=__FILE__; +#define new DEBUG_NEW +#endif + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + +CPi2::CPi2() +{ + x=0.0; + y=0; + c=CRGB(1.0,1.0,1.0); +} + +CPi2::~CPi2() +{ + +} + +CPi2::CPi2(double x,int y) +{ + this->x=x; + this->y=y; +} \ No newline at end of file diff --git a/HouseLightingModel/Pi2.h b/HouseLightingModel/Pi2.h new file mode 100644 index 0000000..4181d25 --- /dev/null +++ b/HouseLightingModel/Pi2.h @@ -0,0 +1,25 @@ +// Pi2.h: interface for the CPi2 class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_PI2_H__B80DAA04_DDC9_4F35_8BC8_B3DDDE62F21D__INCLUDED_) +#define AFX_PI2_H__B80DAA04_DDC9_4F35_8BC8_B3DDDE62F21D__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +#include "RGB.h" + +class CPi2 +{ +public: + CPi2(); + virtual ~CPi2(); + CPi2(double,int); +public: + double x; + int y; + CRGB c; +}; + +#endif // !defined(AFX_PI2_H__B80DAA04_DDC9_4F35_8BC8_B3DDDE62F21D__INCLUDED_) diff --git a/HouseLightingModel/Pi3.cpp b/HouseLightingModel/Pi3.cpp new file mode 100644 index 0000000..e125de3 --- /dev/null +++ b/HouseLightingModel/Pi3.cpp @@ -0,0 +1,32 @@ +// Pi3.cpp: implementation of the CPi3 class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "Test.h" +#include "Pi3.h" + +#ifdef _DEBUG +#undef THIS_FILE +static char THIS_FILE[]=__FILE__; +#define new DEBUG_NEW +#endif + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + +CPi3::CPi3() +{ + z=0.0; +} + +CPi3::~CPi3() +{ + +} + +CPi3::CPi3(double x,int y,double z):CPi2(x,y) +{ + this->z=z; +} \ No newline at end of file diff --git a/HouseLightingModel/Pi3.h b/HouseLightingModel/Pi3.h new file mode 100644 index 0000000..7a70ef5 --- /dev/null +++ b/HouseLightingModel/Pi3.h @@ -0,0 +1,23 @@ +// Pi3.h: interface for the CPi3 class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_PI3_H__1DC85C9B_C92E_4165_9851_4C61236BF305__INCLUDED_) +#define AFX_PI3_H__1DC85C9B_C92E_4165_9851_4C61236BF305__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +#include "Pi2.h" + +class CPi3:public CPi2 +{ +public: + CPi3(); + virtual ~CPi3(); + CPi3(double,int,double); +public: + double z; +}; + +#endif // !defined(AFX_PI3_H__1DC85C9B_C92E_4165_9851_4C61236BF305__INCLUDED_) diff --git a/HouseLightingModel/RGB.cpp b/HouseLightingModel/RGB.cpp new file mode 100644 index 0000000..45aae95 --- /dev/null +++ b/HouseLightingModel/RGB.cpp @@ -0,0 +1,139 @@ +// CRGB.cpp: implementation of the CRGB class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "Test.h" +#include "RGB.h" + +#ifdef _DEBUG +#undef THIS_FILE +static char THIS_FILE[]=__FILE__; +#define new DEBUG_NEW +#endif + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + +CRGB::CRGB() +{ + red=1.0; + green=1.0; + blue=1.0; + alpha=0.0; +} + +CRGB::CRGB(double r,double g,double b)//重载构造函数 +{ + red=r; + green=g; + blue=b; +} + +CRGB::CRGB(double r,double g,double b,double a)//重载构造函数 +{ + red=r; + green=g; + blue=b; + alpha=a; +} + +CRGB::~CRGB() +{ + +} + +CRGB operator +(const CRGB &c1,const CRGB &c2)//+运算符重载 +{ + CRGB c; + c.red=c1.red+c2.red; + c.green=c1.green+c2.green; + c.blue=c1.blue+c2.blue; + return c; +} + +CRGB operator -(const CRGB &c1,const CRGB &c2)//-运算符重载 +{ + CRGB c; + c.red=c1.red-c2.red; + c.green=c1.green-c2.green; + c.blue=c1.blue-c2.blue; + return c; +} + +CRGB operator *(const CRGB &c1,const CRGB &c2)//*运算符重载 +{ + CRGB c; + c.red=c1.red*c2.red; + c.green=c1.green*c2.green; + c.blue=c1.blue*c2.blue; + return c; +} + +CRGB operator *(const CRGB &c1,double k)//*运算符重载 +{ + CRGB c; + c.red=k*c1.red; + c.green=k*c1.green; + c.blue=k*c1.blue; + return c; +} + +CRGB operator *(double k,const CRGB &c1)//*运算符重载 +{ + CRGB c; + c.red=k*c1.red; + c.green=k*c1.green; + c.blue=k*c1.blue; + return c; +} + +CRGB operator /(const CRGB &c1,double k)///运算符重载 +{ + CRGB c; + c.red=c1.red/k; + c.green=c1.green/k; + c.blue=c1.blue/k; + return c; +} + +CRGB operator +=(CRGB &c1,CRGB &c2)//+=运算符重载 +{ + c1.red=c1.red+c2.red; + c1.green=c1.green+c2.green; + c1.blue=c1.blue+c2.blue; + return c1; +} + +CRGB operator -=(CRGB &c1,CRGB &c2)//-=运算符重载 +{ + c1.red=c1.red-c2.red; + c1.green=c1.green-c2.green; + c1.blue=c1.blue-c2.blue; + return c1; +} + +CRGB operator *=(CRGB &c1,CRGB &c2)//*=运算符重载 +{ + c1.red=c1.red*c2.red; + c1.green=c1.green*c2.green; + c1.blue=c1.blue*c2.blue; + return c1; +} + +CRGB operator /=(CRGB &c1,double k)///=运算符重载 +{ + c1.red=c1.red/k; + c1.green=c1.green/k; + c1.blue=c1.blue/k; + return c1; +} + +void CRGB::Normalize()//归一化 +{ + red=(red < 0.0) ? 0.0 : ((red > 1.0) ? 1.0 : red); + green=(green < 0.0) ? 0.0 : ((green > 1.0) ? 1.0 : green); + blue=(blue < 0.0) ? 0.0 : ((blue > 1.0) ? 1.0 : blue); +} + diff --git a/HouseLightingModel/RGB.h b/HouseLightingModel/RGB.h new file mode 100644 index 0000000..0fe46e6 --- /dev/null +++ b/HouseLightingModel/RGB.h @@ -0,0 +1,37 @@ +// CRGB.h: interface for the CRGB class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_CRGB_H__F14E5B6C_E5FA_4DD9_8051_EB943E4929E7__INCLUDED_) +#define AFX_CRGB_H__F14E5B6C_E5FA_4DD9_8051_EB943E4929E7__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +class CRGB +{ +public: + CRGB(); + CRGB(double,double,double); + CRGB(double,double,double,double a); + virtual ~CRGB(); + friend CRGB operator+(const CRGB &,const CRGB &);//运算符重载 + friend CRGB operator-(const CRGB &,const CRGB &); + friend CRGB operator*(const CRGB &,const CRGB &); + friend CRGB operator*(const CRGB &,double); + friend CRGB operator*(double,const CRGB &); + friend CRGB operator/(const CRGB &,double); + friend CRGB operator+=(CRGB &,CRGB &); + friend CRGB operator-=(CRGB &,CRGB &); + friend CRGB operator*=(CRGB &,CRGB &); + friend CRGB operator/=(CRGB &,double); + void Normalize(); //归一化到[0,1]区间 +public: + double red;//红色分量 + double green;//绿色分量 + double blue;//蓝色分量 + double alpha;//透射系数 +}; + +#endif // !defined(AFX_CRGB_H__F14E5B6C_E5FA_4DD9_8051_EB943E4929E7__INCLUDED_) diff --git a/HouseLightingModel/ReadMe.txt b/HouseLightingModel/ReadMe.txt new file mode 100644 index 0000000..a7f11b9 --- /dev/null +++ b/HouseLightingModel/ReadMe.txt @@ -0,0 +1,105 @@ +======================================================================== + MICROSOFT FOUNDATION CLASS LIBRARY : Test +======================================================================== + + +AppWizard has created this Test application for you. This application +not only demonstrates the basics of using the Microsoft Foundation classes +but is also a starting point for writing your application. + +This file contains a summary of what you will find in each of the files that +make up your Test application. + +Test.dsp + This file (the project file) contains information at the project level and + is used to build a single project or subproject. Other users can share the + project (.dsp) file, but they should export the makefiles locally. + +Test.h + This is the main header file for the application. It includes other + project specific headers (including Resource.h) and declares the + CTestApp application class. + +Test.cpp + This is the main application source file that contains the application + class CTestApp. + +Test.rc + This is a listing of all of the Microsoft Windows resources that the + program uses. It includes the icons, bitmaps, and cursors that are stored + in the RES subdirectory. This file can be directly edited in Microsoft + Visual C++. + +Test.clw + This file contains information used by ClassWizard to edit existing + classes or add new classes. ClassWizard also uses this file to store + information needed to create and edit message maps and dialog data + maps and to create prototype member functions. + +res\Test.ico + This is an icon file, which is used as the application's icon. This + icon is included by the main resource file Test.rc. + +res\Test.rc2 + This file contains resources that are not edited by Microsoft + Visual C++. You should place all resources not editable by + the resource editor in this file. + + + +///////////////////////////////////////////////////////////////////////////// + +For the main frame window: + +MainFrm.h, MainFrm.cpp + These files contain the frame class CMainFrame, which is derived from + CFrameWnd and controls all SDI frame features. + +res\Toolbar.bmp + This bitmap file is used to create tiled images for the toolbar. + The initial toolbar and status bar are constructed in the CMainFrame + class. Edit this toolbar bitmap using the resource editor, and + update the IDR_MAINFRAME TOOLBAR array in Test.rc to add + toolbar buttons. +///////////////////////////////////////////////////////////////////////////// + +AppWizard creates one document type and one view: + +TestDoc.h, TestDoc.cpp - the document + These files contain your CTestDoc class. Edit these files to + add your special document data and to implement file saving and loading + (via CTestDoc::Serialize). + +TestView.h, TestView.cpp - the view of the document + These files contain your CTestView class. + CTestView objects are used to view CTestDoc objects. + + + +///////////////////////////////////////////////////////////////////////////// +Other standard files: + +StdAfx.h, StdAfx.cpp + These files are used to build a precompiled header (PCH) file + named Test.pch and a precompiled types file named StdAfx.obj. + +Resource.h + This is the standard header file, which defines new resource IDs. + Microsoft Visual C++ reads and updates this file. + +///////////////////////////////////////////////////////////////////////////// +Other notes: + +AppWizard uses "TODO:" to indicate parts of the source code you +should add to or customize. + +If your application uses MFC in a shared DLL, and your application is +in a language other than the operating system's current language, you +will need to copy the corresponding localized resources MFC42XXX.DLL +from the Microsoft Visual C++ CD-ROM onto the system or system32 directory, +and rename it to be MFCLOC.DLL. ("XXX" stands for the language abbreviation. +For example, MFC42DEU.DLL contains resources translated to German.) If you +don't do this, some of the UI elements of your application will remain in the +language of the operating system. + +///////////////////////////////////////////////////////////////////////////// diff --git a/HouseLightingModel/StdAfx.cpp b/HouseLightingModel/StdAfx.cpp new file mode 100644 index 0000000..0f878dd --- /dev/null +++ b/HouseLightingModel/StdAfx.cpp @@ -0,0 +1,8 @@ +// stdafx.cpp : source file that includes just the standard includes +// Test.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + + + diff --git a/HouseLightingModel/StdAfx.h b/HouseLightingModel/StdAfx.h new file mode 100644 index 0000000..227ba92 --- /dev/null +++ b/HouseLightingModel/StdAfx.h @@ -0,0 +1,33 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#if !defined(AFX_STDAFX_H__40591CFA_4C1D_4FD7_8414_6EA0BBACA787__INCLUDED_) +#define AFX_STDAFX_H__40591CFA_4C1D_4FD7_8414_6EA0BBACA787__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers + +#include // MFC core and standard components +#include // MFC extensions +#include // MFC Automation classes +#include // MFC support for Internet Explorer 4 Common Controls +#ifndef _AFX_NO_AFXCMN_SUPPORT +#include // MFC support for Windows Common Controls +#endif // _AFX_NO_AFXCMN_SUPPORT +// 版权所有(2013) +// Copyright(2013) +// 编写者: 孔令德 +// Author: Kong Lingde +// 网址:www.klingde.com +// QQ:997796978 +// 地址:太原工业学院 计算机工程系 + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_STDAFX_H__40591CFA_4C1D_4FD7_8414_6EA0BBACA787__INCLUDED_) diff --git a/HouseLightingModel/Test.aps b/HouseLightingModel/Test.aps new file mode 100644 index 0000000..b8159cb Binary files /dev/null and b/HouseLightingModel/Test.aps differ diff --git a/HouseLightingModel/Test.clw b/HouseLightingModel/Test.clw new file mode 100644 index 0000000..eb77dd8 --- /dev/null +++ b/HouseLightingModel/Test.clw @@ -0,0 +1,101 @@ +; CLW file contains information for the MFC ClassWizard + +[General Info] +Version=1 +LastClass=CTestView +LastTemplate=CDialog +NewFileInclude1=#include "stdafx.h" +NewFileInclude2=#include "Test.h" +LastPage=0 + +ClassCount=5 +Class1=CTestApp +Class2=CTestDoc +Class3=CTestView +Class4=CMainFrame + +ResourceCount=2 +Resource1=IDR_MAINFRAME +Class5=CAboutDlg +Resource2=IDD_ABOUTBOX + +[CLS:CTestApp] +Type=0 +HeaderFile=Test.h +ImplementationFile=Test.cpp +Filter=N + +[CLS:CTestDoc] +Type=0 +HeaderFile=TestDoc.h +ImplementationFile=TestDoc.cpp +Filter=N + +[CLS:CTestView] +Type=0 +HeaderFile=TestView.h +ImplementationFile=TestView.cpp +Filter=C +BaseClass=CView +VirtualFilter=VWC +LastObject=CTestView + + +[CLS:CMainFrame] +Type=0 +HeaderFile=MainFrm.h +ImplementationFile=MainFrm.cpp +Filter=T +LastObject=IDM_PLAY + + + + +[CLS:CAboutDlg] +Type=0 +HeaderFile=Test.cpp +ImplementationFile=Test.cpp +Filter=D + +[DLG:IDD_ABOUTBOX] +Type=1 +Class=CAboutDlg +ControlCount=2 +Control1=IDOK,button,1342373889 +Control2=IDC_STATIC,static,1342177294 + +[MNU:IDR_MAINFRAME] +Type=1 +Class=CMainFrame +Command1=ID_APP_EXIT +Command2=IDM_PLAY +Command3=ID_APP_ABOUT +CommandCount=3 + +[ACL:IDR_MAINFRAME] +Type=1 +Class=CMainFrame +Command1=ID_FILE_NEW +Command2=ID_FILE_OPEN +Command3=ID_FILE_SAVE +Command4=ID_FILE_PRINT +Command5=ID_EDIT_UNDO +Command6=ID_EDIT_CUT +Command7=ID_EDIT_COPY +Command8=ID_EDIT_PASTE +Command9=ID_EDIT_UNDO +Command10=ID_EDIT_CUT +Command11=ID_EDIT_COPY +Command12=ID_EDIT_PASTE +Command13=ID_NEXT_PANE +Command14=ID_PREV_PANE +CommandCount=14 + +[TB:IDR_MAINFRAME] +Type=1 +Class=CMainFrame +Command1=ID_APP_EXIT +Command2=IDM_PLAY +Command3=ID_APP_ABOUT +CommandCount=3 + diff --git a/HouseLightingModel/Test.cpp b/HouseLightingModel/Test.cpp new file mode 100644 index 0000000..0d4eb5c --- /dev/null +++ b/HouseLightingModel/Test.cpp @@ -0,0 +1,154 @@ +// Test.cpp : Defines the class behaviors for the application. +// + +#include "stdafx.h" +#include "Test.h" + +#include "MainFrm.h" +#include "TestDoc.h" +#include "TestView.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CTestApp + +BEGIN_MESSAGE_MAP(CTestApp, CWinApp) + //{{AFX_MSG_MAP(CTestApp) + ON_COMMAND(ID_APP_ABOUT, OnAppAbout) + // NOTE - the ClassWizard will add and remove mapping macros here. + // DO NOT EDIT what you see in these blocks of generated code! + //}}AFX_MSG_MAP + // Standard file based document commands + ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew) + ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen) + // Standard print setup command + ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup) +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CTestApp construction + +CTestApp::CTestApp() +{ + // TODO: add construction code here, + // Place all significant initialization in InitInstance +} + +///////////////////////////////////////////////////////////////////////////// +// The one and only CTestApp object + +CTestApp theApp; + +///////////////////////////////////////////////////////////////////////////// +// CTestApp initialization + +BOOL CTestApp::InitInstance() +{ + AfxEnableControlContainer(); + + // Standard initialization + // If you are not using these features and wish to reduce the size + // of your final executable, you should remove from the following + // the specific initialization routines you do not need. + +#ifdef _AFXDLL + Enable3dControls(); // Call this when using MFC in a shared DLL +#else + Enable3dControlsStatic(); // Call this when linking to MFC statically +#endif + + // Change the registry key under which our settings are stored. + // TODO: You should modify this string to be something appropriate + // such as the name of your company or organization. + SetRegistryKey(_T("Local AppWizard-Generated Applications")); + + LoadStdProfileSettings(); // Load standard INI file options (including MRU) + + // Register the application's document templates. Document templates + // serve as the connection between documents, frame windows and views. + + CSingleDocTemplate* pDocTemplate; + pDocTemplate = new CSingleDocTemplate( + IDR_MAINFRAME, + RUNTIME_CLASS(CTestDoc), + RUNTIME_CLASS(CMainFrame), // main SDI frame window + RUNTIME_CLASS(CTestView)); + AddDocTemplate(pDocTemplate); + + // Parse command line for standard shell commands, DDE, file open + CCommandLineInfo cmdInfo; + ParseCommandLine(cmdInfo); + + // Dispatch commands specified on the command line + if (!ProcessShellCommand(cmdInfo)) + return FALSE; + + // The one and only window has been initialized, so show and update it. + m_pMainWnd->ShowWindow(SW_MAXIMIZE); + m_pMainWnd->SetWindowText("案例53:简单阴影算法"); + m_pMainWnd->UpdateWindow(); + return TRUE; +} + + +///////////////////////////////////////////////////////////////////////////// +// CAboutDlg dialog used for App About + +class CAboutDlg : public CDialog +{ +public: + CAboutDlg(); + +// Dialog Data + //{{AFX_DATA(CAboutDlg) + enum { IDD = IDD_ABOUTBOX }; + //}}AFX_DATA + + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CAboutDlg) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + +// Implementation +protected: + //{{AFX_MSG(CAboutDlg) + // No message handlers + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD) +{ + //{{AFX_DATA_INIT(CAboutDlg) + //}}AFX_DATA_INIT +} + +void CAboutDlg::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CAboutDlg) + //}}AFX_DATA_MAP +} + +BEGIN_MESSAGE_MAP(CAboutDlg, CDialog) + //{{AFX_MSG_MAP(CAboutDlg) + // No message handlers + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +// App command to run the dialog +void CTestApp::OnAppAbout() +{ + CAboutDlg aboutDlg; + aboutDlg.DoModal(); +} + +///////////////////////////////////////////////////////////////////////////// +// CTestApp message handlers + diff --git a/HouseLightingModel/Test.dsp b/HouseLightingModel/Test.dsp new file mode 100644 index 0000000..13bac65 --- /dev/null +++ b/HouseLightingModel/Test.dsp @@ -0,0 +1,302 @@ +# Microsoft Developer Studio Project File - Name="Test" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Application" 0x0101 + +CFG=Test - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "Test.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "Test.mak" CFG="Test - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "Test - Win32 Release" (based on "Win32 (x86) Application") +!MESSAGE "Test - Win32 Debug" (based on "Win32 (x86) Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "Test - Win32 Release" + +# PROP BASE Use_MFC 6 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 6 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Yu"stdafx.h" /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x804 /d "NDEBUG" /d "_AFXDLL" +# ADD RSC /l 0x804 /d "NDEBUG" /d "_AFXDLL" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386 +# ADD LINK32 /nologo /subsystem:windows /machine:I386 + +!ELSEIF "$(CFG)" == "Test - Win32 Debug" + +# PROP BASE Use_MFC 6 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 6 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /GZ /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /FR /Yu"stdafx.h" /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x804 /d "_DEBUG" /d "_AFXDLL" +# ADD RSC /l 0x804 /d "_DEBUG" /d "_AFXDLL" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept +# ADD LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept + +!ENDIF + +# Begin Target + +# Name "Test - Win32 Release" +# Name "Test - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\AET.cpp +# End Source File +# Begin Source File + +SOURCE=.\Bucket.cpp +# End Source File +# Begin Source File + +SOURCE=.\Face.cpp +# End Source File +# Begin Source File + +SOURCE=.\Light.cpp +# End Source File +# Begin Source File + +SOURCE=.\Lighting.cpp +# End Source File +# Begin Source File + +SOURCE=.\MainFrm.cpp +# End Source File +# Begin Source File + +SOURCE=.\Material.cpp +# End Source File +# Begin Source File + +SOURCE=.\P2.cpp +# End Source File +# Begin Source File + +SOURCE=.\P3.cpp +# End Source File +# Begin Source File + +SOURCE=.\Pi2.cpp +# End Source File +# Begin Source File + +SOURCE=.\Pi3.cpp +# End Source File +# Begin Source File + +SOURCE=.\RGB.cpp +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.cpp +# ADD CPP /Yc"stdafx.h" +# End Source File +# Begin Source File + +SOURCE=.\Test.cpp +# End Source File +# Begin Source File + +SOURCE=.\Test.rc +# End Source File +# Begin Source File + +SOURCE=.\TestDoc.cpp +# End Source File +# Begin Source File + +SOURCE=.\TestView.cpp +# End Source File +# Begin Source File + +SOURCE=".\Transform .cpp" +# End Source File +# Begin Source File + +SOURCE=.\Vector.cpp +# End Source File +# Begin Source File + +SOURCE=.\ZBuffer.cpp +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\AET.h +# End Source File +# Begin Source File + +SOURCE=.\Bucket.h +# End Source File +# Begin Source File + +SOURCE=.\Face.h +# End Source File +# Begin Source File + +SOURCE=.\Light.h +# End Source File +# Begin Source File + +SOURCE=.\Lighting.h +# End Source File +# Begin Source File + +SOURCE=.\MainFrm.h +# End Source File +# Begin Source File + +SOURCE=.\Material.h +# End Source File +# Begin Source File + +SOURCE=.\P2.h +# End Source File +# Begin Source File + +SOURCE=.\P3.h +# End Source File +# Begin Source File + +SOURCE=.\Pi2.h +# End Source File +# Begin Source File + +SOURCE=.\Pi3.h +# End Source File +# Begin Source File + +SOURCE=.\Resource.h +# End Source File +# Begin Source File + +SOURCE=.\RGB.h +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.h +# End Source File +# Begin Source File + +SOURCE=.\Test.h +# End Source File +# Begin Source File + +SOURCE=.\TestDoc.h +# End Source File +# Begin Source File + +SOURCE=.\TestView.h +# End Source File +# Begin Source File + +SOURCE=.\Transform.h +# End Source File +# Begin Source File + +SOURCE=.\Vector.h +# End Source File +# Begin Source File + +SOURCE=.\ZBuffer.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# Begin Source File + +SOURCE=.\res\about.bmp +# End Source File +# Begin Source File + +SOURCE=.\res\app.ico +# End Source File +# Begin Source File + +SOURCE=.\res\draw.ico +# End Source File +# Begin Source File + +SOURCE=.\res\exit.ico +# End Source File +# Begin Source File + +SOURCE=.\res\Help.ico +# End Source File +# Begin Source File + +SOURCE=.\res\Test.ico +# End Source File +# Begin Source File + +SOURCE=.\res\Test.rc2 +# End Source File +# Begin Source File + +SOURCE=.\res\TestDoc.ico +# End Source File +# Begin Source File + +SOURCE=.\res\Toolbar.bmp +# End Source File +# End Group +# Begin Source File + +SOURCE=.\ReadMe.txt +# End Source File +# End Target +# End Project diff --git a/HouseLightingModel/Test.dsw b/HouseLightingModel/Test.dsw new file mode 100644 index 0000000..d4e2b94 --- /dev/null +++ b/HouseLightingModel/Test.dsw @@ -0,0 +1,29 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! + +############################################################################### + +Project: "Test"=.\Test.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/HouseLightingModel/Test.h b/HouseLightingModel/Test.h new file mode 100644 index 0000000..15c93e0 --- /dev/null +++ b/HouseLightingModel/Test.h @@ -0,0 +1,49 @@ +// Test.h : main header file for the TEST application +// + +#if !defined(AFX_TEST_H__687EC7D4_477F_4BD3_BCC6_BD41AD64322D__INCLUDED_) +#define AFX_TEST_H__687EC7D4_477F_4BD3_BCC6_BD41AD64322D__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#ifndef __AFXWIN_H__ + #error include 'stdafx.h' before including this file for PCH +#endif + +#include "resource.h" // main symbols + +///////////////////////////////////////////////////////////////////////////// +// CTestApp: +// See Test.cpp for the implementation of this class +// + +class CTestApp : public CWinApp +{ +public: + CTestApp(); + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CTestApp) + public: + virtual BOOL InitInstance(); + //}}AFX_VIRTUAL + +// Implementation + //{{AFX_MSG(CTestApp) + afx_msg void OnAppAbout(); + // NOTE - the ClassWizard will add and remove member functions here. + // DO NOT EDIT what you see in these blocks of generated code ! + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + + +///////////////////////////////////////////////////////////////////////////// + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_TEST_H__687EC7D4_477F_4BD3_BCC6_BD41AD64322D__INCLUDED_) diff --git a/HouseLightingModel/Test.ncb b/HouseLightingModel/Test.ncb new file mode 100644 index 0000000..27f9273 Binary files /dev/null and b/HouseLightingModel/Test.ncb differ diff --git a/HouseLightingModel/Test.opt b/HouseLightingModel/Test.opt new file mode 100644 index 0000000..eddcb6d Binary files /dev/null and b/HouseLightingModel/Test.opt differ diff --git a/HouseLightingModel/Test.plg b/HouseLightingModel/Test.plg new file mode 100644 index 0000000..7bbc5a4 --- /dev/null +++ b/HouseLightingModel/Test.plg @@ -0,0 +1,121 @@ + + +
+

Build Log

+

+--------------------Configuration: Test - Win32 Debug-------------------- +

+

Command Lines

+Creating command line "rc.exe /l 0x804 /fo"Debug/Test.res" /d "_DEBUG" /d "_AFXDLL" "H:\2021秋计算机图形学\计算机图形学实践教程源码\案例53-简单阴影算法\Test.rc"" +Creating temporary file "C:\Users\ADMINI~1\AppData\Local\Temp\RSP114A.tmp" with contents +[ +/nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /FR"Debug/" /Fp"Debug/Test.pch" /Yu"stdafx.h" /Fo"Debug/" /Fd"Debug/" /FD /GZ /c +"H:\2021秋计算机图形学\计算机图形学实践教程源码\案例53-简单阴影算法\AET.cpp" +"H:\2021秋计算机图形学\计算机图形学实践教程源码\案例53-简单阴影算法\Bucket.cpp" +"H:\2021秋计算机图形学\计算机图形学实践教程源码\案例53-简单阴影算法\Face.cpp" +"H:\2021秋计算机图形学\计算机图形学实践教程源码\案例53-简单阴影算法\Light.cpp" +"H:\2021秋计算机图形学\计算机图形学实践教程源码\案例53-简单阴影算法\Lighting.cpp" +"H:\2021秋计算机图形学\计算机图形学实践教程源码\案例53-简单阴影算法\MainFrm.cpp" +"H:\2021秋计算机图形学\计算机图形学实践教程源码\案例53-简单阴影算法\Material.cpp" +"H:\2021秋计算机图形学\计算机图形学实践教程源码\案例53-简单阴影算法\P2.cpp" +"H:\2021秋计算机图形学\计算机图形学实践教程源码\案例53-简单阴影算法\P3.cpp" +"H:\2021秋计算机图形学\计算机图形学实践教程源码\案例53-简单阴影算法\Pi2.cpp" +"H:\2021秋计算机图形学\计算机图形学实践教程源码\案例53-简单阴影算法\Pi3.cpp" +"H:\2021秋计算机图形学\计算机图形学实践教程源码\案例53-简单阴影算法\RGB.cpp" +"H:\2021秋计算机图形学\计算机图形学实践教程源码\案例53-简单阴影算法\Test.cpp" +"H:\2021秋计算机图形学\计算机图形学实践教程源码\案例53-简单阴影算法\TestDoc.cpp" +"H:\2021秋计算机图形学\计算机图形学实践教程源码\案例53-简单阴影算法\TestView.cpp" +"H:\2021秋计算机图形学\计算机图形学实践教程源码\案例53-简单阴影算法\Transform .cpp" +"H:\2021秋计算机图形学\计算机图形学实践教程源码\案例53-简单阴影算法\Vector.cpp" +"H:\2021秋计算机图形学\计算机图形学实践教程源码\案例53-简单阴影算法\ZBuffer.cpp" +] +Creating command line "cl.exe @C:\Users\ADMINI~1\AppData\Local\Temp\RSP114A.tmp" +Creating temporary file "C:\Users\ADMINI~1\AppData\Local\Temp\RSP114B.tmp" with contents +[ +/nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /FR"Debug/" /Fp"Debug/Test.pch" /Yc"stdafx.h" /Fo"Debug/" /Fd"Debug/" /FD /GZ /c +"H:\2021秋计算机图形学\计算机图形学实践教程源码\案例53-简单阴影算法\StdAfx.cpp" +] +Creating command line "cl.exe @C:\Users\ADMINI~1\AppData\Local\Temp\RSP114B.tmp" +Creating temporary file "C:\Users\ADMINI~1\AppData\Local\Temp\RSP115B.tmp" with contents +[ +/nologo /subsystem:windows /incremental:yes /pdb:"Debug/Test.pdb" /debug /machine:I386 /out:"Debug/Test.exe" /pdbtype:sept +".\Debug\AET.obj" +".\Debug\Bucket.obj" +".\Debug\Face.obj" +".\Debug\Light.obj" +".\Debug\Lighting.obj" +".\Debug\MainFrm.obj" +".\Debug\Material.obj" +".\Debug\P2.obj" +".\Debug\P3.obj" +".\Debug\Pi2.obj" +".\Debug\Pi3.obj" +".\Debug\RGB.obj" +".\Debug\StdAfx.obj" +".\Debug\Test.obj" +".\Debug\TestDoc.obj" +".\Debug\TestView.obj" +".\Debug\Transform .obj" +".\Debug\Vector.obj" +".\Debug\ZBuffer.obj" +".\Debug\Test.res" +] +Creating command line "link.exe @C:\Users\ADMINI~1\AppData\Local\Temp\RSP115B.tmp" +

Output Window

+Compiling resources... +Compiling... +StdAfx.cpp +Compiling... +AET.cpp +Bucket.cpp +Face.cpp +Light.cpp +Lighting.cpp +MainFrm.cpp +Material.cpp +P2.cpp +P3.cpp +Pi2.cpp +Pi3.cpp +RGB.cpp +Test.cpp +TestDoc.cpp +TestView.cpp +Transform .cpp +Vector.cpp +ZBuffer.cpp +Generating Code... +Linking... +Creating temporary file "C:\Users\ADMINI~1\AppData\Local\Temp\RSP47ED.tmp" with contents +[ +/nologo /o"Debug/Test.bsc" +".\Debug\StdAfx.sbr" +".\Debug\AET.sbr" +".\Debug\Bucket.sbr" +".\Debug\Face.sbr" +".\Debug\Light.sbr" +".\Debug\Lighting.sbr" +".\Debug\MainFrm.sbr" +".\Debug\Material.sbr" +".\Debug\P2.sbr" +".\Debug\P3.sbr" +".\Debug\Pi2.sbr" +".\Debug\Pi3.sbr" +".\Debug\RGB.sbr" +".\Debug\Test.sbr" +".\Debug\TestDoc.sbr" +".\Debug\TestView.sbr" +".\Debug\Transform .sbr" +".\Debug\Vector.sbr" +".\Debug\ZBuffer.sbr"] +Creating command line "bscmake.exe @C:\Users\ADMINI~1\AppData\Local\Temp\RSP47ED.tmp" +Creating browse info file... +

Output Window

+ + + +

Results

+Test.exe - 0 error(s), 0 warning(s) +
+ + diff --git a/HouseLightingModel/Test.rc b/HouseLightingModel/Test.rc new file mode 100644 index 0000000..d5293d9 --- /dev/null +++ b/HouseLightingModel/Test.rc @@ -0,0 +1,384 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// Chinese (P.R.C.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHS) +#ifdef _WIN32 +LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED +#pragma code_page(936) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "#define _AFX_NO_SPLITTER_RESOURCES\r\n" + "#define _AFX_NO_OLE_RESOURCES\r\n" + "#define _AFX_NO_TRACKER_RESOURCES\r\n" + "#define _AFX_NO_PROPERTY_RESOURCES\r\n" + "\r\n" + "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHS)\r\n" + "#ifdef _WIN32\r\n" + "LANGUAGE 4, 2\r\n" + "#pragma code_page(936)\r\n" + "#endif //_WIN32\r\n" + "#include ""res\\Test.rc2"" // non-Microsoft Visual C++ edited resources\r\n" + "#include ""l.chs\\afxres.rc"" // Standard components\r\n" + "#include ""l.chs\\afxprint.rc"" // printing/print preview resources\r\n" + "#endif\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDR_MAINFRAME ICON DISCARDABLE "res\\Test.ico" +IDR_TESTTYPE ICON DISCARDABLE "res\\TestDoc.ico" +IDI_ICON1 ICON DISCARDABLE "res\\Help.ico" +IDI_ICON2 ICON DISCARDABLE "res\\app.ico" +IDI_ICON3 ICON DISCARDABLE "res\\draw.ico" +IDI_ICON4 ICON DISCARDABLE "res\\exit.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// + +IDR_MAINFRAME BITMAP MOVEABLE PURE "res\\Toolbar.bmp" +IDB_ABOUT BITMAP DISCARDABLE "res\\about.bmp" + +///////////////////////////////////////////////////////////////////////////// +// +// Toolbar +// + +IDR_MAINFRAME TOOLBAR DISCARDABLE 32, 32 +BEGIN + BUTTON ID_APP_EXIT + BUTTON IDM_PLAY + BUTTON ID_APP_ABOUT +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +IDR_MAINFRAME MENU PRELOAD DISCARDABLE +BEGIN + POPUP "文件(&F)" + BEGIN + MENUITEM "退出(&X)", ID_APP_EXIT + END + POPUP "绘图" + BEGIN + MENUITEM "Play", IDM_PLAY + END + POPUP "帮助(&H)" + BEGIN + MENUITEM "关于 Test(&A)...", ID_APP_ABOUT + END +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Accelerator +// + +IDR_MAINFRAME ACCELERATORS PRELOAD MOVEABLE PURE +BEGIN + "N", ID_FILE_NEW, VIRTKEY, CONTROL + "O", ID_FILE_OPEN, VIRTKEY, CONTROL + "S", ID_FILE_SAVE, VIRTKEY, CONTROL + "P", ID_FILE_PRINT, VIRTKEY, CONTROL + "Z", ID_EDIT_UNDO, VIRTKEY, CONTROL + "X", ID_EDIT_CUT, VIRTKEY, CONTROL + "C", ID_EDIT_COPY, VIRTKEY, CONTROL + "V", ID_EDIT_PASTE, VIRTKEY, CONTROL + VK_BACK, ID_EDIT_UNDO, VIRTKEY, ALT + VK_DELETE, ID_EDIT_CUT, VIRTKEY, SHIFT + VK_INSERT, ID_EDIT_COPY, VIRTKEY, CONTROL + VK_INSERT, ID_EDIT_PASTE, VIRTKEY, SHIFT + VK_F6, ID_NEXT_PANE, VIRTKEY + VK_F6, ID_PREV_PANE, VIRTKEY, SHIFT +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_ABOUTBOX DIALOG DISCARDABLE 0, 0, 223, 180 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "关于 Test" +FONT 9, "宋体" +BEGIN + DEFPUSHBUTTON "确定",IDOK,86,158,50,14,WS_GROUP + CONTROL 134,IDC_STATIC,"Static",SS_BITMAP,11,7,200,150 +END + + +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "080404B0" + BEGIN + VALUE "CompanyName", "\0" + VALUE "FileDescription", "Test Microsoft 基础类应用程序\0" + VALUE "FileVersion", "1, 0, 0, 1\0" + VALUE "InternalName", "Test\0" + VALUE "LegalCopyright", "版权所有 (C) 2006\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "Test.EXE\0" + VALUE "ProductName", "Test 应用程序\0" + VALUE "ProductVersion", "1, 0, 0, 1\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x804, 1200 + END +END + +#endif // !_MAC + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO DISCARDABLE +BEGIN + IDD_ABOUTBOX, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 216 + TOPMARGIN, 7 + BOTTOMMARGIN, 173 + END +END +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE PRELOAD DISCARDABLE +BEGIN + IDR_MAINFRAME "Test\n\nTest\n\n\nTest.Document\nTest Document" +END + +STRINGTABLE PRELOAD DISCARDABLE +BEGIN + AFX_IDS_APP_TITLE "Test" + AFX_IDS_IDLEMESSAGE "就绪" +END + +STRINGTABLE DISCARDABLE +BEGIN + ID_INDICATOR_EXT "扩展名" + ID_INDICATOR_CAPS "大写" + ID_INDICATOR_NUM "数字" + ID_INDICATOR_SCRL "滚动" + ID_INDICATOR_OVR "改写" + ID_INDICATOR_REC "记录" +END + +STRINGTABLE DISCARDABLE +BEGIN + ID_FILE_NEW "建立新文档\n新建" + ID_FILE_OPEN "打开一个现有文档\n打开" + ID_FILE_CLOSE "关闭活动文档\n关闭" + ID_FILE_SAVE "保存活动文档\n保存" + ID_FILE_SAVE_AS "将活动文档以一个新文件名保存\n另存为" + ID_FILE_PAGE_SETUP "改变打印选项\n页面设置" + ID_FILE_PRINT_SETUP "改变打印机及打印选项\n打印设置" + ID_FILE_PRINT "打印活动文档\n打印" + ID_FILE_PRINT_PREVIEW "显示整页\n打印预览" +END + +STRINGTABLE DISCARDABLE +BEGIN + ID_APP_ABOUT "开发人员信息\n关于" + ID_APP_EXIT "退出应用程序\n退出" +END + +STRINGTABLE DISCARDABLE +BEGIN + ID_FILE_MRU_FILE1 "打开该文档" + ID_FILE_MRU_FILE2 "打开该文档" + ID_FILE_MRU_FILE3 "打开该文档" + ID_FILE_MRU_FILE4 "打开该文档" + ID_FILE_MRU_FILE5 "打开该文档" + ID_FILE_MRU_FILE6 "打开该文档" + ID_FILE_MRU_FILE7 "打开该文档" + ID_FILE_MRU_FILE8 "打开该文档" + ID_FILE_MRU_FILE9 "打开该文档" + ID_FILE_MRU_FILE10 "打开该文档" + ID_FILE_MRU_FILE11 "打开该文档" + ID_FILE_MRU_FILE12 "打开该文档" + ID_FILE_MRU_FILE13 "打开该文档" + ID_FILE_MRU_FILE14 "打开该文档" + ID_FILE_MRU_FILE15 "打开该文档" + ID_FILE_MRU_FILE16 "打开该文档" +END + +STRINGTABLE DISCARDABLE +BEGIN + ID_NEXT_PANE "切换到下一个窗格\n下一窗格" + ID_PREV_PANE "切换回前一个窗格\n前一窗格" +END + +STRINGTABLE DISCARDABLE +BEGIN + ID_WINDOW_SPLIT "将活动的窗口分隔成窗格\n分隔" +END + +STRINGTABLE DISCARDABLE +BEGIN + ID_EDIT_CLEAR "删除被选对象\n删除" + ID_EDIT_CLEAR_ALL "全部删除\n全部删除" + ID_EDIT_COPY "复制被选对象并将其置于剪贴板上\n复制" + ID_EDIT_CUT "剪切被选对象并将其置于剪贴板上\n剪切" + ID_EDIT_FIND "查找指定的正文\n查找" + ID_EDIT_PASTE "插入剪贴板内容\n粘贴" + ID_EDIT_REPEAT "重复上一步操作\n重复" + ID_EDIT_REPLACE "用不同的正文替换指定的正文\n替换" + ID_EDIT_SELECT_ALL "选择整个文档\n选择全部" + ID_EDIT_UNDO "撤消最后一步操作\n撤消" + ID_EDIT_REDO "重新执行先前已撤消的操作\n重新执行" +END + +STRINGTABLE DISCARDABLE +BEGIN + ID_VIEW_TOOLBAR "显示或隐藏工具栏\n显隐工具栏" + ID_VIEW_STATUS_BAR "显示或隐藏状态栏\n显隐状态栏" +END + +STRINGTABLE DISCARDABLE +BEGIN + AFX_IDS_SCSIZE "改变窗口大小" + AFX_IDS_SCMOVE "改变窗口位置" + AFX_IDS_SCMINIMIZE "将窗口缩小成图标" + AFX_IDS_SCMAXIMIZE "把窗口放大到最大尺寸" + AFX_IDS_SCNEXTWINDOW "切换到下一个文档窗口" + AFX_IDS_SCPREVWINDOW "切换到先前的文档窗口" + AFX_IDS_SCCLOSE "关闭活动的窗口并提示保存所有文档" +END + +STRINGTABLE DISCARDABLE +BEGIN + AFX_IDS_SCRESTORE "把窗口恢复到正常大小" + AFX_IDS_SCTASKLIST "激活任务表" +END + +STRINGTABLE DISCARDABLE +BEGIN + AFX_IDS_PREVIEW_CLOSE "关闭打印预览模式\n取消预阅" +END + +STRINGTABLE DISCARDABLE +BEGIN + ID_MENUAntiliasing "绘制图形\n绘图" + ID_MENUMbline "绘制图形\n绘图" + ID_MENULine "绘制任意方向上的直线\n绘制" + ID_DRAW "圆环/n圆环" +END + +STRINGTABLE DISCARDABLE +BEGIN + ID_DRAWCIRQUE "圆环\n圆环" + ID_MENUPlay "动画演示\n动画" + ID_MENUDECREASE "距离减小\n减小" + ID_MENUINCREASE "距离增加\n增加" + IDM_PLAY "动画演示\n动画" +END + +#endif // Chinese (P.R.C.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +#define _AFX_NO_SPLITTER_RESOURCES +#define _AFX_NO_OLE_RESOURCES +#define _AFX_NO_TRACKER_RESOURCES +#define _AFX_NO_PROPERTY_RESOURCES + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHS) +#ifdef _WIN32 +LANGUAGE 4, 2 +#pragma code_page(936) +#endif //_WIN32 +#include "res\Test.rc2" // non-Microsoft Visual C++ edited resources +#include "l.chs\afxres.rc" // Standard components +#include "l.chs\afxprint.rc" // printing/print preview resources +#endif + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/HouseLightingModel/Test.sdf b/HouseLightingModel/Test.sdf new file mode 100644 index 0000000..df57571 Binary files /dev/null and b/HouseLightingModel/Test.sdf differ diff --git a/HouseLightingModel/Test.sln b/HouseLightingModel/Test.sln new file mode 100644 index 0000000..b215918 --- /dev/null +++ b/HouseLightingModel/Test.sln @@ -0,0 +1,20 @@ +锘� +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Test", "Test.vcxproj", "{44910AEF-82E9-A969-B8F7-76477AEB09AF}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {44910AEF-82E9-A969-B8F7-76477AEB09AF}.Debug|Win32.ActiveCfg = Debug|Win32 + {44910AEF-82E9-A969-B8F7-76477AEB09AF}.Debug|Win32.Build.0 = Debug|Win32 + {44910AEF-82E9-A969-B8F7-76477AEB09AF}.Release|Win32.ActiveCfg = Release|Win32 + {44910AEF-82E9-A969-B8F7-76477AEB09AF}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/HouseLightingModel/Test.suo b/HouseLightingModel/Test.suo new file mode 100644 index 0000000..978cfb1 Binary files /dev/null and b/HouseLightingModel/Test.suo differ diff --git a/HouseLightingModel/Test.vcxproj b/HouseLightingModel/Test.vcxproj new file mode 100644 index 0000000..d44e7d4 --- /dev/null +++ b/HouseLightingModel/Test.vcxproj @@ -0,0 +1,203 @@ +锘� + + + + Debug + Win32 + + + Release + Win32 + + + + + + MFCProj + {44910AEF-82E9-A969-B8F7-76477AEB09AF} + 10.0 + + + + Application + Dynamic + MultiByte + v143 + + + Application + Dynamic + MultiByte + v143 + + + + + + + + + + + + + + + .\Release\ + .\Release\ + false + + + .\Debug\ + .\Debug\ + true + + + + MultiThreadedDLL + OnlyExplicitInline + true + true + MaxSpeed + true + Level3 + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + .\Release\ + .\Release\Test.pch + Use + stdafx.h + .\Release\ + .\Release\ + + + true + NDEBUG;%(PreprocessorDefinitions) + .\Release\Test.tlb + true + Win32 + + + 0x0804 + NDEBUG;%(PreprocessorDefinitions) + + + true + .\Release\Test.bsc + + + true + Windows + .\Release\Test.exe + + + + + MultiThreadedDebugDLL + Default + true + Disabled + true + Level3 + true + EditAndContinue + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + .\Debug\ + true + .\Debug\Test.pch + Use + stdafx.h + .\Debug\ + .\Debug\ + EnableFastChecks + + + true + _DEBUG;%(PreprocessorDefinitions) + .\Debug\Test.tlb + true + Win32 + + + 0x0804 + _DEBUG;%(PreprocessorDefinitions) + + + true + .\Debug\Test.bsc + + + true + true + Windows + .\Debug\Test.exe + + + + + + + + + + + + + + + + + Create + stdafx.h + Create + stdafx.h + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + RC + + + + + + + + + \ No newline at end of file diff --git a/HouseLightingModel/Test.vcxproj.filters b/HouseLightingModel/Test.vcxproj.filters new file mode 100644 index 0000000..e17e1c5 --- /dev/null +++ b/HouseLightingModel/Test.vcxproj.filters @@ -0,0 +1,173 @@ +锘� + + + + {2bb58d71-3bef-4416-8b52-c765513aab91} + cpp;c;cxx;rc;def;r;odl;idl;hpj;bat + + + {5b8506c8-6098-42d5-8cbf-b58983ddf1b0} + h;hpp;hxx;hm;inl + + + {31a57030-d0f4-48f9-a2a6-59df685e0880} + ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + + \ No newline at end of file diff --git a/HouseLightingModel/Test.vcxproj.user b/HouseLightingModel/Test.vcxproj.user new file mode 100644 index 0000000..ace9a86 --- /dev/null +++ b/HouseLightingModel/Test.vcxproj.user @@ -0,0 +1,3 @@ +锘� + + \ No newline at end of file diff --git a/HouseLightingModel/TestDoc.cpp b/HouseLightingModel/TestDoc.cpp new file mode 100644 index 0000000..b35f16f --- /dev/null +++ b/HouseLightingModel/TestDoc.cpp @@ -0,0 +1,84 @@ +// TestDoc.cpp : implementation of the CTestDoc class +// + +#include "stdafx.h" +#include "Test.h" + +#include "TestDoc.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CTestDoc + +IMPLEMENT_DYNCREATE(CTestDoc, CDocument) + +BEGIN_MESSAGE_MAP(CTestDoc, CDocument) + //{{AFX_MSG_MAP(CTestDoc) + // NOTE - the ClassWizard will add and remove mapping macros here. + // DO NOT EDIT what you see in these blocks of generated code! + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CTestDoc construction/destruction + +CTestDoc::CTestDoc() +{ + // TODO: add one-time construction code here + +} + +CTestDoc::~CTestDoc() +{ +} + +BOOL CTestDoc::OnNewDocument() +{ + if (!CDocument::OnNewDocument()) + return FALSE; + + // TODO: add reinitialization code here + // (SDI documents will reuse this document) + + return TRUE; +} + + + +///////////////////////////////////////////////////////////////////////////// +// CTestDoc serialization + +void CTestDoc::Serialize(CArchive& ar) +{ + if (ar.IsStoring()) + { + // TODO: add storing code here + } + else + { + // TODO: add loading code here + } +} + +///////////////////////////////////////////////////////////////////////////// +// CTestDoc diagnostics + +#ifdef _DEBUG +void CTestDoc::AssertValid() const +{ + CDocument::AssertValid(); +} + +void CTestDoc::Dump(CDumpContext& dc) const +{ + CDocument::Dump(dc); +} +#endif //_DEBUG + +///////////////////////////////////////////////////////////////////////////// +// CTestDoc commands diff --git a/HouseLightingModel/TestDoc.h b/HouseLightingModel/TestDoc.h new file mode 100644 index 0000000..2638266 --- /dev/null +++ b/HouseLightingModel/TestDoc.h @@ -0,0 +1,57 @@ +// TestDoc.h : interface of the CTestDoc class +// +///////////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_TESTDOC_H__72DBD624_92AB_462A_B0FD_D3F54BA45097__INCLUDED_) +#define AFX_TESTDOC_H__72DBD624_92AB_462A_B0FD_D3F54BA45097__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + + +class CTestDoc : public CDocument +{ +protected: // create from serialization only + CTestDoc(); + DECLARE_DYNCREATE(CTestDoc) + +// Attributes +public: + +// Operations +public: + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CTestDoc) + public: + virtual BOOL OnNewDocument(); + virtual void Serialize(CArchive& ar); + //}}AFX_VIRTUAL + +// Implementation +public: + virtual ~CTestDoc(); +#ifdef _DEBUG + virtual void AssertValid() const; + virtual void Dump(CDumpContext& dc) const; +#endif + +protected: + +// Generated message map functions +protected: + //{{AFX_MSG(CTestDoc) + // NOTE - the ClassWizard will add and remove member functions here. + // DO NOT EDIT what you see in these blocks of generated code ! + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +///////////////////////////////////////////////////////////////////////////// + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_TESTDOC_H__72DBD624_92AB_462A_B0FD_D3F54BA45097__INCLUDED_) diff --git a/HouseLightingModel/TestView.cpp b/HouseLightingModel/TestView.cpp new file mode 100644 index 0000000..462714b --- /dev/null +++ b/HouseLightingModel/TestView.cpp @@ -0,0 +1,500 @@ +// TestView.cpp : implementation of the CTestView class +// + +#include "stdafx.h" +#include "Test.h" +#include "TestDoc.h" +#include "TestView.h" +#include "math.h" +#define Round(d) int(floor(d + 0.5)) // 四舍五入宏定义 +#define PI 3.1415926 +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CTestView + +IMPLEMENT_DYNCREATE(CTestView, CView) + +BEGIN_MESSAGE_MAP(CTestView, CView) +//{{AFX_MSG_MAP(CTestView) +ON_WM_KEYDOWN() +ON_WM_TIMER() +ON_WM_ERASEBKGND() +ON_COMMAND(IDM_PLAY, OnPlay) +ON_UPDATE_COMMAND_UI(IDM_PLAY, OnUpdatePlay) +//}}AFX_MSG_MAP +// Standard printing commands +ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint) +ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint) +ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview) +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CTestView construction/destruction + +CTestView::CTestView() { + // TODO: add construction code here + bPlay = FALSE; + R = 1000.0, d = 800.0, Phi = 70.0, Theta = 0.0; // 视点位于正前方 + Near = 200.0, Far = 1200.0; // 近剪切面与远剪切面 + Beta = 0.0; // 旋转角 + LightNum = 1; // 光源个数 + pLight = new CLighting(LightNum); // 一维光源动态数组 + pLight->Light[0].SetPosition(800, 800, 800); // 设置光源位置坐标 + for (int i = 0; i < LightNum; i++) { + pLight->Light[i].L_Diffuse = CRGB(1.0, 1.0, 1.0); // 光源的漫反射颜色 + pLight->Light[i].L_Specular = CRGB(1.0, 1.0, 1.0); // 光源镜面高光颜色 + pLight->Light[i].L_C0 = 1.0; // 常数衰减系数 + pLight->Light[i].L_C1 = 0.0000001; // 线性衰减系数 + pLight->Light[i].L_C2 = 0.00000001; // 二次衰减系数 + pLight->Light[i].L_OnOff = TRUE; // 光源开启 + } + pMaterial = new CMaterial; // 一维材质动态数组 + pMaterial->SetAmbient(CRGB(0.247, 0.200, 0.075)); // 材质对环境光光的反射率 + pMaterial->SetDiffuse(CRGB(0.752, 0.606, 0.226)); // 材质对漫反射光的反射率 + pMaterial->SetSpecular(CRGB(1.0, 1.0, 1.0)); // 材质对镜面反射光的反射率 + pMaterial->SetEmit(CRGB(0.05, 0.05, 0.002)); // 材质自身发散的颜色 + pMaterial->M_n = 30.0; // 高光指数 +} + +CTestView::~CTestView() { + if (pLight != NULL) { + delete pLight; + pLight = NULL; + } + if (pMaterial != NULL) { + delete pMaterial; + pMaterial = NULL; + } +} + +BOOL CTestView::PreCreateWindow(CREATESTRUCT &cs) { + // TODO: Modify the Window class or styles here by modifying + // the CREATESTRUCT cs + + return CView::PreCreateWindow(cs); +} + +///////////////////////////////////////////////////////////////////////////// +// CTestView drawing + +void CTestView::OnDraw(CDC *pDC) { + CTestDoc *pDoc = GetDocument(); + ASSERT_VALID(pDoc); + // TODO: add draw code for native data here + DoubleBuffer(); +} + +///////////////////////////////////////////////////////////////////////////// +// CTestView printing + +BOOL CTestView::OnPreparePrinting(CPrintInfo *pInfo) { + // default preparation + return DoPreparePrinting(pInfo); +} + +void CTestView::OnBeginPrinting(CDC * /*pDC*/, CPrintInfo * /*pInfo*/) { + // TODO: add extra initialization before printing +} + +void CTestView::OnEndPrinting(CDC * /*pDC*/, CPrintInfo * /*pInfo*/) { + // TODO: add cleanup after printing +} + +///////////////////////////////////////////////////////////////////////////// +// CTestView diagnostics + +#ifdef _DEBUG +void CTestView::AssertValid() const { + CView::AssertValid(); +} + +void CTestView::Dump(CDumpContext &dc) const { + CView::Dump(dc); +} + +CTestDoc *CTestView::GetDocument() // non-debug version is inline +{ + ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CTestDoc))); + return (CTestDoc *)m_pDocument; +} +#endif //_DEBUG + +///////////////////////////////////////////////////////////////////////////// +// CTestView message handlers + +void CTestView::ReadCubeVertex() // 读入立方体顶点坐标 +{ + // // 顶点的三维坐标(x,y,z),立方体边长为2a + // double a = 160; + // VCube[0].x = -a; + // VCube[0].y = -a; + // VCube[0].z = -a; + // VCube[1].x = +a; + // VCube[1].y = -a; + // VCube[1].z = -a; + // VCube[2].x = +a; + // VCube[2].y = +a; + // VCube[2].z = -a; + // VCube[3].x = -a; + // VCube[3].y = +a; + // VCube[3].z = -a; + // VCube[4].x = -a; + // VCube[4].y = -a; + // VCube[4].z = +a; + // VCube[5].x = +a; + // VCube[5].y = -a; + // VCube[5].z = +a; + // VCube[6].x = +a; + // VCube[6].y = +a; + // VCube[6].z = +a; + // VCube[7].x = -a; + // VCube[7].y = +a; + // VCube[7].z = +a; + VCube[0].z = 0; + VCube[0].x = 0; + VCube[0].y = 0; + VCube[1].z = 100; + VCube[1].x = 0; + VCube[1].y = 0; + VCube[2].z = 100; + VCube[2].x = 200; + VCube[2].y = 0; + VCube[3].z = 0; + VCube[3].x = 200; + VCube[3].y = 0; + VCube[4].z = 0; + VCube[4].x = 0; + VCube[4].y = 100; + VCube[5].z = 100; + VCube[5].x = 0; + VCube[5].y = 100; + VCube[6].z = 100; + VCube[6].x = 200; + VCube[6].y = 100; + VCube[7].z = 0; + VCube[7].x = 200; + VCube[7].y = 100; + VCube[8].z = 50; + VCube[8].x = 0; + VCube[8].y = 150; + VCube[9].z = 50; + VCube[9].x = 200; + VCube[9].y = 150; +} + +void CTestView::ReadCubeFace() // 读入立方体面表 +{ + // // 面的顶点数、面的顶点索引号与面的颜色 + // FCube[0].SetNum(4); + // FCube[0].vI[0] = 4; + // FCube[0].vI[1] = 5; + // FCube[0].vI[2] = 6; + // FCube[0].vI[3] = 7; + // FCube[1].SetNum(4); + // FCube[1].vI[0] = 0; + // FCube[1].vI[1] = 3; + // FCube[1].vI[2] = 2; + // FCube[1].vI[3] = 1; + // FCube[2].SetNum(4); + // FCube[2].vI[0] = 0; + // FCube[2].vI[1] = 4; + // FCube[2].vI[2] = 7; + // FCube[2].vI[3] = 3; + // FCube[3].SetNum(4); + // FCube[3].vI[0] = 1; + // FCube[3].vI[1] = 2; + // FCube[3].vI[2] = 6; + // FCube[3].vI[3] = 5; + // FCube[4].SetNum(4); + // FCube[4].vI[0] = 2; + // FCube[4].vI[1] = 3; + // FCube[4].vI[2] = 7; + // FCube[4].vI[3] = 6; + // FCube[5].SetNum(4); + // FCube[5].vI[0] = 0; + // FCube[5].vI[1] = 1; + // FCube[5].vI[2] = 5; + // FCube[5].vI[3] = 4; + FCube[0].SetNum(4); + FCube[0].vI[0] = 1; + FCube[0].vI[1] = 2; + FCube[0].vI[2] = 6; + FCube[0].vI[3] = 5; // 前面 + FCube[1].SetNum(4); + FCube[1].vI[0] = 0; + FCube[1].vI[1] = 4; + FCube[1].vI[2] = 7; + FCube[1].vI[3] = 3; // 后面 + FCube[2].SetNum(5); + FCube[2].vI[0] = 0; + FCube[2].vI[1] = 1; + FCube[2].vI[2] = 5; + FCube[2].vI[3] = 8; + FCube[2].vI[4] = 4; // 左面 + FCube[3].SetNum(5); + FCube[3].vI[0] = 2; + FCube[3].vI[1] = 3; + FCube[3].vI[2] = 7; + FCube[3].vI[3] = 9; + FCube[3].vI[4] = 6; // 右面 + FCube[4].SetNum(4); + FCube[4].vI[0] = 4; + FCube[4].vI[1] = 8; + FCube[4].vI[2] = 9; + FCube[4].vI[3] = 7; // 顶面1 + FCube[5].SetNum(4); + FCube[5].vI[0] = 0; + FCube[5].vI[1] = 3; + FCube[5].vI[2] = 2; + FCube[5].vI[3] = 1; // 底面 + FCube[6].SetNum(4); + FCube[6].vI[0] = 5; + FCube[6].vI[1] = 6; + FCube[6].vI[2] = 9; + FCube[6].vI[3] = 8; // 顶面2 +} + +void CTestView::ReadGroundVertex() // 读入地面点表 +{ + int Length = 800, Width = 800, Depth = 0; + VGround[0].x = -Length; + VGround[0].y = -Depth; + VGround[0].z = -Width; + VGround[0].c = CRGB(0.5, 0.5, 0.5); + VGround[1].x = -Length; + VGround[1].y = -Depth; + VGround[1].z = Width; + VGround[1].c = CRGB(0.5, 0.5, 0.5); + VGround[2].x = Length; + VGround[2].y = -Depth; + VGround[2].z = Width; + VGround[2].c = CRGB(0.5, 0.5, 0.5); + VGround[3].x = Length; + VGround[3].y = -Depth; + VGround[3].z = -Width; + VGround[3].c = CRGB(0.5, 0.5, 0.5); +} + +void CTestView::InitParameter() { + k[1] = sin(PI * Theta / 180); + k[2] = sin(PI * Phi / 180); + k[3] = cos(PI * Theta / 180); + k[4] = cos(PI * Phi / 180); + k[5] = k[2] * k[3]; + k[6] = k[2] * k[1]; + k[7] = k[4] * k[3]; + k[8] = k[4] * k[1]; + ViewPoint.x = R * k[6]; + ViewPoint.y = R * k[4]; + ViewPoint.z = R * k[5]; +} + +void CTestView::PerProject(CP3 P) { + CP3 ViewP; + ViewP.x = P.x * k[3] - P.z * k[1]; // 观察坐标系三维坐标 + ViewP.y = -P.x * k[8] + P.y * k[2] - P.z * k[7]; + ViewP.z = -P.x * k[6] - P.y * k[4] - P.z * k[5] + R; + ViewP.c = P.c; + ScreenP.x = d * ViewP.x / ViewP.z; // 屏幕坐标系三维坐标 + ScreenP.y = Round(d * ViewP.y / ViewP.z); + ScreenP.z = Far * (1 - Near / ViewP.z) / (Far - Near); + ScreenP.c = ViewP.c; +} + +void CTestView::DoubleBuffer() // 双缓冲 +{ + CDC *pDC = GetDC(); + CRect rect; // 定义客户区 + GetClientRect(&rect); // 获得客户区的大小 + pDC->SetMapMode(MM_ANISOTROPIC); // pDC自定义坐标系 + pDC->SetWindowExt(rect.Width(), rect.Height()); // 设置窗口范围 + pDC->SetViewportExt(rect.Width(), -rect.Height()); // x轴水平向右,y轴垂直向上 + pDC->SetViewportOrg(rect.Width() / 2, rect.Height() / 2); // 屏幕中心为原点 + CDC MemDC; // 内存DC + CBitmap NewBitmap, *pOldBitmap; // 内存中承载图像的临时位图 + MemDC.CreateCompatibleDC(pDC); // 建立与屏幕pDC兼容的MemDC + NewBitmap.CreateCompatibleBitmap(pDC, rect.Width(), rect.Height()); // 创建兼容位图 + pOldBitmap = MemDC.SelectObject(&NewBitmap); // 将兼容位图选入MemDC + MemDC.SetMapMode(MM_ANISOTROPIC); // MemDC自定义坐标系 + MemDC.SetWindowExt(rect.Width(), rect.Height()); + MemDC.SetViewportExt(rect.Width(), -rect.Height()); + MemDC.SetViewportOrg(rect.Width() / 2, rect.Height() / 2); + DrawObject(&MemDC); + pDC->BitBlt(-rect.Width() / 2, -rect.Height() / 2, rect.Width(), rect.Height(), &MemDC, -rect.Width() / 2, -rect.Height() / 2, SRCCOPY); // 将内存位图拷贝到屏幕 + MemDC.SelectObject(pOldBitmap); // 恢复位图 + NewBitmap.DeleteObject(); // 删除位图 + ReleaseDC(pDC); // 释放DC +} + +void CTestView::DrawObject(CDC *pDC) // 绘制物体 +{ + CZBuffer *zbuf = new CZBuffer; // 申请深度缓冲内存 + zbuf->InitDeepBuffer(1500, 1000, 1000); // 初始化深度缓冲器 + DrawGround(pDC); + DrawCube(pDC, zbuf); + DrawShadow(pDC, zbuf); + delete zbuf; // 释放内存 +} + +void CTestView::DrawCube(CDC *pDC, CZBuffer *zbuffer) // 绘制立方体 +{ + CPi3 Point[5]; // 面的二维顶点数组 + for (int nFace = 0; nFace < 7; nFace++) // 面循环 + { + CVector ViewVector(VCube[FCube[nFace].vI[0]], ViewPoint); // 面的视矢量 + ViewVector = ViewVector.Normalize(); // 单位化视矢量 + FCube[nFace].SetFaceNormal(VCube[FCube[nFace].vI[0]], VCube[FCube[nFace].vI[1]], VCube[FCube[nFace].vI[2]]); + FCube[nFace].fNormal.Normalize(); // 单位化法矢量 + if (Dot(ViewVector, FCube[nFace].fNormal) >= 0) // 背面剔除 + { + for (int nVertex = 0; nVertex < FCube[nFace].vN; nVertex++) // 顶点循环 + { + PerProject(VCube[FCube[nFace].vI[nVertex]]); // 透视投影 + Point[nVertex] = ScreenP; + Point[nVertex].c = pLight->Lighting(ViewPoint, VCube[FCube[nFace].vI[nVertex]], FCube[nFace].fNormal, pMaterial); + } + zbuffer->SetPoint(Point, FCube[nFace].vN); // 设置顶点 + zbuffer->CreateBucket(); // 创建桶表 + zbuffer->CreateEdge(); // 创建边表 + zbuffer->Gouraud(pDC); // 填充四边形 + zbuffer->ClearMemory(); + } + } +} + +void CTestView::DrawGround(CDC *pDC) // 绘制地面 +{ + CPi3 Point[4]; // 面的二维顶点数组 + for (int nVertex = 0; nVertex < 4; nVertex++) { + PerProject(VGround[nVertex]); + Point[nVertex] = ScreenP; + } + CBrush NewBrush; + NewBrush.CreateSolidBrush(RGB(100, 100, 100)); + CBrush *pOldBrush = pDC->SelectObject(&NewBrush); + pDC->BeginPath(); + pDC->MoveTo(Round(Point[0].x), Point[0].y); // 绘制左侧多边形 + for (int i = 1; i < 4; i++) + pDC->LineTo(Round(Point[i].x), Point[i].y); + pDC->LineTo(Round(Point[0].x), Point[0].y); + pDC->EndPath(); + pDC->FillPath(); // FillPath填充路径层 + pDC->SelectObject(pOldBrush); + NewBrush.DeleteObject(); +} + +void CTestView::DrawShadow(CDC *pDC, CZBuffer *zbuffer) // 绘制阴影 +{ + CPi3 Point[5]; // 面的二维顶点数组 + for (int nFace = 0; nFace < 7; nFace++) // 遍历表面 + { + // 光源做为视点 + CVector ViewVector(VCube[FCube[nFace].vI[0]], pLight->Light[0].L_Position); // 面的视矢量 + ViewVector = ViewVector.Normalize(); // 单位化视矢量 + FCube[nFace].SetFaceNormal(VCube[FCube[nFace].vI[0]], VCube[FCube[nFace].vI[1]], VCube[FCube[nFace].vI[2]]); + FCube[nFace].fNormal.Normalize(); // 单位化法矢量 + if (Dot(ViewVector, FCube[nFace].fNormal) < 0) // 绘制阴影 + { + for (int nVertex = 0; nVertex < FCube[nFace].vN; nVertex++) // 顶点循环 + { + VCube[FCube[nFace].vI[nVertex]].c = CRGB(0.2, 0.2, 0.2); // 阴影颜色 + PerProject(CalculateCrossPoint(pLight->Light[0].L_Position, VCube[FCube[nFace].vI[nVertex]])); // 计算该背光面上的顶点和光线连线和地面的交点 + Point[nVertex] = ScreenP; + } + zbuffer->SetPoint(Point, FCube[nFace].vN); // 设置顶点 + zbuffer->CreateBucket(); // 创建桶表 + zbuffer->CreateEdge(); // 创建边表 + zbuffer->Gouraud(pDC); // 颜色渐变填充四边形 + zbuffer->ClearMemory(); + } + } +} + +CP3 CTestView::CalculateCrossPoint(CP3 p0, CP3 p1) // 计算光线和地面的交点(第一个参数是光源,第二个参数是物体顶点) +{ + CP3 p; + double A, B, C, D; // 平面方程Ax+By+Cz+D=0的系数 + CVector V01(VGround[0], VGround[1]), V02(VGround[0], VGround[2]); + CVector VN = Cross(V01, V02); + A = VN.x; + B = VN.y; + C = VN.z; + D = -A * VGround[0].x - B * VGround[0].y - C * VGround[0].z; + double t; // 计算直线参数方程的公共系数t + t = -(A * p0.x + B * p0.y + C * p0.z + D) / (A * (p1.x - p0.x) + B * (p1.y - p0.y) + C * (p1.z - p0.z)); + p.x = p0.x + t * (p1.x - p0.x); // 代入参数方程计算交点坐标 + p.y = p0.y + t * (p1.y - p0.y); + p.z = p0.z + t * (p1.z - p0.z); + p.c = CRGB(p1.c.red, p1.c.green, p1.c.blue); + return p; +} + +void CTestView::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) { + // TODO: Add your message handler code here and/or call default + if (!bPlay) { + switch (nChar) { + case VK_LEFT: + Beta = -5; + tran.RotateY(Beta); + break; + case VK_RIGHT: + Beta = 5; + tran.RotateY(Beta); + break; + default: + break; + } + Invalidate(FALSE); + } + CView::OnKeyDown(nChar, nRepCnt, nFlags); +} + +void CTestView::OnPlay() { + // TODO: Add your command handler code here + bPlay = bPlay ? FALSE : TRUE; + if (bPlay) // 设置定时器 + SetTimer(1, 150, NULL); + else + KillTimer(1); +} + +void CTestView::OnTimer(UINT nIDEvent) { + // TODO: Add your message handler code here and/or call default + Beta = 5; + tran.RotateY(Beta); + Invalidate(FALSE); + CView::OnTimer(nIDEvent); +} + +BOOL CTestView::OnEraseBkgnd(CDC *pDC) // 禁止背景刷新 +{ + // TODO: Add your message handler code here and/or call default + return TRUE; +} + +void CTestView::OnUpdatePlay(CCmdUI *pCmdUI) { + // TODO: Add your command update UI handler code here + if (bPlay) { + pCmdUI->SetCheck(TRUE); + pCmdUI->SetText("停止"); + } + else { + pCmdUI->SetCheck(FALSE); + pCmdUI->SetText("播放"); + } +} + +void CTestView::OnInitialUpdate() { + CView::OnInitialUpdate(); + // TODO: Add your specialized code here and/or call the base class + ReadGroundVertex(); + ReadCubeVertex(); + ReadCubeFace(); + tran.SetMat(VCube, 10); + InitParameter(); +} diff --git a/HouseLightingModel/TestView.h b/HouseLightingModel/TestView.h new file mode 100644 index 0000000..0cb8f21 --- /dev/null +++ b/HouseLightingModel/TestView.h @@ -0,0 +1,99 @@ +// TestView.h : interface of the CTestView class +// +///////////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_TESTVIEW_H__A75FDCFB_621C_4E38_A154_C344803E6372__INCLUDED_) +#define AFX_TESTVIEW_H__A75FDCFB_621C_4E38_A154_C344803E6372__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +#include "Face.h" +#include "Vector.h" +#include "ZBuffer.h" +#include "Lighting.h" +#include "Transform.h" + +class CTestView : public CView { +protected: // create from serialization only + CTestView(); + DECLARE_DYNCREATE(CTestView) + + // Attributes +public: + CTestDoc *GetDocument(); + + // Operations +public: + void ReadCubeVertex(); // 读入立方体顶点 + void ReadCubeFace(); // 读入立方体面表 + void ReadGroundVertex(); // 读入地面顶点 + void InitParameter(); // 变换参数 + void PerProject(CP3); // 透视投影 + void DoubleBuffer(); // 双缓冲 + void DrawObject(CDC *); // 绘制物体 + void DrawCube(CDC *, CZBuffer *); // 绘制立方体 + void DrawGround(CDC *); // 绘制地面 + void DrawShadow(CDC *pDC, CZBuffer *); // 绘制阴影 + CP3 CalculateCrossPoint(CP3, CP3); // 计算光线与地面的交点 + // Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CTestView) +public: + virtual void OnDraw(CDC *pDC); // overridden to draw this view + virtual BOOL PreCreateWindow(CREATESTRUCT &cs); + virtual void OnInitialUpdate(); + +protected: + virtual BOOL OnPreparePrinting(CPrintInfo *pInfo); + virtual void OnBeginPrinting(CDC *pDC, CPrintInfo *pInfo); + virtual void OnEndPrinting(CDC *pDC, CPrintInfo *pInfo); + //}}AFX_VIRTUAL + + // Implementation +public: + virtual ~CTestView(); +#ifdef _DEBUG + virtual void AssertValid() const; + virtual void Dump(CDumpContext &dc) const; +#endif + +protected: + double R, Theta, Phi; // 视点在用户坐标系中的球坐标 + double d; // 视距 + double Near, Far; // 远近剪切面 + double k[9]; // 透视变换参数 + CP3 ViewPoint; // 视点球坐标位置 + CPi3 ScreenP; // 屏幕坐标系的三维坐标点 + double Beta; // y方向旋转β角 + CP3 VCube[10]; // 立方体点表 + CFace FCube[7]; // 立方体面表 + CP3 VGround[4]; // 地面顶点表 + int N1, N2; // N1为纬度区间,N2为经度区间 + int LightNum; // 光源数量 + CLighting *pLight; // 光照环境 + CMaterial *pMaterial; // 物体材质 + BOOL bPlay; // 动画开关 + CTransform tran; // 变换对象 + // Generated message map functions +public: + //{{AFX_MSG(CTestView) + afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags); + afx_msg void OnTimer(UINT nIDEvent); + afx_msg BOOL OnEraseBkgnd(CDC *pDC); + afx_msg void OnPlay(); + afx_msg void OnUpdatePlay(CCmdUI *pCmdUI); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +#ifndef _DEBUG // debug version in TestView.cpp +inline CTestDoc *CTestView::GetDocument() { return (CTestDoc *)m_pDocument; } +#endif + +///////////////////////////////////////////////////////////////////////////// + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_TESTVIEW_H__A75FDCFB_621C_4E38_A154_C344803E6372__INCLUDED_) diff --git a/HouseLightingModel/Transform .cpp b/HouseLightingModel/Transform .cpp new file mode 100644 index 0000000..1a3c445 --- /dev/null +++ b/HouseLightingModel/Transform .cpp @@ -0,0 +1,200 @@ +// Transform.cpp: implementation of the CTransForm class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "Test.h" +#include "Transform.h" +#include "math.h" +#define PI 3.14159 +#ifdef _DEBUG +#undef THIS_FILE +static char THIS_FILE[]=__FILE__; +#define new DEBUG_NEW +#endif + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + +CTransform::CTransform() +{ + +} + +CTransform::~CTransform() +{ + +} + +void CTransform::SetMat(CP3 *p,int n) +{ + POld=p; + num=n; +} + +void CTransform::Identity()//单位矩阵 +{ + T[0][0]=1.0;T[0][1]=0.0;T[0][2]=0.0;T[0][3]=0.0; + T[1][0]=0.0;T[1][1]=1.0;T[1][2]=0.0;T[1][3]=0.0; + T[2][0]=0.0;T[2][1]=0.0;T[2][2]=1.0;T[2][3]=0.0; + T[3][0]=0.0;T[3][1]=0.0;T[3][2]=0.0;T[3][3]=1.0; +} + +void CTransform::Translate(double tx,double ty,double tz)//平移变换矩阵 +{ + Identity(); + T[3][0]=tx; + T[3][1]=ty; + T[3][2]=tz; + MultiMatrix(); +} + +void CTransform::Scale(double sx,double sy,double sz)//比例变换矩阵 +{ + Identity(); + T[0][0]=sx; + T[1][1]=sy; + T[2][2]=sz; + MultiMatrix(); +} + +void CTransform::Scale(double sx,double sy,double sz,CP3 p)//相对于任意点的比例变换矩阵 +{ + Translate(-p.x,-p.y,-p.z); + Scale(sx,sy,sz); + Translate(p.x,p.y,p.z); +} + +void CTransform::RotateX(double beta)//绕X轴旋转变换矩阵 +{ + Identity(); + double rad=beta*PI/180; + T[1][1]=cos(rad); T[1][2]=sin(rad); + T[2][1]=-sin(rad);T[2][2]=cos(rad); + MultiMatrix(); +} + +void CTransform::RotateX(double beta,CP3 p)//相对于任意点的绕X轴旋转变换矩阵 +{ + Translate(-p.x,-p.y,-p.z); + RotateX(beta); + Translate(p.x,p.y,p.z); +} + +void CTransform::RotateY(double beta)//绕Y轴旋转变换矩阵 +{ + Identity(); + double rad=beta*PI/180; + T[0][0]=cos(rad);T[0][2]=-sin(rad); + T[2][0]=sin(rad);T[2][2]=cos(rad); + MultiMatrix(); +} + +void CTransform::RotateY(double beta,CP3 p)//相对于任意点的绕Y轴旋转变换矩阵 +{ + Translate(-p.x,-p.y,-p.z); + RotateY(beta); + Translate(p.x,p.y,p.z); +} + +void CTransform::RotateZ(double beta)//绕Z轴旋转变换矩阵 +{ + Identity(); + double rad=beta*PI/180; + T[0][0]=cos(rad); T[0][1]=sin(rad); + T[1][0]=-sin(rad);T[1][1]=cos(rad); + MultiMatrix(); +} + +void CTransform::RotateZ(double beta,CP3 p)//相对于任意点的绕Z轴旋转变换矩阵 +{ + Translate(-p.x,-p.y,-p.z); + RotateZ(beta); + Translate(p.x,p.y,p.z); +} + +void CTransform::ReflectX()//X轴反射变换矩阵 +{ + Identity(); + T[1][1]=-1; + T[2][2]=-1; + MultiMatrix(); +} + +void CTransform::ReflectY()//Y轴反射变换矩阵 +{ + Identity(); + T[0][0]=-1; + T[2][2]=-1; + MultiMatrix(); +} + +void CTransform::ReflectZ()//Z轴反射变换矩阵 +{ + Identity(); + T[0][0]=-1; + T[1][1]=-1; + MultiMatrix(); +} + +void CTransform::ReflectXOY()//XOY面反射变换矩阵 +{ + Identity(); + T[2][2]=-1; + MultiMatrix(); +} + +void CTransform::ReflectYOZ()//YOZ面反射变换矩阵 +{ + Identity(); + T[0][0]=-1; + MultiMatrix(); +} + +void CTransform::ReflectZOX()//ZOX面反射变换矩阵 +{ + Identity(); + T[1][1]=-1; + MultiMatrix(); +} + +void CTransform::ShearX(double d,double g)//X方向错切变换矩阵 +{ + Identity(); + T[1][0]=d; + T[2][0]=g; + MultiMatrix(); +} + +void CTransform::ShearY(double b,double h)//Y方向错切变换矩阵 +{ + Identity(); + T[0][1]=b; + T[2][1]=h; + MultiMatrix(); +} + +void CTransform::ShearZ(double c,double f)//Z方向错切变换矩阵 +{ + Identity(); + T[0][2]=c; + T[1][2]=f; + MultiMatrix(); +} +void CTransform::MultiMatrix()//矩阵相乘 +{ + CP3 *PNew=new CP3[num]; + for(int i=0;i 1000 +#pragma once +#endif // _MSC_VER > 1000 +#include "P3.h" + +class CTransform//三维变换 +{ +public: + CTransform(); + virtual ~CTransform(); + void SetMat(CP3 *,int); + void Identity(); + void Translate(double,double,double);//平移变换矩阵 + void Scale(double,double,double);//比例变换矩阵 + void Scale(double,double,double,CP3);//相对于任意点的比例变换矩阵 + void RotateX(double);//旋转变换矩阵 + void RotateX(double,CP3);//相对于任意点的X旋转变换矩阵 + void RotateY(double);//旋转变换矩阵 + void RotateY(double,CP3);//相对于任意点的Y旋转变换矩阵 + void RotateZ(double);//旋转变换矩阵 + void RotateZ(double,CP3);//相对于任意点的Z旋转变换矩阵 + void ReflectX();//X轴反射变换矩阵 + void ReflectY();//Y轴反射变换矩阵 + void ReflectZ();//Z轴反射变换矩阵 + void ReflectXOY();//XOY面反射变换矩阵 + void ReflectYOZ();//YOZ面反射变换矩阵 + void ReflectZOX();//ZOX面反射变换矩阵 + void ShearX(double,double);//X方向错切变换矩阵 + void ShearY(double,double);//Y方向错切变换矩阵 + void ShearZ(double,double);//Z方向错切变换矩阵 + void MultiMatrix();//矩阵相乘 +public: + double T[4][4]; + CP3 *POld; + int num; +}; +#endif // !defined(AFX_TRANSFORM_H__C4FA86B2_0AF5_409A_94EB_B02A1EE13E05__INCLUDED_) diff --git a/HouseLightingModel/Vector.cpp b/HouseLightingModel/Vector.cpp new file mode 100644 index 0000000..8ef8d99 --- /dev/null +++ b/HouseLightingModel/Vector.cpp @@ -0,0 +1,175 @@ +// Vector.cpp: implementation of the CVector class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "Test.h" +#include "Vector.h" +#include "math.h" +#ifdef _DEBUG +#undef THIS_FILE +static char THIS_FILE[]=__FILE__; +#define new DEBUG_NEW +#endif + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + +CVector::CVector()//z轴正向 +{ + x=0.0; + y=0.0; + z=1.0; +} + +CVector::~CVector() +{ + +} + +CVector::CVector(const CP3 &p) +{ + x=p.x; + y=p.y; + z=p.z; +} + +CVector::CVector(const CPi3 &p) +{ + x=p.x; + y=p.y; + z=p.z; +} + +CVector::CVector(double x,double y,double z) +{ + this->x=x; + this->y=y; + this->z=z; +} + +CVector::CVector(const CP3 &p0,const CP3 &p1) +{ + x=p1.x-p0.x; + y=p1.y-p0.y; + z=p1.z-p0.z; +} + +CVector::CVector(const CPi3 &p0,const CPi3 &p1) +{ + x=p1.x-p0.x; + y=p1.y-p0.y; + z=p1.z-p0.z; +} + +double CVector::Mag()//矢量的模 +{ + return sqrt(x*x+y*y+z*z); +} + +CVector CVector::Normalize()//归一化到单位矢量 +{ + CVector vector; + double Mag=sqrt(x*x+y*y+z*z); + if(fabs(Mag)<1e-6) + Mag=1.0; + vector.x=x/Mag; + vector.y=y/Mag; + vector.z=z/Mag; + return vector; +} + +CVector operator +(const CVector &v0,const CVector &v1)//矢量的和 +{ + CVector vector; + vector.x=v0.x+v1.x; + vector.y=v0.y+v1.y; + vector.z=v0.z+v1.z; + return vector; +} + +CVector operator -(const CVector &v0,const CVector &v1)//矢量的差 +{ + CVector vector; + vector.x=v0.x-v1.x; + vector.y=v0.y-v1.y; + vector.z=v0.z-v1.z; + return vector; +} + +CVector operator *(const CVector &v,double k)//矢量与常量的积 +{ + CVector vector; + vector.x=v.x*k; + vector.y=v.y*k; + vector.z=v.z*k; + return vector; +} + +CVector operator *(double k,const CVector &v)//常量与矢量的积 +{ + CVector vector; + vector.x=v.x*k; + vector.y=v.y*k; + vector.z=v.z*k; + return vector; +} + +CVector operator /(const CVector &v,double k)//矢量数除 +{ + if(fabs(k)<1e-6) + k=1.0; + CVector vector; + vector.x=v.x/k; + vector.y=v.y/k; + vector.z=v.z/k; + return vector; +} + +CVector operator +=(CVector &v0,CVector &v1)//+=运算符重载 +{ + v0.x=v0.x+v1.x; + v0.y=v0.y+v1.y; + v0.z=v0.z+v1.z; + return v1; +} + +CVector operator -=(CVector &v0,CVector &v1)//-=运算符重载 +{ + v0.x=v0.x-v1.x; + v0.y=v0.y-v1.y; + v0.z=v0.z-v1.z; + return v0; +} + +CVector operator *=(CVector &v0,CVector &v1)//*=运算符重载 +{ + v0.x=v0.x*v1.x; + v0.y=v0.y*v1.y; + v0.z=v0.z*v1.z; + return v0; +} + +CVector operator /=(CVector &v,double k)///=运算符重载 +{ + v.x=v.x/k; + v.y=v.y/k; + v.z=v.z/k; + return v; +} + +double Dot(const CVector &v0,const CVector &v1)//矢量的点积 +{ + return(v0.x*v1.x+v0.y*v1.y+v0.z*v1.z); +} + +CVector Cross(const CVector &v0,const CVector &v1)//矢量的叉积 +{ + CVector vector; + vector.x=v0.y*v1.z-v0.z*v1.y; + vector.y=v0.z*v1.x-v0.x*v1.z; + vector.z=v0.x*v1.y-v0.y*v1.x; + return vector; +} + diff --git a/HouseLightingModel/Vector.h b/HouseLightingModel/Vector.h new file mode 100644 index 0000000..b73f04b --- /dev/null +++ b/HouseLightingModel/Vector.h @@ -0,0 +1,41 @@ +// Vector.h: interface for the CVector class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_VECTOR_H__8C972371_1C22_4E15_A2A8_3CE42319C9CB__INCLUDED_) +#define AFX_VECTOR_H__8C972371_1C22_4E15_A2A8_3CE42319C9CB__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +#include "P3.h" +#include "Pi3.h" + +class CVector +{ +public: + CVector(); + virtual ~CVector(); + CVector(double x,double y,double z); + CVector(const CP3 &); + CVector(const CPi3 &); + CVector(const CP3 &,const CP3 &); + CVector(const CPi3 &,const CPi3 &); + double Mag();//矢量的模 + CVector Normalize();//单位矢量 + friend CVector operator +(const CVector &,const CVector &);//运算符重载 + friend CVector operator -(const CVector &,const CVector &); + friend CVector operator *(const CVector &,double); + friend CVector operator *(double,const CVector &); + friend CVector operator /(const CVector &,double); + friend CVector operator+=(CVector &,CVector &); + friend CVector operator-=(CVector &,CVector &); + friend CVector operator*=(CVector &,CVector &); + friend CVector operator/=(CVector &,double); + friend double Dot(const CVector &,const CVector &); //矢量点积 + friend CVector Cross(const CVector &,const CVector &);//矢量叉积 +public: + double x,y,z;//公有数据成员,方便外部访问 +}; + +#endif // !defined(AFX_VECTOR_H__8C972371_1C22_4E15_A2A8_3CE42319C9CB__INCLUDED_) diff --git a/HouseLightingModel/ZBuffer.cpp b/HouseLightingModel/ZBuffer.cpp new file mode 100644 index 0000000..457883d --- /dev/null +++ b/HouseLightingModel/ZBuffer.cpp @@ -0,0 +1,343 @@ +// ZBuffer.cpp: implementation of the CZBuffer class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "Test.h" +#include "ZBuffer.h" +#include "math.h" +#define Round(d) int(floor(d+0.5)) +#ifdef _DEBUG +#undef THIS_FILE +static char THIS_FILE[]=__FILE__; +#define new DEBUG_NEW +#endif + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + +CZBuffer::CZBuffer() +{ + P=NULL; + pHeadE=NULL; + pCurrentB=NULL; + pEdge=NULL; + pCurrentE=NULL; + pHeadB=NULL; + zBuffer=NULL; +} + +CZBuffer::~CZBuffer() +{ + if(P!=NULL) + { + delete []P; + P=NULL; + } + for(int i=0;iyMax) + yMax=P[i].y;//扫描线的最大值 + } + for(int y=yMin;y<=yMax;y++) + { + if(yMin==y)//建立桶头结点 + { + pHeadB=new CBucket;//建立桶的头结点 + pCurrentB=pHeadB;//pCurrentB为CBucket当前结点指针 + pCurrentB->ScanLine=yMin; + pCurrentB->pET=NULL;//没有链接边表 + pCurrentB->pNext=NULL; + } + else//其他扫描线 + { + pCurrentB->pNext=new CBucket;//建立桶的其他结点 + pCurrentB=pCurrentB->pNext; + pCurrentB->ScanLine=y; + pCurrentB->pET=NULL; + pCurrentB->pNext=NULL; + } + } +} + +void CZBuffer::CreateEdge()//创建边表 +{ + for(int i=0;ix=P[i].x;//计算ET表的值 + pEdge->yMax=P[j].y; + pEdge->k=(P[j].x-P[i].x)/(P[j].y-P[i].y);//代表1/k + pEdge->ps=P[i];//绑定顶点和颜色 + pEdge->pe=P[j]; + pEdge->pNext=NULL; + while(pCurrentB->ScanLine!=P[i].y)//在桶内寻找该边的yMin + { + pCurrentB=pCurrentB->pNext;//移到yMin所在的桶结点 + } + } + if(P[j].yx=P[j].x; + pEdge->yMax=P[i].y; + pEdge->k=(P[i].x-P[j].x)/(P[i].y-P[j].y); + pEdge->ps=P[i]; + pEdge->pe=P[j]; + pEdge->pNext=NULL; + while(pCurrentB->ScanLine!=P[j].y) + { + pCurrentB=pCurrentB->pNext; + } + } + if(int(P[j].y)!=P[i].y) + { + pCurrentE=pCurrentB->pET; + if(pCurrentE==NULL) + { + pCurrentE=pEdge; + pCurrentB->pET=pCurrentE; + } + else + { + while(pCurrentE->pNext!=NULL) + { + pCurrentE=pCurrentE->pNext; + } + pCurrentE->pNext=pEdge; + } + } + } +} + +void CZBuffer::Gouraud(CDC *pDC)//填充多边形 +{ + double CurDeep=0.0;//当前扫描线的深度 + double DeepStep=0.0;//当前扫描线随着x增长的深度步长 + double A,B,C,D;//平面方程Ax+By+Cz+D=0的系数 + CVector V01(P[0],P[1]),V02(P[0],P[2]); + CVector VN=Cross(V01,V02); + A=VN.x;B=VN.y;C=VN.z; + D=-A*P[0].x-B*P[0].y-C*P[0].z; + DeepStep=-A/C;//计算扫描线深度步长增量 + CAET *pT1,*pT2; + pHeadE=NULL; + for(pCurrentB=pHeadB;pCurrentB!=NULL;pCurrentB=pCurrentB->pNext) + { + for(pCurrentE=pCurrentB->pET;pCurrentE!=NULL;pCurrentE=pCurrentE->pNext) + { + pEdge=new CAET; + pEdge->x=pCurrentE->x; + pEdge->yMax=pCurrentE->yMax; + pEdge->k=pCurrentE->k; + pEdge->ps=pCurrentE->ps; + pEdge->pe=pCurrentE->pe; + pEdge->pNext=NULL; + AddEt(pEdge); + } + ETOrder(); + pT1=pHeadE; + if(pT1==NULL) + { + return; + } + while(pCurrentB->ScanLine>=pT1->yMax)//下闭上开 + { + CAET * pAETTEmp=pT1; + pT1=pT1->pNext; + delete pAETTEmp; + pHeadE=pT1; + if(pHeadE==NULL) + return; + } + if(pT1->pNext!=NULL) + { + pT2=pT1; + pT1=pT2->pNext; + } + while(pT1!=NULL) + { + if(pCurrentB->ScanLine>=pT1->yMax)//下闭上开 + { + CAET* pAETTemp =pT1; + pT2->pNext=pT1->pNext; + pT1=pT2->pNext; + delete pAETTemp; + } + else + { + pT2=pT1; + pT1=pT2->pNext; + } + } + CRGB ca,cb,cf;//ca、cb代边上任意点的颜色,cf代表面上任意点的颜色 + ca=Interpolation(pCurrentB->ScanLine,pHeadE->ps.y,pHeadE->pe.y,pHeadE->ps.c,pHeadE->pe.c); + cb=Interpolation(pCurrentB->ScanLine,pHeadE->pNext->ps.y,pHeadE->pNext->pe.y,pHeadE->pNext->ps.c,pHeadE->pNext->pe.c); + BOOL bInFlag=FALSE;//区间内外测试标志,初始值为假表示区间外部 + double xleft,xright;//扫描线和有效边相交区间的起点和终点坐标 + for(pT1=pHeadE;pT1!=NULL;pT1=pT1->pNext) + { + if(FALSE==bInFlag) + { + xleft=pT1->x; + CurDeep=-(xleft*A+pCurrentB->ScanLine*B+D)/C;//z=-(Ax+By-D)/C + bInFlag=TRUE; + } + else + { + xright=pT1->x; + for(double x=xleft;xScanLine+Height/2])//如果当前采样点的深度小于帧缓冲器中原采样点的深度 + { + zBuffer[Round(x)+Width/2][pCurrentB->ScanLine+Height/2]=CurDeep;//使用当前采样点的深度更新深度缓冲器 + pDC->SetPixelV(Round(x),pCurrentB->ScanLine,RGB(cf.red*255,cf.green*255,cf.blue*255));//绘制当前采样点 + } + CurDeep+=DeepStep; + } + bInFlag=FALSE; + } + } + for(pT1=pHeadE;pT1!=NULL;pT1=pT1->pNext)//边的连续性 + pT1->x=pT1->x+pT1->k; + } +} + +void CZBuffer::AddEt(CAET *pNewEdge)//合并ET表 +{ + CAET *pCE; + pCE=pHeadE; + if(pCE==NULL) + { + pHeadE=pNewEdge; + pCE=pHeadE; + } + else + { + while(pCE->pNext!=NULL) + { + pCE=pCE->pNext; + } + pCE->pNext=pNewEdge; + } +} + +void CZBuffer::ETOrder()//边表的冒泡排序算法 +{ + CAET *pT1,*pT2; + int Count=1; + pT1=pHeadE; + if(pT1==NULL) + return; + if(pT1->pNext==NULL)//如果该ET表没有再连ET表 + return;//桶结点只有一条边,不需要排序 + while(pT1->pNext!=NULL)//统计边结点的个数 + { + Count++; + pT1=pT1->pNext; + } + for(int i=0;ipNext; + + if ((pT1->x>pT2->x)||((pT1->x==pT2->x)&&(pT1->k>pT2->k))) + { + pT1->pNext=pT2->pNext; + pT2->pNext=pT1; + *pPre=pT2; + pPre=&(pT2->pNext);//调整位置为下次遍历准备 + } + else + { + pPre=&(pT1->pNext); + pT1=pT1->pNext; + } + } + } +} + +CRGB CZBuffer::Interpolation(double t,double t1,double t2,CRGB clr1,CRGB clr2)//颜色线性插值 +{ + CRGB color; + color=(t-t2)/(t1-t2)*clr1+(t-t1)/(t2-t1)*clr2; + return color; +} + +void CZBuffer::InitDeepBuffer(int Width,int Height,double Depth)//初始化深度缓冲 +{ + int i; + this->Width=Width,this->Height=Height; + zBuffer=new double *[Width]; + for(int i=0;ipNext; + DeleteAETChain(pBucket->pET); + delete pBucket; + pBucket=pBucketTemp; + } + pHeadB=NULL; + pHeadE=NULL; +} + +void CZBuffer::DeleteAETChain(CAET* pAET) +{ + while (pAET!=NULL) + { + CAET* pAETTemp=pAET->pNext; + delete pAET; + pAET=pAETTemp; + } +} \ No newline at end of file diff --git a/HouseLightingModel/ZBuffer.h b/HouseLightingModel/ZBuffer.h new file mode 100644 index 0000000..04b5045 --- /dev/null +++ b/HouseLightingModel/ZBuffer.h @@ -0,0 +1,38 @@ +// ZBuffer.h: interface for the CZBuffer class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_ZBUFFER_H__ED93E842_7399_49B8_B579_6A52FBA1289D__INCLUDED_) +#define AFX_ZBUFFER_H__ED93E842_7399_49B8_B579_6A52FBA1289D__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +#include "Bucket.h"//桶头文件 +#include "Vector.h"//矢量头文件 + +class CZBuffer +{ +public: + CZBuffer(); + virtual ~CZBuffer(); + void CreateBucket();//创建桶 + void CreateEdge();//边表 + void AddEt(CAET *);//合并ET表 + void ETOrder(); + void Gouraud(CDC *);//填充 + void InitDeepBuffer(int,int,double);//初始化深度缓存 + CRGB Interpolation(double,double,double,CRGB,CRGB);//线性插值 + void SetPoint(CPi3 *,int); + void ClearMemory();//清理内存 + void DeleteAETChain(CAET* pAET);//删除边表 +protected: + int PNum;//顶点个数 + CPi3 *P;//顶点数组 + CAET *pHeadE,*pCurrentE,*pEdge;//有效边表结点指针 + CBucket *pCurrentB,*pHeadB; + double **zBuffer;//缓深度冲区 + int Width,Height;//缓冲区参数 +}; + +#endif // !defined(AFX_ZBUFFER_H__ED93E842_7399_49B8_B579_6A52FBA1289D__INCLUDED_) diff --git a/HouseLightingModel/res/Help.ico b/HouseLightingModel/res/Help.ico new file mode 100644 index 0000000..b1aaffa Binary files /dev/null and b/HouseLightingModel/res/Help.ico differ diff --git a/HouseLightingModel/res/Test.ico b/HouseLightingModel/res/Test.ico new file mode 100644 index 0000000..168ef77 Binary files /dev/null and b/HouseLightingModel/res/Test.ico differ diff --git a/HouseLightingModel/res/Test.rc2 b/HouseLightingModel/res/Test.rc2 new file mode 100644 index 0000000..f3b43e0 --- /dev/null +++ b/HouseLightingModel/res/Test.rc2 @@ -0,0 +1,13 @@ +// +// TEST.RC2 - resources Microsoft Visual C++ does not edit directly +// + +#ifdef APSTUDIO_INVOKED + #error this file is not editable by Microsoft Visual C++ +#endif //APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// Add manually edited resources here... + +///////////////////////////////////////////////////////////////////////////// diff --git a/HouseLightingModel/res/TestDoc.ico b/HouseLightingModel/res/TestDoc.ico new file mode 100644 index 0000000..2a1f1ae Binary files /dev/null and b/HouseLightingModel/res/TestDoc.ico differ diff --git a/HouseLightingModel/res/Thumbs.db b/HouseLightingModel/res/Thumbs.db new file mode 100644 index 0000000..2c18542 Binary files /dev/null and b/HouseLightingModel/res/Thumbs.db differ diff --git a/HouseLightingModel/res/Toolbar.bmp b/HouseLightingModel/res/Toolbar.bmp new file mode 100644 index 0000000..738aa37 Binary files /dev/null and b/HouseLightingModel/res/Toolbar.bmp differ diff --git a/HouseLightingModel/res/about.bmp b/HouseLightingModel/res/about.bmp new file mode 100644 index 0000000..a9d3f73 Binary files /dev/null and b/HouseLightingModel/res/about.bmp differ diff --git a/HouseLightingModel/res/app.ico b/HouseLightingModel/res/app.ico new file mode 100644 index 0000000..ff42f3e Binary files /dev/null and b/HouseLightingModel/res/app.ico differ diff --git a/HouseLightingModel/res/draw.ico b/HouseLightingModel/res/draw.ico new file mode 100644 index 0000000..911bdce Binary files /dev/null and b/HouseLightingModel/res/draw.ico differ diff --git a/HouseLightingModel/res/exit.ico b/HouseLightingModel/res/exit.ico new file mode 100644 index 0000000..a2fcaed Binary files /dev/null and b/HouseLightingModel/res/exit.ico differ diff --git a/HouseLightingModel/resource.h b/HouseLightingModel/resource.h new file mode 100644 index 0000000..7ad1b5c --- /dev/null +++ b/HouseLightingModel/resource.h @@ -0,0 +1,44 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by Test.rc +// +#define IDD_ABOUTBOX 100 +#define IDR_MAINFRAME 128 +#define IDR_TESTTYPE 129 +#define IDI_ICON1 130 +#define IDI_ICON2 131 +#define IDI_ICON3 132 +#define IDI_ICON4 133 +#define IDB_BITMAP1 134 +#define IDB_ABOUT 134 +#define IDD_DIALOG1 135 +#define IDB_BITMAP2 138 +#define IDC_EDIT1 1000 +#define IDC_EDIT2 1001 +#define IDC_EDIT3 1002 +#define IDC_EDIT4 1003 +#define ID_MENUAntiliasing 32774 +#define ID_MENUMbline 32775 +#define ID_MENULine 32776 +#define ID_MENUITEM32777 32777 +#define ID_MENUITEM32778 32778 +#define ID_MENUITEM32781 32781 +#define ID_MENUITEM32782 32782 +#define ID_DRAW 32783 +#define ID_DRAWCIRQUE 32784 +#define ID_MENUPlay 32785 +#define ID_MENUDECREASE 32787 +#define ID_MENUINCREASE 32788 +#define IDM_PLAY 32797 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_3D_CONTROLS 1 +#define _APS_NEXT_RESOURCE_VALUE 147 +#define _APS_NEXT_COMMAND_VALUE 32798 +#define _APS_NEXT_CONTROL_VALUE 1005 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif