📄 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 + -