Lightmetrica  0.0.1.50dbee3 (yosakoi)
 All Classes Functions Variables Typedefs Enumerations Enumerator
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Scene Class Referenceabstract

#include <scene.h>

Public Member Functions

 LM_COMPONENT_INTERFACE_DEF ("scene")
 
LM_PUBLIC_API void Load (Primitives *primitives)
 
LM_PUBLIC_API bool PostConfigure ()
 
LM_PUBLIC_API bool Intersect (Ray &ray, Intersection &isect) const
 
LM_PUBLIC_API const CameraMainCamera () const
 
LM_PUBLIC_API const LightSampleLightSelection (Math::Vec2 &lightSampleP, Math::PDFEval &selectionPdf) const
 
LM_PUBLIC_API const LightSampleLightSelection (const Math::Float &lightSample, Math::PDFEval &selectionPdf) const
 
LM_PUBLIC_API Math::PDFEval LightSelectionPdf () const
 
LM_PUBLIC_API AABB GetAABB () const
 
virtual bool Configure (const ConfigNode &node)=0
 
virtual bool Build ()=0
 
virtual bool IntersectTriangles (Ray &ray, Intersection &isect) const =0
 
virtual AABB GetAABBTriangles () const =0
 
virtual boost::signals2::connection Connect_ReportBuildProgress (const std::function< void(double, bool)> &func)=0
 
- Public Member Functions inherited from Component
virtual std::string ComponentInterfaceTypeName () const =0
 
virtual std::string ComponentImplTypeName () const =0
 
- Public Member Functions inherited from SIMDAlignedType
void * operator new (std::size_t size) throw (std::bad_alloc)
 
void operator delete (void *p)
 

Protected Member Functions

void StoreIntersectionFromBarycentricCoords (unsigned int primitiveIndex, unsigned int triangleIndex, const Ray &ray, const Math::Vec2 &b, Intersection &isect) const
 

Protected Attributes

std::unique_ptr< Primitivesprimitives
 

Detailed Description

Scene class. A base class of the scene.

Inheritance diagram for Scene:
Component SIMDAlignedType BVHScene NaiveScene StubScene

Member Function Documentation

virtual bool Scene::Build ( )
pure virtual

Build acceleration structure. Some scene may have an acceleration structure for the optimization. The function must be called after Load. The function must be called before any intersection queries.

Return values
trueSucceeded to build.
falseFailed to build.

Implemented in BVHScene, StubScene, and NaiveScene.

virtual bool Scene::Configure ( const ConfigNode node)
pure virtual

Configure the scene.

Parameters
nodeXML node for the configuration.
Return values
trueSucceeded to configure the scene.
falseFailed to configure the scene.

Implemented in BVHScene, StubScene, and NaiveScene.

virtual boost::signals2::connection Scene::Connect_ReportBuildProgress ( const std::function< void(double, bool)> &  func)
pure virtual

Connect to ReportBuildProgress signal. The signal is emitted when the progress of asset loading is changed.

Parameters
funcSlot function.

Implemented in BVHScene, and NaiveScene.

AABB Scene::GetAABB ( ) const

Get AABB of the scene.

Returns
AABB of the scene.
virtual AABB Scene::GetAABBTriangles ( ) const
pure virtual

Get AABB of triangles in the scene.

Returns
AABB of triangles in the scene.

Implemented in BVHScene, and NaiveScene.

bool Scene::Intersect ( Ray ray,
Intersection isect 
) const

Intersection query. The function checks if #ray hits with the scene. When intersected, information on the hit point is stored in the intersection data.

Parameters
rayRay.
isectIntersection data.
Return values
trueIntersected with the scene.
falseNot intersected with the scene.
virtual bool Scene::IntersectTriangles ( Ray ray,
Intersection isect 
) const
pure virtual

Intersection query with triangles. The function checks if #ray hits with the scene. This function is supposed to be accelerated by spatial acceleration structure. When intersected, information on the hit point is stored in the intersection data.

Parameters
rayRay.
isectIntersection data.
Return values
trueIntersected with the scene.
falseNot intersected with the scene.

Implemented in BVHScene, and NaiveScene.

Math::PDFEval Scene::LightSelectionPdf ( ) const

PDF evaluation for light selection sampling.

Returns
Evaluated PDF.
void Scene::Load ( Primitives primitives)

Load primitives. Ownership of #primitives is delegated to this class.

Parameters
primitivesPrimitives.
const Camera * Scene::MainCamera ( ) const

Get a main camera.

Returns
Main camera.
bool Scene::PostConfigure ( )

Post configuration of the scene. This function must be called after Build.

Return values
trueSucceeded to configure the scene.
falseFailed to configure the scene.
const Light * Scene::SampleLightSelection ( Math::Vec2 &  lightSampleP,
Math::PDFEval &  selectionPdf 
) const

Choose a light included in the scene (reusable version). Note that only the x component of #lightSampleP is used and reusable in the following procedure, e.g. positional sampling on the light.

Parameters
lightSamplePLight sample.
selectionPdfPDF evaluation of the selection (discrete measure).
Returns
Selected light.
const Light * Scene::SampleLightSelection ( const Math::Float &  lightSample,
Math::PDFEval &  selectionPdf 
) const

Choose a light included in the scene.

Parameters
lightSampleLight sample.
selectionPdfPDF evaluation of the selection (discrete measure).
Returns
Selected light.
void Scene::StoreIntersectionFromBarycentricCoords ( unsigned int  primitiveIndex,
unsigned int  triangleIndex,
const Ray ray,
const Math::Vec2 &  b,
Intersection isect 
) const
protected

Store intersection data using barycentric coordinates. Reconstruct intersection information from some information. The function is used internally.

Parameters
primitiveIndexA index of the primitive.
triangleIndexA index of the triangle of the primitive specified by #primitiveIndex.
rayIntersected ray.
bBarycentric coordinates of the intersection point.
isectIntersection structure to store data.

The documentation for this class was generated from the following files: