Duckcpp 2.1.0
Duckcpp is a high-performance c++ graphics engine.
Loading...
Searching...
No Matches
dcpp::scene::IGeometryCreator Class Referenceabstract

Helper class for creating geometry on the fly. More...

#include <duckcpp/core/engine/IGeometryCreator.hpp>

Inheritance diagram for dcpp::scene::IGeometryCreator:
Inheritance graph
Collaboration diagram for dcpp::scene::IGeometryCreator:
Collaboration graph

Public Member Functions

virtual IMeshcreateCubeMesh (const dcpp::nub::vector3df &size=dcpp::nub::vector3df(5.f, 5.f, 5.f), ECUBE_MESH_TYPE type=ECMT_1BUF_12VTX_NA) const =0
 Creates a simple cube mesh.
 
virtual IMeshcreateHillPlaneMesh (const dcpp::nub::dimension2df &tileSize, const dcpp::nub::dimension2du &tileCount, dcpp::video::SMaterial *material, dcpp::float32_kt hillHeight, const dcpp::nub::dimension2df &countHills, const dcpp::nub::dimension2df &textureRepeatCount) const =0
 Create a pseudo-random mesh representing a hilly terrain.
 
IMeshcreatePlaneMesh (const dcpp::nub::dimension2df &tileSize, const dcpp::nub::dimension2du &tileCount=dcpp::nub::dimension2du(1, 1), dcpp::video::SMaterial *material=0, const dcpp::nub::dimension2df &textureRepeatCount=dcpp::nub::dimension2df(1.f, 1.f)) const
 Create a simple rectangular textured plane mesh.
 
virtual IMeshcreateGeoplaneMesh (dcpp::float32_kt radius=5.f, dcpp::uint32_kt rows=16, dcpp::uint32_kt columns=16) const =0
 Create a geoplane.
 
virtual IMeshcreateTerrainMesh (dcpp::video::IImage *texture, dcpp::video::IImage *heightmap, const dcpp::nub::dimension2df &stretchSize, dcpp::float32_kt maxHeight, dcpp::video::IVideoDriver *driver, const dcpp::nub::dimension2du &defaultVertexBlockSize, bool debugBorders=false) const =0
 Create a terrain mesh from an image representing a heightfield.
 
virtual IMeshcreateArrowMesh (const dcpp::uint32_kt tesselationCylinder=4, const dcpp::uint32_kt tesselationCone=8, const dcpp::float32_kt height=1.f, const dcpp::float32_kt cylinderHeight=0.6f, const dcpp::float32_kt widthCylinder=0.05f, const dcpp::float32_kt widthCone=0.3f, const dcpp::video::SColor colorCylinder=0xFFFFFFFF, const dcpp::video::SColor colorCone=0xFFFFFFFF) const =0
 Create an arrow mesh, composed of a cylinder and a cone.
 
virtual IMeshcreateSphereMesh (dcpp::float32_kt radius=5.f, dcpp::uint32_kt polyCountX=16, dcpp::uint32_kt polyCountY=16) const =0
 Create a sphere mesh.
 
virtual IMeshcreateCylinderMesh (dcpp::float32_kt radius, dcpp::float32_kt length, dcpp::uint32_kt tesselation, const dcpp::video::SColor &color=dcpp::video::SColor(0xffffffff), bool closeTop=true, dcpp::float32_kt oblique=0.f, dcpp::uint32_kt normalType=0) const =0
 Create a cylinder mesh.
 
virtual IMeshcreateConeMesh (dcpp::float32_kt radius, dcpp::float32_kt length, dcpp::uint32_kt tesselation, const dcpp::video::SColor &colorTop=dcpp::video::SColor(0xffffffff), const dcpp::video::SColor &colorBottom=dcpp::video::SColor(0xffffffff), dcpp::float32_kt oblique=0.f) const =0
 Create a cone mesh.
 
virtual IMeshcreateTorusMesh (dcpp::float32_kt majorRadius, dcpp::float32_kt minorRadius, dcpp::uint32_kt majorSegments=32, dcpp::uint32_kt minorSegments=16, dcpp::float32_kt angleStart=0.f, dcpp::float32_kt angleEnd=360.f, int capEnds=0) const =0
 Create a torus mesh.
 
virtual IMeshcreateVolumeLightMesh (const dcpp::uint32_kt subdivideU=32, const dcpp::uint32_kt subdivideV=32, const dcpp::video::SColor footColor=0xffffffff, const dcpp::video::SColor tailColor=0xffffffff, const dcpp::float32_kt lpDistance=8.f, const dcpp::nub::vector3df &lightDim=dcpp::nub::vector3df(1.f, 1.2f, 1.f)) const =0
 Create a volume light mesh.
 
- Public Member Functions inherited from dcpp::IReferenceCounted
 IReferenceCounted ()
 Constructor.
 
virtual ~IReferenceCounted ()
 Destructor.
 
void grab () const
 Grabs the object. Increments the reference counter by one.
 
bool drop () const
 Drops the object. Decrements the reference counter by one.
 
dcpp::int32_kt getReferenceCount () const
 Get the reference count.
 
const dcpp::char_ktgetDebugName () const
 Returns the debug name of the object.
 

Additional Inherited Members

- Protected Member Functions inherited from dcpp::IReferenceCounted
void setDebugName (const dcpp::char_kt *newName)
 Sets the debug name of the object.
 

Detailed Description

Helper class for creating geometry on the fly.

You can get an instance of this class through ISceneManager::getGeometryCreator()

Member Function Documentation

◆ createArrowMesh()

virtual IMesh * dcpp::scene::IGeometryCreator::createArrowMesh ( const dcpp::uint32_kt  tesselationCylinder = 4,
const dcpp::uint32_kt  tesselationCone = 8,
const dcpp::float32_kt  height = 1.f,
const dcpp::float32_kt  cylinderHeight = 0.6f,
const dcpp::float32_kt  widthCylinder = 0.05f,
const dcpp::float32_kt  widthCone = 0.3f,
const dcpp::video::SColor  colorCylinder = 0xFFFFFFFF,
const dcpp::video::SColor  colorCone = 0xFFFFFFFF 
) const
pure virtual

Create an arrow mesh, composed of a cylinder and a cone.

Parameters
tesselationCylinderNumber of quads composing the cylinder.
tesselationConeNumber of triangles composing the cone's roof.
heightTotal height of the arrow
cylinderHeightTotal height of the cylinder, should be lesser than total height
widthCylinderDiameter of the cylinder
widthConeDiameter of the cone's base, should be not smaller than the cylinder's diameter
colorCylindercolor of the cylinder
colorConecolor of the cone
Returns
Generated mesh.

◆ createConeMesh()

virtual IMesh * dcpp::scene::IGeometryCreator::createConeMesh ( dcpp::float32_kt  radius,
dcpp::float32_kt  length,
dcpp::uint32_kt  tesselation,
const dcpp::video::SColor colorTop = dcpp::video::SColor(0xffffffff),
const dcpp::video::SColor colorBottom = dcpp::video::SColor(0xffffffff),
dcpp::float32_kt  oblique = 0.f 
) const
pure virtual

Create a cone mesh.

Parameters
radiusRadius of the cone.
lengthLength of the cone.
tesselationNumber of quads around the circumference of the cone.
colorTopThe color of the top of the cone.
colorBottomThe color of the bottom of the cone.
oblique(to be documented)
Returns
Generated mesh.

◆ createCubeMesh()

virtual IMesh * dcpp::scene::IGeometryCreator::createCubeMesh ( const dcpp::nub::vector3df size = dcpp::nub::vector3df(5.f, 5.f, 5.f),
ECUBE_MESH_TYPE  type = ECMT_1BUF_12VTX_NA 
) const
pure virtual

Creates a simple cube mesh.

Parameters
sizeDimensions of the cube.
typeOne of ECUBE_MESH_TYPE. So you can chose between cubes with single material or independent materials per side.
Returns
Generated mesh. Note: UV's go always from 0 to 1. Which can produce wrong colors at edges with texture filtering. Fixing UV's depends on texture-size (have to be moved half a pixel towards the inside, so 0.5f/texure_size as then the pixel center is exactly on the border) Easier solution is usually to set TextureWrapU and TextureWrapV to ETC_CLAMP_TO_EDGE in the Material.

◆ createCylinderMesh()

virtual IMesh * dcpp::scene::IGeometryCreator::createCylinderMesh ( dcpp::float32_kt  radius,
dcpp::float32_kt  length,
dcpp::uint32_kt  tesselation,
const dcpp::video::SColor color = dcpp::video::SColor(0xffffffff),
bool  closeTop = true,
dcpp::float32_kt  oblique = 0.f,
dcpp::uint32_kt  normalType = 0 
) const
pure virtual

Create a cylinder mesh.

Parameters
radiusRadius of the cylinder.
lengthLength of the cylinder.
tesselationNumber of quads around the circumference of the cylinder.
colorThe color of the cylinder.
closeTopIf true, close the ends of the cylinder, otherwise leave them open.
obliqueX-offset (shear) of top compared to bottom.
normalTypeWhen 0 side normals are radial from origin. Note that origin is at the bottom. When 1 side normals are flat along top/bottom polygons. NOTE: To get normals which are perpendicular to the side of an oblique cylinder, don't use the oblique parameter. Instead set normalType to 1 and create a cylinder with oblique set to 0. Then use IMeshManipulator::transform with a shear matrix on the returned mesh. You get a shear matrix for an identical effect of this oblique parameter when you set the 4th element of an identity matrix to (oblique/length).
Returns
Generated mesh.

◆ createGeoplaneMesh()

virtual IMesh * dcpp::scene::IGeometryCreator::createGeoplaneMesh ( dcpp::float32_kt  radius = 5.f,
dcpp::uint32_kt  rows = 16,
dcpp::uint32_kt  columns = 16 
) const
pure virtual

Create a geoplane.

Parameters
radiusRadius of the plane
rowsHow many rows to place
columnsHow many columns to place
Returns
Generated mesh.

◆ createHillPlaneMesh()

virtual IMesh * dcpp::scene::IGeometryCreator::createHillPlaneMesh ( const dcpp::nub::dimension2df tileSize,
const dcpp::nub::dimension2du tileCount,
dcpp::video::SMaterial material,
dcpp::float32_kt  hillHeight,
const dcpp::nub::dimension2df countHills,
const dcpp::nub::dimension2df textureRepeatCount 
) const
pure virtual

Create a pseudo-random mesh representing a hilly terrain.

Parameters
tileSizeThe size of each tile.
tileCountThe number of tiles in each dimension.
materialThe material to apply to the mesh.
hillHeightThe maximum height of the hills.
countHillsThe number of hills along each dimension.
textureRepeatCountThe number of times to repeat the material texture along each dimension.
Returns
Generated mesh.

◆ createPlaneMesh()

IMesh * dcpp::scene::IGeometryCreator::createPlaneMesh ( const dcpp::nub::dimension2df tileSize,
const dcpp::nub::dimension2du tileCount = dcpp::nub::dimension2du(1,1),
dcpp::video::SMaterial material = 0,
const dcpp::nub::dimension2df textureRepeatCount = dcpp::nub::dimension2df(1.f,1.f) 
) const
inline

Create a simple rectangular textured plane mesh.

Parameters
tileSizeThe size of each tile.
tileCountThe number of tiles in each dimension.
materialThe material to apply to the mesh.
textureRepeatCountThe number of times to repeat the material texture along each dimension.
Returns
Generated mesh.

◆ createSphereMesh()

virtual IMesh * dcpp::scene::IGeometryCreator::createSphereMesh ( dcpp::float32_kt  radius = 5.f,
dcpp::uint32_kt  polyCountX = 16,
dcpp::uint32_kt  polyCountY = 16 
) const
pure virtual

Create a sphere mesh.

Parameters
radiusRadius of the sphere
polyCountXNumber of quads used for the horizontal tiling
polyCountYNumber of quads used for the vertical tiling
Returns
Generated mesh.

◆ createTerrainMesh()

virtual IMesh * dcpp::scene::IGeometryCreator::createTerrainMesh ( dcpp::video::IImage texture,
dcpp::video::IImage heightmap,
const dcpp::nub::dimension2df stretchSize,
dcpp::float32_kt  maxHeight,
dcpp::video::IVideoDriver driver,
const dcpp::nub::dimension2du defaultVertexBlockSize,
bool  debugBorders = false 
) const
pure virtual

Create a terrain mesh from an image representing a heightfield.

Parameters
textureThe texture to apply to the terrain.
heightmapAn image that will be interpreted as a heightmap. The brightness (average color) of each pixel is interpreted as a height, with a 255 brightness pixel producing the maximum height.
stretchSizeThe size that each pixel will produce, i.e. a 512x512 heightmap and a stretchSize of (10.f, 20.f) will produce a mesh of size 5120.f x 10240.f
maxHeightThe maximum height of the terrain.
driverThe current video driver.
defaultVertexBlockSize(to be documented)
debugBorders(to be documented)
Returns
Generated mesh.

◆ createTorusMesh()

virtual IMesh * dcpp::scene::IGeometryCreator::createTorusMesh ( dcpp::float32_kt  majorRadius,
dcpp::float32_kt  minorRadius,
dcpp::uint32_kt  majorSegments = 32,
dcpp::uint32_kt  minorSegments = 16,
dcpp::float32_kt  angleStart = 0.f,
dcpp::float32_kt  angleEnd = 360.f,
int  capEnds = 0 
) const
pure virtual

Create a torus mesh.

Note: Segments might get reduced to ensure it fits into 16-bit meshbuffer. With 255 segments for minor and major circle you'll hit the maximum. When using caps 2 more vertices are added. Note: UV's for caps are probably not useful

Parameters
majorRadiusStarting from mesh center
minorRadiusStarting from a circle at majorRadius distance around center
majorSegmentsSegments for major circle. Will use at least 3 segments.
minorSegmentsSegments for minor circle. Will use at least 3 segments.
angleStartStart major circle between 0 and 360° and < angleEnd
angleEndEnd major circle between 0 and 360° and > angleStart
capEndsWhen you don't create a full major circle you might want caps 0 = no caps (default) Bit 1: add cap at angleStart Bit 2: add cap at angleEnd

◆ createVolumeLightMesh()

virtual IMesh * dcpp::scene::IGeometryCreator::createVolumeLightMesh ( const dcpp::uint32_kt  subdivideU = 32,
const dcpp::uint32_kt  subdivideV = 32,
const dcpp::video::SColor  footColor = 0xffffffff,
const dcpp::video::SColor  tailColor = 0xffffffff,
const dcpp::float32_kt  lpDistance = 8.f,
const dcpp::nub::vector3df lightDim = dcpp::nub::vector3df(1.f, 1.2f, 1.f) 
) const
pure virtual

Create a volume light mesh.

Parameters
subdivideUHorizontal patch count.
subdivideVVertical patch count.
footColorColor at the bottom of the light.
tailColorColor at the mid of the light.
lpDistanceVirtual distance of the light point for normals.
lightDimDimensions of the light.
Returns
Generated mesh.

The documentation for this class was generated from the following file:

Duckcpp    @cppfx.xyz