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
5
#ifndef __I_GEOMETRY_CREATOR_H_INCLUDED__
6
#define __I_GEOMETRY_CREATOR_H_INCLUDED__
8
#include "IReferenceCounted.h"
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
29
//! Creates a simple cube mesh.
31
\param size Dimensions of the cube.
32
\return Generated mesh.
34
virtual IMesh* createCubeMesh(const core::vector3df& size=core::vector3df(5.f,5.f,5.f)) const =0;
36
//! Create a pseudo-random mesh representing a hilly terrain.
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.
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;
53
//! Create a simple rectangular textured plane mesh.
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.
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
67
return createHillPlaneMesh(tileSize, tileCount, material, 0.f, core::dimension2df(), textureRepeatCount);
70
//! Create a terrain mesh from an image representing a heightfield.
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
78
and a stretchSize of (10.f, 20.f) will produce a mesh of size
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.
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;
93
//! Create an arrow mesh, composed of a cylinder and a cone.
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
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.
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;
114
//! Create a sphere mesh.
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.
121
virtual IMesh* createSphereMesh(f32 radius = 5.f,
122
u32 polyCountX = 16, u32 polyCountY = 16) const =0;
124
//! Create a cylinder mesh.
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.
134
virtual IMesh* createCylinderMesh(f32 radius, f32 length,
136
const video::SColor& color=video::SColor(0xffffffff),
137
bool closeTop=true, f32 oblique=0.f) const =0;
139
//! Create a cone mesh.
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.
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;
154
//! Create a volume light mesh.
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.
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;
173
} // end namespace scene
174
} // end namespace irr
176
#endif // __I_GEOMETRY_CREATOR_H_INCLUDED__