📄 light.h
字号:
// Light.h: interface for the CLight class.
//
// 说明:
// 功能: 光源基类
//
// 创建时间: 2004.5
// 作者: 悦鑫 0004170140
// 目的: 南京理工大学毕业设计 基于光线跟踪算法的场景绘制研究
// 参考书目: <<VC++绘图程序设计技巧与实例>>
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_LIGHT_H__D22FBA93_A115_46EB_8666_9CF6E7F83AD1__INCLUDED_)
#define AFX_LIGHT_H__D22FBA93_A115_46EB_8666_9CF6E7F83AD1__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "ListNode.h"
class CLight : public CListNode //光源
{
public:
//构造函数,初始化成员变量
CLight::CLight( CVector location,
CVector intensity,
CString type,
BOOL reflectable
)
:
vecLocation ( location ),
vecIntensity ( intensity ),
bReflectable ( reflectable ),
strType ( type ),
IntersectPoint ( 0,0,0 ),
HitRay ( NULL ),
nLightIndex ( 0 )
{
}
//析构函数
virtual CLight::~CLight()
{
HitRay = NULL;
}
//初始化入射光线
void CLight::InitHitRay(CRay *hitray)
{
HitRay = hitray;
}
//获得环境光强
CVector GetLocation() { return vecLocation; }
//求交,子类虚方法
virtual double Intersect() { return 0.0; }
//获得光源光强
virtual CVector GetIntensity() { return vecIntensity; }
//判断交点是否在光源范围内
virtual BOOL IsInArea(CVector point) { return TRUE; }
//获得光源类型
virtual CString GetType() { return strType; }
//清空与光线的交点
void CLight::Empty()
{
IntersectPoint.Empty();
}
int nLightIndex;//光源序号
protected:
CRay* HitRay; //相交光线
CRTPoint IntersectPoint; //光线与光源的交点
CVector vecIntensity; //光源亮度
CVector vecLocation; //光源位置
BOOL bReflectable; //是否反射
CString strType; //光源类型
};
#endif // !defined(AFX_LIGHT_H__D22FBA93_A115_46EB_8666_9CF6E7F83AD1__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -