Problem with using addSphereSceneNode() only 1 is showing

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
pwnstar23
Posts: 4
Joined: Tue Oct 02, 2012 5:27 pm

Problem with using addSphereSceneNode() only 1 is showing

Post by pwnstar23 »

Hello I have a program that makes a number of Stars

Code: Select all

 
 
#pragma once
 
#include "vector3d.h"
#include "Visual.h"
 
typedef unsigned long long Mass;
 
 
typedef irr::core::vector3d<irr::f32> Vector3f;
typedef irr::core::vector3d<irr::f64> Vector3d;
 
class Star
{
public:
    Star(const Vector3d &pos, const Vector3d &vel, const Mass &mass, Visual *pVisual);
    ~Star();
     
protected:
    void PushValuesToVisual();
 
    irr::scene::IMeshSceneNode *mpNode;
 
    Visual *mpVisual;
};
 
Star::Star( const Vector3d &pos, const Vector3d &vel, const Mass &mass, Visual *pVisual)
    :
    mPosition( pos ),
    mVelocity( vel ),
    mAcceleration( Vector3d(0,0,0) ),
    mMass(mass),
    mpVisual( pVisual ),
    mpNode( nullptr )
    {
    mpNode = mpVisual->mpSceneMan->addSphereSceneNode(100.0f, 16);
    mpNode->setMaterialFlag(irr::video::EMF_LIGHTING, false );
 
    mpNode->setMaterialType(irr::video::EMT_SOLID);
    int matCount = mpNode->getMaterialCount();
 
    irr::video::SColor white(255, 255, 255, 255);
    for (int i = 0; i < matCount; ++i )
        {
        irr::video::SMaterial& mat = mpNode->getMaterial(i);
        mat.AmbientColor = white;
        mat.SpecularColor = white;
        mat.DiffuseColor = white;
        }
 
    mpNode->setPosition( Vector3f( mPosition.X, mPosition.Y, mPosition.Z ) );
    }
 
Star::~Star()
    {
    mpNode->remove();
    }
 
 
Currently I am making 100 of these on the heap and putting them in a std::list. The problem however is that only 1 sphere is being drawn. Why is that and what can I do to fix it?
d3jake
Posts: 198
Joined: Sat Mar 22, 2008 7:49 pm
Location: United States of America

Re: Problem with using addSphereSceneNode() only 1 is showin

Post by d3jake »

I don't see any problem with this code. Can you show us which function(s) create the stars?
The Open Descent Foundation is always looking for programmers! http://www.odf-online.org
"I'll find out if what I deleted was vital here shortly..." -d3jake
Post Reply