mirror of
https://github.com/minetest/irrlicht.git
synced 2025-06-28 06:20:21 +02:00
Add new cube mesh type ECMT_1BUF_24VTX_NP. CubeSceneNodes can now use different cube mesh types.
1 Meshbuffer with 24 vertices, so each side has it's own vertices. Normals perpendicular to the cube-sides. CubeSceneNode accepts now a ECUBE_MESH_TYPE CubeSceneNode::clone now also clones rotation and scale (not sure why it didn't do that before - hope there was no reason, but can't think of any). ISceneManager::addCubeSceneNode accepts now a ECUBE_MESH_TYPE and passes it through. Example 22.MaterialViewer using new cube type. Also a few more beauty fixes there. git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6313 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
@ -24,15 +24,31 @@ namespace scene
|
||||
{
|
||||
//! Single buffer with 12 different vertices, normals are average of adjacent planes
|
||||
//! Order for outgoing (front-face) normals of planes would be: NEG_Z, POS_X, POS_Z, NEG_X, POS_Y, NEG_Y
|
||||
//! This was the only available type before Irrlicht 1.9, so it's still the default in some functions.
|
||||
//! It has the least vertices, but is pretty much unusable if you have dynamic light
|
||||
ECMT_1BUF_12VTX_NA,
|
||||
|
||||
//! One buffer per side, each with 4 vertices, normals are perpendicular to sides
|
||||
//! Note: You probably will have to scale down your texture uv's to avoid white lines at borders
|
||||
// as this mesh sets them to 0,1 values. We can't do that when creating the mesh as it
|
||||
// depends on texture resolution which we don't know at that point.
|
||||
ECMT_6BUF_4VTX_NP
|
||||
//! You can use this one if you need different texture on each cube side
|
||||
ECMT_6BUF_4VTX_NP,
|
||||
|
||||
//! Single buffer with 24 different vertices, normals are perpendicular to sides
|
||||
ECMT_1BUF_24VTX_NP,
|
||||
|
||||
//! not used, counts the number of enumerated types
|
||||
ECMT_COUNT
|
||||
};
|
||||
|
||||
//! Names for ECUBE_MESH_TYPE
|
||||
const c8* const CubeMeshTypeNames[ECMT_COUNT+1] =
|
||||
{
|
||||
"1BUF_12VTX_NA",
|
||||
"ECMT_6BUF_4VTX_NP",
|
||||
"1BUF_24VTX_NP",
|
||||
0
|
||||
};
|
||||
|
||||
|
||||
//! Helper class for creating geometry on the fly.
|
||||
/** You can get an instance of this class through ISceneManager::getGeometryCreator() */
|
||||
class IGeometryCreator : public IReferenceCounted
|
||||
@ -44,6 +60,9 @@ public:
|
||||
\param size Dimensions of the cube.
|
||||
\param type One of ECUBE_MESH_TYPE. So you can chose between cubes with single material or independent materials per side.
|
||||
\return 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.
|
||||
*/
|
||||
virtual IMesh* createCubeMesh(const core::vector3df& size=core::vector3df(5.f,5.f,5.f), ECUBE_MESH_TYPE type = ECMT_1BUF_12VTX_NA) const =0;
|
||||
|
||||
|
@ -453,13 +453,15 @@ namespace scene
|
||||
where the scene node will be placed.
|
||||
\param rotation: Initial rotation of the scene node.
|
||||
\param scale: Initial scale of the scene node.
|
||||
\param type: Type of cube-mesh to create. Check ECUBE_MESH_TYPE documentation for more info
|
||||
\return Pointer to the created test scene node. This
|
||||
pointer should not be dropped. See IReferenceCounted::drop()
|
||||
for more information. */
|
||||
virtual IMeshSceneNode* addCubeSceneNode(f32 size=10.0f, ISceneNode* parent=0, s32 id=-1,
|
||||
const core::vector3df& position = core::vector3df(0,0,0),
|
||||
const core::vector3df& rotation = core::vector3df(0,0,0),
|
||||
const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f)) = 0;
|
||||
const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f),
|
||||
ECUBE_MESH_TYPE type=ECMT_1BUF_12VTX_NA) = 0;
|
||||
|
||||
//! Adds a sphere scene node of the given radius and detail
|
||||
/** \param radius: Radius of the sphere.
|
||||
|
Reference in New Issue
Block a user