mSceneMgr->createItem for PT_SPHERE

Discussion area about developing with Ogre-Next (2.1, 2.2 and beyond)


Post Reply
User avatar
Aiden
Halfling
Posts: 54
Joined: Fri Jul 14, 2017 3:16 pm
x 5

mSceneMgr->createItem for PT_SPHERE

Post by Aiden »

Hi,
Considering that createItem is much more efficient than createEntity, will this become possilbe in 2.1 ?
I think creating a sphere should've been the first thing to become available in 2.1 as this should be an inbuilt object.

Code: Select all

mSceneMgr->createItem( Ogre::SceneManager::PT_SPHERE);
Now I have to create an Entity to get a sphere.
Hrenli
Halfling
Posts: 73
Joined: Tue Jun 14, 2016 12:26 pm
x 19

Re: mSceneMgr->createItem for PT_SPHERE

Post by Hrenli »

It's less about difference between item and entity but more about difference between v1 and v2 mesh managers. I.e. what you should do (I think) is not create entity but create a v1 mesh, import it as v2 mesh and create an item based on it. Alternative solution - load a .mesh file which contains a sphere (takes seconds to create in any 3D modeling tool).

Still, in a perfect world it would be nice if v2 MeshManager could generate a sphere directly as a v2 mesh. But, honestly, I don't think it's anywhere important... Just my opinion though. :)
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5296
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1278
Contact:

Re: mSceneMgr->createItem for PT_SPHERE

Post by dark_sylinc »

Hrenli wrote:But, honestly, I don't think it's anywhere important... Just my opinion though. :)
I agree. Maintaining these built-ins has a hidden cost, and users don't agree how a sphere should be generated (UV Sphere vs icosphere, how the UVs should be mapped, being able to choose number of vertices, whether it should have tangents, etc).

There is a "Sphere1000.mesh" file bundled in DebugPack.zip to address the trivial needs. It's a UV sphere with 1000 vertices. Likewise there's a "Cube_d.mesh" bundled there too.
User avatar
Aiden
Halfling
Posts: 54
Joined: Fri Jul 14, 2017 3:16 pm
x 5

Re: mSceneMgr->createItem for PT_SPHERE

Post by Aiden »

Hrenli wrote:Alternative solution - load a .mesh file which contains a sphere (takes seconds to create in any 3D modeling tool).
Found one mesh in the media folder, I suppose the devs thought of this too.
User avatar
Aiden
Halfling
Posts: 54
Joined: Fri Jul 14, 2017 3:16 pm
x 5

Re: mSceneMgr->createItem for PT_SPHERE

Post by Aiden »

I converted some of the oldmeshes, it seems the converted meshes have issues and am better of just using the inbuilt v1 importer.
I tried placing a v1 to v2 converted mesh at 0,0,0 as an item but it's not visible, however Stickman mesh shows up.
Hrenli
Halfling
Posts: 73
Joined: Tue Jun 14, 2016 12:26 pm
x 19

Re: mSceneMgr->createItem for PT_SPHERE

Post by Hrenli »

Aiden wrote:I tried placing a v1 to v2 converted mesh at 0,0,0 as an item
V2Mesh sample does just that and works fine. Check what is different between your code and the sample.
User avatar
Aiden
Halfling
Posts: 54
Joined: Fri Jul 14, 2017 3:16 pm
x 5

Re: mSceneMgr->createItem for PT_SPHERE

Post by Aiden »

I'm using Empty_project as the base of my app.
I'm using default emptyproject in 2.1 samples dir.Some of the meshes that came with 2.1 display correctly. While my converted ones don't.
Post Reply