www.pudn.com > Ray_Tracing_Materials.rar > Sphere.h, change:2005-03-02,size:1156b
/*
File Name:
Sphere.h
Created by:
Allen Sherrod (Programming Ace of www.UltimateGameProgramming.com).
Description:
This file holds a structure that represents a 3D sphere.
*/
#ifndef SPHERE_H
#define SPHERE_H
#include"Ray.h"
#include"CVector.h"
class Sphere
{
public:
Sphere() : r(0), g(0), b(0), diffuseMat(0), radius(0), reflect(0), refract(0) {}
Sphere(float cx, float cy, float cz, float rd, float R, float G, float B,
float dMat, float rl, float etaRatio)
{
center = CVector4(cx, cy, cz);
radius = rd;
r = R; g = G; b = B;
diffuseMat = dMat;
reflect = rl;
refract = etaRatio;
}
// Member functions.
TraceResult Intersect(Ray &ray);
CVector4 GetNormal(CVector4 &RayShapeIntersect);
CVector4 center;
float radius;
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