~baltix/+junk/irrlicht-test

« back to all changes in this revision

Viewing changes to include/IGeometryCreator.h

  • Committer: Mantas Kriaučiūnas
  • Date: 2011-07-18 13:06:25 UTC
  • Revision ID: mantas@akl.lt-20110718130625-c5pvifp61e7kj1ol
Included whole irrlicht SVN libraries to work around launchpad recipe issue with quilt, see https://answers.launchpad.net/launchpad/+question/165193

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright (C) 2002-2011 Nikolaus Gebhardt
 
2
// This file is part of the "Irrlicht Engine".
 
3
// For conditions of distribution and use, see copyright notice in irrlicht.h
 
4
 
 
5
#ifndef __I_GEOMETRY_CREATOR_H_INCLUDED__
 
6
#define __I_GEOMETRY_CREATOR_H_INCLUDED__
 
7
 
 
8
#include "IReferenceCounted.h"
 
9
#include "IMesh.h"
 
10
#include "IImage.h"
 
11
 
 
12
namespace irr
 
13
{
 
14
namespace video
 
15
{
 
16
        class IVideoDriver;
 
17
        class SMaterial;
 
18
}
 
19
 
 
20
namespace scene
 
21
{
 
22
 
 
23
//! Helper class for creating geometry on the fly.
 
24
/** You can get an instance of this class through ISceneManager::getGeometryCreator() */
 
25
class IGeometryCreator : public IReferenceCounted
 
26
{
 
27
public:
 
28
 
 
29
        //! Creates a simple cube mesh.
 
30
        /**
 
31
        \param size Dimensions of the cube.
 
32
        \return Generated mesh.
 
33
        */
 
34
        virtual IMesh* createCubeMesh(const core::vector3df& size=core::vector3df(5.f,5.f,5.f)) const =0;
 
35
 
 
36
        //! Create a pseudo-random mesh representing a hilly terrain.
 
37
        /**
 
38
        \param tileSize The size of each tile.
 
39
        \param tileCount The number of tiles in each dimension.
 
40
        \param material The material to apply to the mesh.
 
41
        \param hillHeight The maximum height of the hills.
 
42
        \param countHills The number of hills along each dimension.
 
43
        \param textureRepeatCount The number of times to repeat the material texture along each dimension.
 
44
        \return Generated mesh.
 
45
        */
 
46
        virtual IMesh* createHillPlaneMesh(
 
47
                        const core::dimension2d<f32>& tileSize,
 
48
                        const core::dimension2d<u32>& tileCount,
 
49
                        video::SMaterial* material, f32 hillHeight,
 
50
                        const core::dimension2d<f32>& countHills,
 
51
                        const core::dimension2d<f32>& textureRepeatCount) const =0;
 
52
 
 
53
        //! Create a simple rectangular textured plane mesh.
 
54
        /**
 
55
        \param tileSize The size of each tile.
 
56
        \param tileCount The number of tiles in each dimension.
 
57
        \param material The material to apply to the mesh.
 
58
        \param textureRepeatCount The number of times to repeat the material texture along each dimension.
 
59
        \return Generated mesh.
 
60
        */
 
61
        IMesh* createPlaneMesh(
 
62
                        const core::dimension2d<f32>& tileSize,
 
63
                        const core::dimension2d<u32>& tileCount=core::dimension2du(1,1),
 
64
                        video::SMaterial* material=0,
 
65
                        const core::dimension2df& textureRepeatCount=core::dimension2df(1.f,1.f)) const
 
66
        {
 
67
                return createHillPlaneMesh(tileSize, tileCount, material, 0.f, core::dimension2df(), textureRepeatCount);
 
68
        }
 
69
 
 
70
        //! Create a terrain mesh from an image representing a heightfield.
 
71
        /**
 
72
        \param texture The texture to apply to the terrain.
 
73
        \param heightmap An image that will be interpreted as a heightmap. The
 
74
        brightness (average colour) of each pixel is interpreted as a height,
 
75
        with a 255 brightness pixel producing the maximum height.
 
76
        \param stretchSize The size that each pixel will produce, i.e. a
 
77
        512x512 heightmap
 
78
        and a stretchSize of (10.f, 20.f) will produce a mesh of size
 
79
        5120.f x 10240.f
 
80
        \param maxHeight The maximum height of the terrain.
 
81
        \param driver The current video driver.
 
82
        \param defaultVertexBlockSize (to be documented)
 
83
        \param debugBorders (to be documented)
 
84
        \return Generated mesh.
 
85
        */
 
86
        virtual IMesh* createTerrainMesh(video::IImage* texture,
 
87
                        video::IImage* heightmap,
 
88
                        const core::dimension2d<f32>& stretchSize,
 
89
                        f32 maxHeight, video::IVideoDriver* driver,
 
90
                        const core::dimension2d<u32>& defaultVertexBlockSize,
 
91
                        bool debugBorders=false) const =0;
 
92
 
 
93
        //! Create an arrow mesh, composed of a cylinder and a cone.
 
94
        /**
 
95
        \param tesselationCylinder Number of quads composing the cylinder.
 
96
        \param tesselationCone Number of triangles composing the cone's roof.
 
97
        \param height Total height of the arrow
 
98
        \param cylinderHeight Total height of the cylinder, should be lesser
 
99
        than total height
 
100
        \param widthCylinder Diameter of the cylinder
 
101
        \param widthCone Diameter of the cone's base, should be not smaller
 
102
        than the cylinder's diameter
 
103
        \param colorCylinder color of the cylinder
 
104
        \param colorCone color of the cone
 
105
        \return Generated mesh.
 
106
        */
 
107
        virtual IMesh* createArrowMesh(const u32 tesselationCylinder = 4,
 
108
                        const u32 tesselationCone = 8, const f32 height = 1.f,
 
109
                        const f32 cylinderHeight = 0.6f, const f32 widthCylinder = 0.05f,
 
110
                        const f32 widthCone = 0.3f, const video::SColor colorCylinder = 0xFFFFFFFF,
 
111
                        const video::SColor colorCone = 0xFFFFFFFF) const =0;
 
112
 
 
113
 
 
114
        //! Create a sphere mesh.
 
115
        /**
 
116
        \param radius Radius of the sphere
 
117
        \param polyCountX Number of quads used for the horizontal tiling
 
118
        \param polyCountY Number of quads used for the vertical tiling
 
119
        \return Generated mesh.
 
120
        */
 
121
        virtual IMesh* createSphereMesh(f32 radius = 5.f,
 
122
                        u32 polyCountX = 16, u32 polyCountY = 16) const =0;
 
123
 
 
124
        //! Create a cylinder mesh.
 
125
        /**
 
126
        \param radius Radius of the cylinder.
 
127
        \param length Length of the cylinder.
 
128
        \param tesselation Number of quads around the circumference of the cylinder.
 
129
        \param color The color of the cylinder.
 
130
        \param closeTop If true, close the ends of the cylinder, otherwise leave them open.
 
131
        \param oblique (to be documented)
 
132
        \return Generated mesh.
 
133
        */
 
134
        virtual IMesh* createCylinderMesh(f32 radius, f32 length,
 
135
                        u32 tesselation,
 
136
                        const video::SColor& color=video::SColor(0xffffffff),
 
137
                        bool closeTop=true, f32 oblique=0.f) const =0;
 
138
 
 
139
        //! Create a cone mesh.
 
140
        /**
 
141
        \param radius Radius of the cone.
 
142
        \param length Length of the cone.
 
143
        \param tesselation Number of quads around the circumference of the cone.
 
144
        \param colorTop The color of the top of the cone.
 
145
        \param colorBottom The color of the bottom of the cone.
 
146
        \param oblique (to be documented)
 
147
        \return Generated mesh.
 
148
        */
 
149
        virtual IMesh* createConeMesh(f32 radius, f32 length, u32 tesselation,
 
150
                        const video::SColor& colorTop=video::SColor(0xffffffff),
 
151
                        const video::SColor& colorBottom=video::SColor(0xffffffff),
 
152
                        f32 oblique=0.f) const =0;
 
153
 
 
154
        //! Create a volume light mesh.
 
155
        /**
 
156
        \param subdivideU Horizontal patch count.
 
157
        \param subdivideV Vertical patch count.
 
158
        \param footColor Color at the bottom of the light.
 
159
        \param tailColor Color at the mid of the light.
 
160
        \param lpDistance Virtual distance of the light point for normals.
 
161
        \param lightDim Dimensions of the light.
 
162
        \return Generated mesh.
 
163
        */
 
164
        virtual IMesh* createVolumeLightMesh(
 
165
                        const u32 subdivideU=32, const u32 subdivideV=32,
 
166
                        const video::SColor footColor = 0xffffffff,
 
167
                        const video::SColor tailColor = 0xffffffff,
 
168
                        const f32 lpDistance = 8.f,
 
169
                        const core::vector3df& lightDim = core::vector3df(1.f,1.2f,1.f)) const =0;
 
170
};
 
171
 
 
172
 
 
173
} // end namespace scene
 
174
} // end namespace irr
 
175
 
 
176
#endif // __I_GEOMETRY_CREATOR_H_INCLUDED__
 
177