Page 1 of 1
tutorial on point clouds and polygons
Posted: Fri Jan 28, 2011 12:53 am
by pandoragami
I've been trying to find a good example on using this method for a point cloud
Code: Select all
ISceneNode.setMaterialFlag(E_MATERIAL_FLAG.EMF_POINTCLOUD, true).
I also wanted to know how I can draw polygons such as cubes and spheres in 3d.
thanks
Posted: Fri Jan 28, 2011 1:12 am
by Anthony
addCubeSceneNode
goes for a sphere too
but what is a pointcloud
EDIT: thanks RaverGames
Posted: Fri Jan 28, 2011 6:39 am
by RaverGames
@random_anonymouse
Pointcloud will render the Vertices of a SceneNode
Posted: Fri Jan 28, 2011 7:56 am
by Bear_130278
viceversa
Posted: Fri Jan 28, 2011 8:17 am
by pandoragami
I tried to follow this tutorial
http://irrlicht.sourceforge.net/phpBB2/ ... =primitive
and I got this code but theres no cube?
Code: Select all
#include <C:\irrlicht-1.7.2\include\irrlicht.h>
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace gui;
/*
IrrlichtDevice* device = createDevice(EDT_OPENGL, core::dimension2d<s32>(640,480));
OpenGL - EDT_OPENGL
DirectX 8 - EDT_DIRECT3D8
DirectX 9 - EDT_DIRECT3D9
Software - EDT_SOFTWARE
Sofware 2 - EDT_BURNINGSVIDEO
IVideoDriver* video = device->getVideoDriver();
ISceneManager* smgr = device->getSceneManager();
*/
int main()
{
IrrlichtDevice *device = createDevice(EDT_OPENGL);
IVideoDriver* video = device->getVideoDriver();
ISceneManager* smgr = device->getSceneManager();
ISceneNode* cube = smgr->addCubeSceneNode();
cube->setPosition(vector3df(0,0,0));
while(device->run() && device)
{
video->beginScene(true, true, video::SColor(255,0,0,255));
smgr->drawAll();
video->endScene();
}
}
Posted: Fri Jan 28, 2011 8:19 am
by Sylence
Yes there is no camera so you won't see anything
Posted: Fri Jan 28, 2011 8:22 am
by pandoragami
Yes there is no camera so you won't see anything
Oh! Well I guess he could've explained that part in the tut. I'm not sure how to add a camera, could you maybe hack my code to include one?
Nevermind, I just added
Code: Select all
smgr->addCameraSceneNode(0, vector3df(0,30,-40), vector3df(0,5,0));
into
Code: Select all
#include <C:\irrlicht-1.7.2\include\irrlicht.h>
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace gui;
/*
IrrlichtDevice* device = createDevice(EDT_OPENGL, core::dimension2d<s32>(640,480));
OpenGL - EDT_OPENGL
DirectX 8 - EDT_DIRECT3D8
DirectX 9 - EDT_DIRECT3D9
Software - EDT_SOFTWARE
Sofware 2 - EDT_BURNINGSVIDEO
IVideoDriver* video = device->getVideoDriver();
ISceneManager* smgr = device->getSceneManager();
*/
int main()
{
IrrlichtDevice *device = createDevice(EDT_OPENGL);
IVideoDriver* video = device->getVideoDriver();
ISceneManager* smgr = device->getSceneManager();
ISceneNode* cube = smgr->addCubeSceneNode();
cube->setPosition(vector3df(0,0,0));
smgr->addCameraSceneNode(0, vector3df(0,30,-40), vector3df(0,5,0));
while(device->run() && device)
{
video->beginScene(true, true, video::SColor(255,0,0,255));
smgr->drawAll();
video->endScene();
}
}
@RaverGames
Do you have any actual code that could help me. I see the point cloud idea better now although I'm lost with what method I use and what parameters are false, etc. A working example or snippet would be fine or just add a couple of lines to my code above, thanks
Posted: Fri Jan 28, 2011 8:40 am
by hybrid
You can check out wireframe and point cloud in the terrain example of the SDK. Just press 'w' and 'p' to change modes.
Posted: Fri Jan 28, 2011 9:15 am
by pandoragami
@hybrid
I compiled the source for that and it works but it only does wireframe and no point clouds. Is there a parameter in the code I change for that? What line?
Posted: Fri Jan 28, 2011 10:15 am
by janw
Code: Select all
case irr::KEY_KEY_P: // switch wire frame mode
Terrain->setMaterialFlag(video::EMF_POINTCLOUD,
!Terrain->getMaterial(0).PointCloud);
Terrain->setMaterialFlag(video::EMF_WIREFRAME, false);
return true;
at this point mate:), look at the tutorial first ( just a suggestion ) before posting such a questions;)
Posted: Fri Jan 28, 2011 11:59 am
by hybrid
Also note that not all drivers support point cloud rendering. IIRC, the sw drivers don't support it.
Posted: Fri Jan 28, 2011 5:04 pm
by pandoragami
@janw
at this point mate:), look at the tutorial first ( just a suggestion ) before posting such a questions;)
I didnt know about the tutorial before asking.
@hybrid
thanks it works now, used opengl though, thats the only driver that did work.
Posted: Fri Jan 28, 2011 5:07 pm
by hybrid
What? How did you compile sources without knowing about it?
random_anonymouse wrote:I compiled the source for that and it works but it only does wireframe and no point clouds. Is there a parameter in the code I change for that? What line?
Posted: Fri Jan 28, 2011 5:13 pm
by pandoragami
What? How did you compile sources without knowing about it?
I just compiled the sources I didnt look at the code itself. I also didnt know the terrain tutorial had point clouds.