EPT_POINTS help

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Harch
Posts: 75
Joined: Wed Oct 08, 2014 9:01 pm

EPT_POINTS help

Post by Harch »

This node is not drawn. If you replace EPT_POINTS on EPT_TRIANGLES in render(), it all works. Help draw with EPT_POINTS. What am i doing wrong? Irrlicht 1.8.1.

Code: Select all

 
class CloudPoints : public scene::ISceneNode
{
    private:
        core::aabbox3d<f32> Box;
        video::S3DVertex Vertices[4];
        video::SMaterial Material;
 
    public:
        CloudPoints(scene::ISceneNode* parent, scene::ISceneManager* mgr, s32 id)
            : scene::ISceneNode(parent, mgr, id)
        {
            Material.Wireframe = true;
            Material.PointCloud = true;
            Material.Lighting = false;
            Material.Thickness = 10000.0f;
 
            Vertices[0] = video::S3DVertex(0,0,10, 1,1,0,
                    video::SColor(255,0,255,255), 0, 1);
            Vertices[1] = video::S3DVertex(10,0,-10, 1,0,0,
                    video::SColor(255,255,0,255), 1, 1);
            Vertices[2] = video::S3DVertex(0,20,0, 0,1,1,
                    video::SColor(255,255,255,0), 1, 0);
            Vertices[3] = video::S3DVertex(-10,0,-10, 0,0,1,
                    video::SColor(255,0,255,0), 0, 0);
 
            Box.reset(Vertices[0].Pos);
            for (s32 i=1; i<4; ++i)
                Box.addInternalPoint(Vertices[i].Pos);
        }
        virtual void OnRegisterSceneNode()
        {
            if (IsVisible)
                SceneManager->registerNodeForRendering(this);
 
            ISceneNode::OnRegisterSceneNode();
        }
        virtual void render()
        {
            u16 indices[] = {   0,2,3, 2,1,3, 1,0,3, 2,0,1  };
            video::IVideoDriver* driver = SceneManager->getVideoDriver();
 
            driver->setMaterial(Material);
            driver->setTransform(video::ETS_WORLD, AbsoluteTransformation);
            driver->drawVertexPrimitiveList(&Vertices[0], 4, &indices[0], 4, video::EVT_STANDARD, scene::EPT_POINTS, video::EIT_16BIT);
        }
        virtual const core::aabbox3d<f32>& getBoundingBox() const
        {
            return Box;
        }
 
        virtual u32 getMaterialCount() const
        {
            return 1;
        }
 
        virtual video::SMaterial& getMaterial(u32 i)
        {
            return Material;
        }
};
 
Ovan
Posts: 70
Joined: Thu Dec 18, 2008 12:41 am
Contact:

Re: EPT_POINTS help

Post by Ovan »

index count error, i think
EPT_TRIANGLES use 3 index for each triangle so you divide the index count by 3
EPT_LINES use 2 index .... divide the index count by 2 ...
so for EPT_POINTS you use 1 index for each ... point, here you need to use 12 as index count

ps: &Vertices[0] == Vertices same for indices (and can be static const)
Harch
Posts: 75
Joined: Wed Oct 08, 2014 9:01 pm

Re: EPT_POINTS help

Post by Harch »

So, too, does not draw :( Or I do not understand something?

Code: Select all

 
class CloudPoints : public scene::ISceneNode
{
    private:
        core::aabbox3d<f32> Box;
        video::S3DVertex Vertices[4];
        video::SMaterial Material;
 
    public:
        CloudPoints(scene::ISceneNode* parent, scene::ISceneManager* mgr, s32 id)
            : scene::ISceneNode(parent, mgr, id)
        {
            Material.Wireframe = true;
            Material.PointCloud = true;
            Material.Lighting = false;
            Material.Thickness = 10000.0f;
 
            Vertices[0] = video::S3DVertex(0,0,10, 1,1,0,
                    video::SColor(255,0,255,255), 0, 1);
            Vertices[1] = video::S3DVertex(10,0,-10, 1,0,0,
                    video::SColor(255,255,0,255), 1, 1);
            Vertices[2] = video::S3DVertex(0,20,0, 0,1,1,
                    video::SColor(255,255,255,0), 1, 0);
            Vertices[3] = video::S3DVertex(-10,0,-10, 0,0,1,
                    video::SColor(255,0,255,0), 0, 0);
 
            Box.reset(Vertices[0].Pos);
            for (s32 i=1; i<4; ++i)
                Box.addInternalPoint(Vertices[i].Pos);
        }
        virtual void OnRegisterSceneNode()
        {
            if (IsVisible)
                SceneManager->registerNodeForRendering(this);
 
            ISceneNode::OnRegisterSceneNode();
        }
        virtual void render()
        {
            u16 indices[] = {   0,1,2,3 };
            video::IVideoDriver* driver = SceneManager->getVideoDriver();
 
            driver->setMaterial(Material);
            driver->setTransform(video::ETS_WORLD, AbsoluteTransformation);
            driver->drawVertexPrimitiveList(&Vertices[0], 4, &indices[0], 4, video::EVT_STANDARD, scene::EPT_POINTS, video::EIT_16BIT);
        }
        virtual const core::aabbox3d<f32>& getBoundingBox() const
        {
            return Box;
        }
 
        virtual u32 getMaterialCount() const
        {
            return 1;
        }
 
        virtual video::SMaterial& getMaterial(u32 i)
        {
            return Material;
        }
};
 
P.S. I know, I just took the code from the third example, and there are so :)
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: EPT_POINTS help

Post by hendu »

You set some impossible material flags. Wireframe and pointcloud are not possible for points, 10 000 pixels is larger than your screen.
Harch
Posts: 75
Joined: Wed Oct 08, 2014 9:01 pm

Re: EPT_POINTS help

Post by Harch »

So, too, does not work :(

Code: Select all

 
            Material.Wireframe = false;
            Material.PointCloud = false;
            Material.Lighting = false;
            //Material.Thickness = 10000.0f;
 
Harch
Posts: 75
Joined: Wed Oct 08, 2014 9:01 pm

Re: EPT_POINTS help

Post by Harch »

I'm very, very sorry! I creating device with software driver! With OPENGL everything works.
Thx!
Post Reply