Subversion Repositories gelsvn

Rev

Rev 346 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 346 Rev 349
Line 1... Line 1...
1
#ifndef __PATHTRACER_MESH__HPP__
1
#ifndef __PATHTRACER_MESH__HPP__
2
#define __PATHTRACER_MESH__HPP__
2
#define __PATHTRACER_MESH__HPP__
3
 
3
 
4
#include "luminaire.hpp"
4
#include "luminaire.hpp"
5
#include "material.hpp"
5
#include "material.hpp"
6
 
6
 
7
namespace Geometry { class TriMesh; class IndexedFaceSet; }
7
namespace Geometry { class TriMesh; class IndexedFaceSet; }
8
 
8
 
9
class mesh : public luminaire
9
class mesh : public luminaire
10
{
10
{
11
public:
11
public:
12
	//ctor
12
    //ctor
13
	mesh(void);
13
    mesh(void);
14
	mesh(const std::string&);
14
    mesh(const std::string&);
15
	~mesh(void);
15
    ~mesh(void);
16
 
16
 
17
	//geometry
17
    //geometry
18
	const Geometry::TriMesh& get_trimesh(void) const;
18
    const Geometry::TriMesh& get_trimesh(void) const;
19
	void set_trimesh(const Geometry::TriMesh&);
19
    void set_trimesh(const Geometry::TriMesh&);
20
	const CGLA::Vec3f& triangle_normal(size_t i) const;
20
    const CGLA::Vec3f& triangle_normal(size_t i) const;
21
 
21
 
22
	//material
22
    //material
23
	const material* get_material(void) const;
23
    const material* get_material(void) const;
24
	void set_material(const material*);
24
    void set_material(const material*);
25
 
25
 
26
	//exitance (W/m2) (assuming diffuse emission)
26
    //exitance (W/m2) (assuming diffuse emission)
27
	CGLA::Vec3f exitance(void) const;
27
    CGLA::Vec3f exitance(void) const;
28
	void set_exitance(const CGLA::Vec3f&);
28
    void set_exitance(const CGLA::Vec3f&);
29
 
29
 
30
	//sampling of mesh luminaire
30
    //sampling of mesh luminaire
31
	bool sample(const ray&, const hit_info&, CGLA::Vec3f& L, 
31
    bool sample(const ray&, const hit_info&, CGLA::Vec3f& L, 
32
		CGLA::Vec3f& w) const;
32
        CGLA::Vec3f& w) const;
33
 
33
 
34
protected:
34
protected:
35
	Geometry::TriMesh* msh_;
35
    Geometry::TriMesh* msh_;
36
	std::vector<CGLA::Vec3f> triangle_normals_;
36
    std::vector<CGLA::Vec3f> triangle_normals_;
37
	Geometry::IndexedFaceSet* tangents_;
37
    Geometry::IndexedFaceSet* tangents_;
38
	const material* mat_;
38
    const material* mat_;
39
	CGLA::Vec3f exitance_;
39
    CGLA::Vec3f exitance_;
40
};
40
};
41
 
41
 
42
#endif
42
#endif
43
 
43
 
44
//02566 framework, Anders Wang Kristensen, awk@imm.dtu.dk, 2007
44
//02566 framework, Anders Wang Kristensen, awk@imm.dtu.dk, 2007