void Font::renderText( const std::string& text, const mat4f& transformation, float fontHeight, const Color4f& color, const vec2f& relPos, bool drawWithShadow, bool fixedWidth ) { Mesh* sMesh = nullptr; if( drawWithShadow ) { sMesh = generateVertices( text, vec3f( -1.0f, -1.0f, -0.001f ), fontHeight, vec3f( 1.0f, 0.0f, 0.0f ), vec3f( 0.0f, 1.0f, 0.0f ), color::FADEDBLACK, relPos, fixedWidth ); } Mesh* mesh = generateVertices( text, vec3f(), fontHeight, vec3f( 1.0f, 0.0f, 0.0f ), vec3f( 0.0f, 1.0f, 0.0f ), color, relPos, fixedWidth ); Material* material = Material::getMaterial( mesh->getMaterial( 0 ) ); material->updateUniform( "uFontHeight", fontHeight ); //matStackf modelStack; //modelStack.translate( pos ); NamedProperties params; params.set( "modelMatrix", transformation ); params.set( "sMesh", sMesh ); if( sMesh ) fireEvent( "renderMesh", params ); params.set( "mesh", mesh ); fireEvent( "renderMesh", params ); SAFE_DELETE( sMesh ); SAFE_DELETE( mesh ); }
//------------------------------------------------------------------- void Object::setRotation( const mat3f& rot, int frame ) { Node::setRotation( rot, frame ); NamedProperties params; params.set( "orientation", rot ); params.set( "name", m_occlusionGeometryName ); fireEvent( "setOrientationOfASGeometry", params ); }
//------------------------------------------------------------------- void Object::setScale( const vec3f& scale, int frame ) { Node::setScale( scale, frame ); NamedProperties params; params.set( "scale", scale ); params.set( "name", m_occlusionGeometryName ); fireEvent( "setScaleOfASGeometry", params ); }
//------------------------------------------------------------------- void Object::setPosition( const vec3f& pos, int frame ) { Node::setPosition( pos, frame ); NamedProperties params; params.set( "pos", pos ); params.set( "name", m_occlusionGeometryName ); fireEvent( "setPosOfASGeometry", params ); }
//------------------------------------------------------------------- void Object::render() { matStackf modelStack; modelStack.applyMatrix( getWorldTransformation() ); NamedProperties params; params.set( "modelMatrix", modelStack.top() ); params.set( "mesh", m_mesh ); fireEvent( "renderMesh", params ); }
void Button::Render() { NamedProperties params; matStackf modelStack; modelStack.loadIdentity(); modelStack.translate( m_boundingBox.getCenter() ); params.set( "modelMatrix", modelStack.top() ); params.set( "mesh", m_mesh ); fireEvent( "renderMesh", params ); //consolePrintf( "Button box: %s", m_boundingBox.toString().c_str() ); }
//---------------------------------------------------------------------- void Spaceship::fireBullet() { if( m_weaponTimer->isTimeUp() ) { NamedProperties params; params.set( "pos", getPosition() ); params.set( "rotation", m_rotation ); params.set( "teamNumber", m_teamNumber ); fireEvent( "SpawnBullet", params ); m_weaponTimer->start(); } }
void Font::render3DText( const std::string& text, const vec3f& pos, float fontHeight, vec3f rasterDir, vec3f up, const Color4f& color, const vec2f& relPos, bool fixedWidth ) { Mesh* mesh = generateVertices( text, pos, fontHeight, rasterDir, up, color, relPos, fixedWidth ); matStackf modelStack; modelStack.translate( pos ); NamedProperties params; params.set( "modelMatrix", modelStack.top() ); params.set( "mesh", mesh ); fireEvent( "renderMesh", params ); SAFE_DELETE( mesh ); }
void MSMap::Render() { NamedProperties params; matStackf matStack; params.set( "mesh", m_platformMesh ); for( int i = 0; i < m_platformRenderLocations.size(); ++i ) { matStack.loadIdentity(); m_platformRenderLocations[i].y = m_mapYPos; matStack.translate( m_platformRenderLocations[i] ); params.set( "modelMatrix", matStack.top() ); fireEvent( "renderMesh", params ); } }
Object::Object( const std::string& id, Mesh* mesh ) : Node( id ) , m_mesh( mesh ) { if( mesh != nullptr ) { Material* mat = Material::getMaterial( m_mesh->getMaterial() ); m_occlusionGeometryName = id + "asGeom"; NamedProperties params; params.set( "name", m_occlusionGeometryName ); params.set( "mesh", m_mesh ); params.set( "directOcclusion", mat->getDirectOcclusion() ); params.set( "reverbOcclusion", mat->getReverbOcclusion() ); fireEvent( "createASGeometry", params ); } }
void MSMap::RenderLayer( int layer ) { NamedProperties params; matStackf matStack; matStack.loadIdentity(); if( 0 <= layer && layer < m_currentObstaclesOnMap.size() ) { for( int i = 0; i < m_currentObstaclesOnMap[layer].size(); ++i ) { matStack.loadIdentity(); matStack.translate( m_currentObstaclesOnMap[layer][i]->boundingBox.getCenter() ); params.set( "modelMatrix", matStack.top() ); params.set( "mesh", m_currentObstaclesOnMap[layer][i]->mesh ); fireEvent( "renderMesh", params ); } } }
//---------------------------------------------------------------- void Entity::renderOrders() { vec2f currentPos = m_position; for( size_t i = 0; i < m_orders.size(); ++i ) { Mesh* line = MeshFactory::generateLine( currentPos, m_orders[i]->getTargetLocation() ); NamedProperties params; params.set( "mesh", line ); fireEvent( "renderMesh", params ); currentPos = m_orders[i]->getTargetLocation(); SAFE_DELETE( line ); } }
SpaceGameActor::SpaceGameActor( const std::string& id, short teamNumber, int screenWidth, int screenHeight ) : Actor( id ) , SCREEN_WIDTH( screenWidth ) , SCREEN_HEIGHT( screenHeight ) , m_radius( 0.0f ) , IMPULSE_POWER( 100.0f ) , ROTATION_POWER( 5.0f ) , m_forwardImpulse( 0.0f ) , m_rotation( 0.0f ) , m_teamNumber( teamNumber ) , m_wasSpawnedLastFrame( true ) { NamedProperties params; params.set( "SGA", this ); fireEvent( "addSGAToCollisionMgr", params ); }
//---------------------------------------------------------------------- Spaceship::~Spaceship() { NamedProperties params; params.set( "spaceship", this ); fireEvent( "SpaceshipDied", params ); }
//---------------------------------------------------------------------- SpaceGameActor::~SpaceGameActor() { NamedProperties params; params.set( "SGA", this ); fireEvent( "removeSGAFromCollisionMgr", params ); }