00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #if defined(_MSC_VER)
00025 #pragma once
00026 #endif
00027
00028 #ifndef PBRT_SHAPES_SPHERE_H
00029 #define PBRT_SHAPES_SPHERE_H
00030
00031
00032 #include "shape.h"
00033
00034
00035 class Sphere : public Shape {
00036 public:
00037
00038 Sphere(const Transform *o2w, const Transform *w2o, bool ro, float rad,
00039 float zmin, float zmax, float phiMax);
00040 BBox ObjectBound() const;
00041 bool Intersect(const Ray &ray, float *tHit, float *rayEpsilon,
00042 DifferentialGeometry *dg) const;
00043 bool IntersectP(const Ray &ray) const;
00044 float Area() const;
00045 Point Sample(float u1, float u2, Normal *ns) const;
00046 Point Sample(const Point &p, float u1, float u2, Normal *ns) const;
00047 float Pdf(const Point &p, const Vector &wi) const;
00048 private:
00049
00050 float radius;
00051 float phiMax;
00052 float zmin, zmax;
00053 float thetaMin, thetaMax;
00054 };
00055
00056
00057 Sphere *CreateSphereShape(const Transform *o2w, const Transform *w2o,
00058 bool reverseOrientation, const ParamSet ¶ms);
00059
00060 #endif // PBRT_SHAPES_SPHERE_H