00001 /*************************************************************************** 00002 * Copyright (C) 1998-2010 by authors (see AUTHORS.txt ) * 00003 * * 00004 * This file is part of LuxRays. * 00005 * * 00006 * LuxRays is free software; you can redistribute it and/or modify * 00007 * it under the terms of the GNU General Public License as published by * 00008 * the Free Software Foundation; either version 3 of the License, or * 00009 * (at your option) any later version. * 00010 * * 00011 * LuxRays is distributed in the hope that it will be useful, * 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00014 * GNU General Public License for more details. * 00015 * * 00016 * You should have received a copy of the GNU General Public License * 00017 * along with this program. If not, see <http://www.gnu.org/licenses/>. * 00018 * * 00019 * LuxRays website: http://www.luxrender.net * 00020 ***************************************************************************/ 00021 00022 #ifndef _LUXRAYS_DATASET_H 00023 #define _LUXRAYS_DATASET_H 00024 00025 #include <deque> 00026 00027 #include "luxrays/luxrays.h" 00028 #include "luxrays/core/acceleretor.h" 00029 #include "luxrays/core/trianglemesh.h" 00030 00031 namespace luxrays { 00032 00033 class DataSet { 00034 public: 00035 DataSet(const Context *luxRaysContext); 00036 ~DataSet(); 00037 00038 TriangleMeshID Add(Mesh *mesh); 00039 void Preprocess(); 00040 bool IsPreprocessed() const { return preprocessed; } 00041 00042 bool Intersect(const Ray *ray, RayHit *hit) const; 00043 00044 const TriangleMeshID GetMeshID(const unsigned int index) const { return accel->GetMeshID(index); } 00045 const TriangleMeshID *GetMeshIDTable() const { return accel->GetMeshIDTable(); } 00046 const TriangleID GetMeshTriangleID(const unsigned int index) const { return accel->GetMeshTriangleID(index); } 00047 const TriangleID *GetMeshTriangleIDTable() const { return accel->GetMeshTriangleIDTable(); } 00048 00049 void SetAcceleratorType(AcceleratorType type) { accelType = type; } 00050 AcceleratorType GetAcceleratorType() const { return accelType; } 00051 const Accelerator *GetAccelerator() const { return accel; } 00052 00053 const BBox &GetBBox() const { return bbox; } 00054 const BSphere &GetBSphere() const { return bsphere; } 00055 00056 unsigned int GetTotalVertexCount() const { return totalVertexCount; } 00057 unsigned int GetTotalTriangleCount() const { return totalTriangleCount; } 00058 00059 friend class Context; 00060 friend class OpenCLIntersectionDevice; 00061 00062 protected: 00063 void UpdateMeshes(); 00064 00065 private: 00066 const Context *context; 00067 00068 unsigned int totalVertexCount; 00069 unsigned int totalTriangleCount; 00070 std::deque<Mesh *> meshes; 00071 00072 bool preprocessed; 00073 00074 BBox bbox; 00075 BSphere bsphere; 00076 00077 AcceleratorType accelType; 00078 Accelerator *accel; 00079 }; 00080 00081 } 00082 00083 #endif /* _LUXRAYS_DATASET_H */
1.6.3