source: GTP/trunk/App/Demos/Illum/pathmap/SubEntity.h @ 2197

Revision 2197, 1.7 KB checked in by szirmay, 18 years ago (diff)
RevLine 
[2197]1#pragma once
2
3#include <vector>
4#include "Vector.hpp"
5#include "Transformed.h"
6class Mesh;
7class SubMesh;
8class Entity;
9class RenderStrategy;
10
11class SubEntity
12{
13        friend class FinalCompositionRenderStrategy;
14
15protected:
16        Entity*                         parent;
17        int                                     nNearClusters;
18
19        SubMesh*                        subMesh;                //!< mesh
20        Transformed*            rayTraceEntity; //!< raytracable entity containing the subMesh's TriangleMesh
21       
22        LPDIRECT3DTEXTURE9 prmTexture;          //!< a collection of tiled UV atlases containing illuminaton contributions of nearest entry point clusters
23        LPDIRECT3DSURFACE9 prmSurface;          //!< prmTexture's surface
24
25        int                                     prmxres;
26        int                                     prmyres;
27
28        void createRayTraceEntity();            //!< setup rayTraceEntity
29
30        //! array of cluster indices storing which clusters are relevant. PRM tiles correspond to these clusters
31        unsigned int nearClusterIndices[32];
32
33
34public:
35        //! clear PRM to float4(0, 0, 0, 0)
36        void clearPRM();
37
38        //! render contributions of virtual light sources in 'bushRadions' to atlas corresponding to cluster 'bushId'
39        void renderPRM( std::vector<Radion>& clusterRadions, unsigned int clusterId);
40
41        //! downscale pixel values according to alpha (render-to-the-pixel counter) to get rid of overlapping edge artifacts
42        void normalizePRM();
43
44        //! fill the nearClusterIndices array
45        void findNearClusters(const std::vector<Radion>& starters, unsigned int nClusters);
46
47public:
48        SubEntity(Entity* parent, SubMesh* subMesh, int nNearClusters);
49        ~SubEntity(void);
50
51        Intersectable* getRayTraceEntity();
52
53        void draw(const RenderStrategy& renderStrategy);
54        float getSurfaceArea();
55        const Material* sampleSurface(Radion& sample);
56
57        void savePRM();
58        void loadPRM();
59
60        void saveSceneInfo(std::ofstream& psf);
61};
Note: See TracBrowser for help on using the repository browser.