00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
#ifndef CSG_H
00022
#define CSG_H
00023
00024
#include "objectcontainer.h"
00025
00026
class CSGUnion:
public ObjectContainer {
00027
00028
public:
00029
00031 CSGUnion():
ObjectContainer() {}
00032
00034 ~CSGUnion() {}
00035
00036
private:
00038 CSGUnion(
const ObjectContainer& o, ObjectList* l):
ObjectContainer(o,l) {
00039
calculateBoundingBox();
00040 }
00041
00043 CSGUnion(
const CSGUnion& o):
ObjectContainer(o) {}
00044
00045
public:
00046
00047
00048
Object3D*
duplicate()
const {
return new CSGUnion(*
this);}
00049
00050
00051
Object3D*
invert() const;
00052
void listInside(const
Vector3& location,
InsideList& l) const;
00053
Intersection* intersectLocalLimitedTime(const
Ray &r, DBL maxtime) const;
00054
bool isInsideAt(const
Vector3 &locallocation) const;
00055
00058
void addObject(
Object3D* o);
00059
00060 protected:
00062
ObjectContainer* getEmptyContainer();
00063
00064 private:
00067 static HitStatistics stat;
00068
00069 };
00070
00071
00072 class CSGMerge: public
ObjectContainer {
00073
00074
friend class CSGIntersect;
00075
00076
public:
00077
00079 CSGMerge(): ObjectContainer() {}
00080
00082 ~CSGMerge() {}
00083
00084
private:
00086 CSGMerge(
const ObjectContainer& o, ObjectList* l): ObjectContainer(o,l) {
00087
calculateBoundingBox();
00088 }
00089
00091 CSGMerge(
const CSGMerge& o): ObjectContainer(o) {}
00092
00093
public:
00094
00095
00096
Object3D*
duplicate()
const {
return new CSGMerge(*
this);}
00097
00098
00099
Object3D*
invert() const;
00100
Intersection* intersectLocalLimitedTime(const
Ray &r, DBL maxtime) const;
00101
bool isInsideAt(const
Vector3 &locallocation) const;
00102
00105
void addObject(
Object3D* o);
00106
00107 protected:
00108 ObjectContainer* getEmptyContainer();
00109
00110 private:
00113 static HitStatistics stat;
00114
00115 };
00116
00117
00118 class CSGIntersect: public ObjectContainer {
00119
00120
friend class CSGUnion;
00121
friend class CSGMerge;
00122
00123
public:
00124
00126 CSGIntersect(): ObjectContainer() {}
00127
00129 ~CSGIntersect() {}
00130
00131
private:
00133 CSGIntersect(
const ObjectContainer& o, ObjectList* l): ObjectContainer(o,l) {
00134
calculateBoundingBox();
00135 }
00136
00138 CSGIntersect(
const CSGIntersect& o): ObjectContainer(o) {}
00139
00140
public:
00141
00142
00143
Object3D*
duplicate()
const {
return new CSGIntersect(*
this);}
00144
00145
00146
Object3D*
invert() const;
00147
Intersection* intersectLocalLimitedTime(const
Ray &r, DBL maxtime) const;
00148
bool isInsideAt(const
Vector3 &locallocation) const;
00149
00152
void addObject(
Object3D* o);
00153
00154 protected:
00155
00156
void calculateBoundingBox();
00157 ObjectContainer* getEmptyContainer();
00158
00159 private:
00162 static HitStatistics stat;
00163
00164 };
00165
00166 #endif
00167
00168
00169