Commit 7b5c07e9 authored by Rogerborg's avatar Rogerborg

Add missing test files, update IGeometryCreator.h. Re-enable...

Add missing test files, update IGeometryCreator.h.  Re-enable makeColorKeyTexture test - apologies if this is still borked on some platforms: please feel free to disable it again.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@2208 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 2340f9b8
......@@ -6,50 +6,116 @@
#define __I_GEOMETRY_CREATOR_H_INCLUDED__
#include "IMesh.h"
#include "IVideoDriver.h"
#include "IImage.h"
namespace irr
{
namespace video
{
class IVideoDriver;
class SMaterial;
}
namespace scene
{
//! class for creating geometry on the fly
//! Helper class for creating geometry on the fly.
/** You can get an instance of this class through ISceneManager::getGeometryCreator() */
class IGeometryCreator
{
public:
//! Create a psuedo-random mesh representing a hilly terrain.
/**
\param tileSize The size of each time.
\param tileCount The number of tiles in each dimension.
\param material The material to apply to the mesh.
\param hillHeight The maximum height of the hills.
\param countHills The number of hills along each dimension.
\param textureRepeatCount The number of times to repeat the material texture along each dimension.
*/
virtual IMesh* createHillPlaneMesh(
const core::dimension2d<f32>& tileSize, const core::dimension2d<u32>& tileCount,
video::SMaterial* material, f32 hillHeight, const core::dimension2d<f32>& countHills,
const core::dimension2d<f32>& textureRepeatCount) const = 0;
//! Create a terrain mesh from an image representing a heightfield.
/**
\param texture The texture to apply to the terrain.
\param heightmap An image that will be interpreted as a heightmap. The brightness
(average colour) of each pixel is interpreted as a height, with a 255 brightness
pixel producing the maximum height.
\param stretchSize The 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
\param maxHeight The maximum height of the terrain.
\param driver The current video driver.
\param defaultVertexBlockSize (to be documented)
\param debugBorders (to be documented)
*/
virtual IMesh* createTerrainMesh(video::IImage* texture,
video::IImage* heightmap, const core::dimension2d<f32>& stretchSize,
f32 maxHeight, video::IVideoDriver* driver,
const core::dimension2d<u32>& defaultVertexBlockSize,
bool debugBorders=false) const = 0;
virtual IMesh* createArrowMesh(const u32 tesselationCylinder,
const u32 tesselationCone, const f32 height,
const f32 cylinderHeight, const f32 width0,
const f32 width1, const video::SColor vtxColor0,
const video::SColor vtxColor1) const = 0;
//! Create an arrow mesh, composed of a cylinder and a cone.
/**
\param tesselationCylinder Number of quads composing the cylinder.
\param tesselationCone Number of triangles composing the cone's roof.
\param height Total height of the arrow
\param cylinderHeight Total height of the cylinder, should be lesser than total height
\param widthCylinder Diameter of the cylinder
\param widthCone Diameter of the cone's base, should be not smaller than the cylinder's diameter
\param colorCylinder color of the cylinder
\param colorCone color of the cone
*/
virtual IMesh* createArrowMesh(const u32 tesselationCylinder = 4,
const u32 tesselationCone = 8, const f32 height = 1.f,
const f32 cylinderHeight = 0.6f, const f32 widthCylinder = 0.05f,
const f32 widthCone = 0.3f, const video::SColor colorCylinder = 0xFFFFFFFF,
const video::SColor colorCone = 0xFFFFFFFF) const = 0;
virtual IMesh* createSphereMesh(f32 radius, u32 polyCountX, u32 polyCountY) const = 0;
//! Create a sphere mesh.
/**
\param radius Radius of the sphere
\param polyCountX Number of quads used for the horizontal tiling
\param polyCountY Number of quads used for the vertical tiling
*/
virtual IMesh* createSphereMesh(f32 radius = 5.f, u32 polyCountX = 16,
u32 polyCountY = 16) const = 0;
virtual IMesh* createCylinderMesh(f32 radius, f32 length, u32 tesselation,
const video::SColor& color=video::SColor(0xffffffff),
//! Create a cylinder mesh.
/**
\param radius Radius of the cylinder.
\param length Length of the cylinder.
\param tesselation Number of quads around the circumference of the cylinder.
\param color The color of the cylinder.
\param closeTop If true, close the ends of the cylinder, otherwise leave them open.
\param oblique (to be documented)
*/
virtual IMesh* createCylinderMesh(f32 radius, f32 length, u32 tesselation,
const video::SColor& color=video::SColor(0xffffffff),
bool closeTop=true, f32 oblique=0.f) const = 0;
virtual IMesh* createConeMesh(f32 radius, f32 length, u32 tesselation,
const video::SColor& colorTop=video::SColor(0xffffffff),
const video::SColor& colorBottom=video::SColor(0xffffffff), f32 oblique=0.f) const = 0;
//! Create a cone mesh.
/**
\param radius Radius of the cone.
\param length Length of the cone.
\param tesselation Number of quads around the circumference of the cone.
\param colorTop The color of the top of the cone.
\param colorBottom The color of the bottom of the cone.
\param oblique (to be documented)
*/
virtual IMesh* createConeMesh(f32 radius, f32 length, u32 tesselation,
const video::SColor& colorTop=video::SColor(0xffffffff),
const video::SColor& colorBottom=video::SColor(0xffffffff),
f32 oblique=0.f) const = 0;
};
} // end namespace scene
} // end namespace irr
#endif
#endif // __I_GEOMETRY_CREATOR_H_INCLUDED__
......@@ -58,8 +58,6 @@ int main(int argumentCount, char * arguments[])
TEST(disambiguateTextures); // Normally you should run this first, since it validates the working directory.
TEST(exports);
#if 1
TEST(sceneCollisionManager);
TEST(testVector3d);
TEST(testVector2d);
......@@ -88,13 +86,9 @@ int main(int argumentCount, char * arguments[])
TEST(vectorPositionDimension2d);
TEST(writeImageToFile);
TEST(flyCircleAnimator);
//TEST(enumerateImageManipulators);
//TEST(testGeometryCreator);
#else
TEST(enumerateImageManipulators);
TEST(testGeometryCreator);
TEST(makeColorKeyTexture);
tests[2].testSignature();
#endif
const unsigned int numberOfTests = tests.size();
......
// Copyright (C) 2008-2009 Colin MacDonald
// No rights reserved: this software is in the public domain.
#include "testUtils.h"
#include "irrlicht.h"
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
/** Tests that the geometry creator does what it says it does. */
bool testGeometryCreator(void)
{
IrrlichtDevice *device = createDevice(video::EDT_BURNINGSVIDEO,
core::dimension2du(160,120), 32);
if (!device)
return false;
IVideoDriver* driver = device->getVideoDriver();
ISceneManager* smgr = device->getSceneManager();
(void)smgr->addCameraSceneNode(0, vector3df(0, 0, -50));
const IGeometryCreator * geom = smgr->getGeometryCreator();
ITexture * wall = driver->getTexture("../media/wall.bmp");
SMaterial material;
material.Lighting = false;
material.TextureLayer[0].Texture = wall;
IMeshSceneNode * node = smgr->addMeshSceneNode(
geom->createHillPlaneMesh(dimension2df(10, 5), dimension2du(5, 5),
&material, 10, dimension2df(2, 2), dimension2df(3, 3)), 0, -1,
vector3df(0, 10, 0), vector3df(-60, 0, 0));
node = smgr->addMeshSceneNode(geom->createArrowMesh(4, 8, 10, 6, 3, 6,
SColor(255, 255, 0, 0), SColor(255, 0, 255, 0)),
0, -1, vector3df(-10, -20, 0));
node->setMaterialFlag(video::EMF_LIGHTING, false);
node = smgr->addMeshSceneNode(geom->createSphereMesh(), 0, -1, vector3df(10, -15, 0));
node->setMaterialFlag(video::EMF_LIGHTING, false);
node->setMaterialTexture(0, wall);
bool result = false;
device->run();
if (driver->beginScene(true, true, video::SColor(0, 80, 80, 80)))
{
smgr->drawAll();
driver->endScene();
result = takeScreenshotAndCompareAgainstReference(driver, "-testGeometryCreator.png", 100);
}
device->drop();
return result;
}
Test suite pass at GMT Tue Feb 10 14:54:11 2009
Test suite pass at GMT Tue Feb 10 22:17:38 2009
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment