www.pudn.com > Ray_Tracing_Materials.rar > Triangle.h, change:2008-01-03,size:1132b
/*
File Name:
Triangle.h
Created by:
Allen Sherrod (Programming Ace of www.UltimateGameProgramming.com).
Description:
This file holds a structure that represents a 3D Triangle.
*/
#ifndef TRIANGLE_H
#define TRIANGLE_H
#include"Ray.h"
#include"CVector.h"
class Triangle
{
public:
Triangle() : r(0), g(0), b(0), diffuseMat(0), reflect(0), refract(0) {}
Triangle(CVector4 &P1, CVector4 &P2, CVector4 &P3, float R, float G, float B,
float dMat, float rl, float etaRatio)
{
p1 = P1; p2 = P2; p3 = P3;
r = R; g = G; b = B;
diffuseMat = dMat;
reflect = rl;
refract = etaRatio;
}
TraceResult Intersect(Ray &ray);
CVector4 GetNormal();
// Triangle points and color.
CVector4 p1, p2, p3;
float r, g, b;
float diffuseMat;
float reflect;
float refract;
};
#endif
// Copyright February 2005
// All Rights Reserved!
// Allen Sherrod
// ProgrammingAce@UltimateGameProgramming.com
// www.UltimateGameProgramming.com