?? rtobject.h
字號:
// RTObject.h: interface for the CRTObject class.
//
// 說明:
// 功能: 物體基類
//
// 創建時間: 2004.5
// 作者: 悅鑫 0004170140
// 目的: 南京理工大學畢業設計 基于光線跟蹤算法的場景繪制研究
// 參考書目: <<VC++繪圖程序設計技巧與實例>>
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_RTOBJECT_H__01F185CF_0C6D_4CDC_8087_D2805088EDDF__INCLUDED_)
#define AFX_RTOBJECT_H__01F185CF_0C6D_4CDC_8087_D2805088EDDF__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "ListNode.h"
#include "Vector.h" // Added by ClassView
class CRTObject : public CListNode //物體基類
{
public:
//構造函數,初始化數據成員
CRTObject();
//析構函數
virtual ~CRTObject();
//計算折射光線
void CalculateRefractDir();
//獲得折射光線
CVector GetRefractDir();
//獲得反射光線
CVector GetReflectDir();
//計算給定光源方向下的光強
CVector UnshadowedPoint(CVector LightDir,CVector N,CLight *Light);
//計算整體光照模型下的光強
CVector GetLocalColor(CRTList& LightList,CRTList& ObjectList);
//清空反射、透射光線及交點
void Empty();
//設置交點
void SetIntersectPt(CRTPoint NewPoint)
{
IntersectPoint = NewPoint;
}
//設置入射光線
void InitHitRay(CRay *hitray)
{
HitRay = hitray;
}
//設置景物紋理
void SetTexture(CTexture *texture)
{
Texture = texture;
}
//設置景物材料
void SetMaterial(CMaterial *material)
{
Material = material;
}
//獲得景物紋理
CTexture* GetTexture()
{
return Texture;
}
//獲得景物材料
CMaterial* GetMaterial()
{
return Material;
}
//獲得交點
CRTPoint GetIntersectPoint()
{
return IntersectPoint;
}
//虛方法,求交函數
virtual double Intersect()
{
return 0;
}
//虛方法,計算法向量
virtual CVector GetNormalVec()
{
return CVector(0.,0.,0.);
}
//虛方法,紋理映射函數
virtual CVector Mapping()
{
return CVector(0.,0.,0.);
}
//虛方法,景物移動旋轉函數
virtual void Transform(CVector offset, CVector rotate)
{
}
int nObjectIndex; //景物序號
protected:
CMaterial *Material; //材料
CTexture *Texture; //紋理
CRay *HitRay; //相交光線
CVector vecReflectDir; //反射向量
CVector vecRefractDir; //透射向量
CVector IntersectPoint; //交點
};
#endif // !defined(AFX_RTOBJECT_H__01F185CF_0C6D_4CDC_8087_D2805088EDDF__INCLUDED_)
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -