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();
}