Project:
omgwheel
Code Location:
http://omgwheel.googlecode.com/svn/trunk//trunk
/
Outline
- > C NxActor
- > C NxVec3
-
>
N
Ogre
- C ManualObject
- C Vector3
-
>
C
HeightMap
- Co HeightMap()
- De ~HeightMap()
- Fn float getHeight(float,float)
- Fn Ogre::ManualObject getGeometry()
- Fn void createGeometry()
- Fn Ogre::Vector3 getFaceNormal(Ogre::Image*,int,int)
- Fn Ogre::Vector3 getVertexNormal(Ogre::Image*,int,int)
- Fn void putElement(Ogre::Image*,int,int,int,int,Ogre::ManualObject*,int,int)
- V Ogre::ManualObject mGeometry
- Fn NxActor CreateHeightfield(NxVec3*,int,NxReal)
- Fn void RenderHeightfield()
HeightMap.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#ifndef HEIGHTMAP_H #define HEIGHTMAP_H #include "Nxf.h" class NxActor; class NxVec3; namespace Ogre { class ManualObject; class Vector3; }; /** * HeightMap is a class which loads a bitmap that, based on * greyscale value, determines height of some tile edge in a tile * grid. * * HeightMap will generate an Ogre manual object which can then be * attached to the scene. * * It is possible to fetch height based on requested coordinates. * * @author ivucica */ class HeightMap { public: HeightMap(); ~HeightMap(); /** * \brief Get the height at position specified by x and y coordinates. */ float getHeight(float x, float y) const { return 0; } // TODO (ivucica#2#): stub /** * \brief Get the Ogre "manual object" containing 3d heightmap data */ Ogre::ManualObject* getGeometry(); private: /** * \brief Creates manual object containing 3d heightmap data */ void createGeometry(); /** * \brief Gets the normal of a face specified by its bottom-left coordinate */ Ogre::Vector3 getFaceNormal(Ogre::Image& img, int x, int y); /** * \brief Gets the normal of a vertex calculated from the face normals of surrounding faces */ Ogre::Vector3 getVertexNormal(Ogre::Image& img, int x, int y); /** * \brief Adds a single vertex to the heightmap, along with texcoords and normals */ void putElement(Ogre::Image& img, int tile1, int tile2, int x, int y, Ogre::ManualObject* geometry, int ox, int oy); /** * \brief Stores the geometry */ Ogre::ManualObject* mGeometry; NxActor* CreateHeightfield(const NxVec3& pos, int index, NxReal step); void RenderHeightfield(); }; #endif
