void PRCExporter::getCurrentMaterial ( osg::Drawable *geode ) { osg::StateAttribute* pRAP; osg::StateSet* theState = geode->getStateSet(); if ( theState ) { pRAP = theState->getAttribute ( osg::StateAttribute::MATERIAL ); if ( pRAP != NULL ) { osg::Material *material = dynamic_cast<osg::Material*> ( pRAP ); if ( material != NULL ) { const osg::Vec4& Diffuse = material->getDiffuse ( osg::Material::FRONT_AND_BACK ); const osg::Vec4& Ambient = material->getAmbient ( osg::Material::FRONT_AND_BACK ); const osg::Vec4& Emissive = material->getEmission ( osg::Material::FRONT_AND_BACK ); const osg::Vec4& Specular = material->getSpecular ( osg::Material::FRONT_AND_BACK ); RGBAColour amb = RGBAColour ( Ambient[0], Ambient[1], Ambient[2], Ambient[3] ); RGBAColour dif = RGBAColour ( Diffuse[0], Diffuse[1], Diffuse[2], Diffuse[3] ); RGBAColour emi = RGBAColour ( Emissive[0], Emissive[1], Emissive[2], Emissive[3] ); RGBAColour spe = RGBAColour ( Specular[0], Specular[1], Specular[2], Specular[3] ); currentMaterial = PRCMaterial ( amb, dif, emi, spe, Diffuse[3], material->getShininess ( osg::Material::FRONT_AND_BACK ) ); } } } }
void LocationEditor::RenderModeLandFlat() { Vector3 mousePos3D = g_app->m_userInput->GetMousePos3d(); Landscape *land = &g_app->m_location->m_landscape; // Highlight any flatten area under our mouse cursor LList<LandscapeFlattenArea *> *areas = &g_app->m_location->m_levelFile->m_landscape.m_flattenAreas; for (int i = 0; i < areas->Size(); ++i) { if (i == m_selectionId) continue; LandscapeFlattenArea *area = areas->GetData(i); float worldX = area->m_centre.x; float worldZ = area->m_centre.z; float sizeX = area->m_size; float sizeY = area->m_centre.y; float sizeZ = area->m_size; float x = area->m_centre.x; float y = area->m_centre.y; float z = area->m_centre.z; float s = area->m_size * 2.0; Vector3 centre(x, y, z); RenderCube(centre, s, y + 20, s, RGBAColour(128,255,128,99)); } if (m_selectionId != -1) { LandscapeDef *landscapeDef = &(g_app->m_location->m_levelFile->m_landscape); LandscapeFlattenArea *areaDef = g_app->m_location->m_levelFile->m_landscape.m_flattenAreas.GetData(m_selectionId); float x = areaDef->m_centre.x; float y = areaDef->m_centre.y; float z = areaDef->m_centre.z; float s = areaDef->m_size * 2.0; Vector3 centre(x, y, z); RenderCube(centre, s, y + 20, s, RGBAColour(128,255,128,255)); } CHECK_OPENGL_STATE(); }
void LocationEditor::RenderModeBuilding() { if (m_selectionId != -1) { Building *building = g_app->m_location->GetBuilding(m_selectionId); if( building->m_shape ) { Matrix34 mat( building->m_front, g_upVector, building->m_pos ); Vector3 centrePos = building->m_shape->CalculateCentre( mat ); float radius = building->m_shape->CalculateRadius( mat, centrePos ); RenderSphere( centrePos, radius, RGBAColour(255,255,255,255) ); } else { building->RenderHitCheck(); } if (m_tool == ToolLink) { Vector3 height(0,10,0); Vector3 mousePos(g_app->m_userInput->GetMousePos3d()); Vector3 arrowDir(mousePos - building->m_pos); Vector3 arrowSize(0,3,0); glEnable ( GL_LINE_SMOOTH ); glDisable ( GL_DEPTH_TEST ); glLineWidth ( 1.0 ); glColor3f ( 1.0, 0.5, 0.5 ); glBegin( GL_LINES ); glVertex3dv( (building->m_pos+height).GetData() ); glVertex3dv( (mousePos).GetData() ); glVertex3dv( (mousePos).GetData() ); glVertex3dv( (mousePos-arrowDir*0.1+arrowSize).GetData() ); glVertex3dv( (mousePos).GetData() ); glVertex3dv( (mousePos-arrowDir*0.1-arrowSize).GetData() ); glEnd(); glDisable ( GL_LINE_SMOOTH ); glEnable ( GL_DEPTH_TEST ); } CHECK_OPENGL_STATE(); } }
void PylonStart::RenderAlphas( float _predictionTime ) { PowerBuilding::RenderAlphas( _predictionTime ); #ifdef DEBUG_RENDER_ENABLED if( g_app->m_editing ) { Building *req = g_app->m_location->GetBuilding( m_reqBuildingId ); if( req ) { RenderArrow( m_pos+Vector3(0,50,0), req->m_pos+Vector3(0,50,0), 2.0f, RGBAColour(255,0,0) ); } } #endif }
void Building::RenderLink() { #ifdef DEBUG_RENDER_ENABLED int buildingId = GetBuildingLink(); if( buildingId != -1 ) { Building *linkBuilding = g_app->m_location->GetBuilding( buildingId ); if( linkBuilding ) { Vector3 start = m_pos; start.y += 10.0f; Vector3 end = linkBuilding->m_pos; end.y += 10.0f; RenderArrow(start, end, 6.0f, RGBAColour(255,0,255)); } } #endif }
BEGIN_UGEN_NAMESPACE #include "ugen_Scope.h" #include "../fft/ugen_FFTEngineInternal.h" #include "../basics/ugen_InlineBinaryOps.h" #include "../basics/ugen_BinaryOpUGens.h" ScopeGUI::ScopeGUI(const ScopeStyles style) : isBipolar(true), hasDisplayed(true), yMaximum(1.f), lowerMargin(0.f), style_(style), scaleX(LabelXNone), scaleY(LabelYNone), labelFirstX(true), markSpacingY(0.1), decimalPlacesY(1), labelHopY(2), markSpacingX(4.0), labelHopX(4), markXHeight(3), markYWidth(3), offsetSamples(0.0), fftSize(-1), bufferWrap(0.0), textSizeX(9.f), textSizeY(9.f), textSizeChannel(11.f), labelChannels(true), channelLabelOffset(0) { colours[Background] = RGBAColour(0.2, 0.2, 0.2); colours[TopLine] = RGBAColour(0.6, 0.6, 0.6); colours[ZeroLine] = RGBAColour(0.4, 0.4, 0.4); colours[LabelMarks] = RGBAColour(0.5, 0.9, 0.5); colours[TextX] = RGBAColour(0.5, 0.9, 0.5); colours[TextY] = RGBAColour(0.5, 0.9, 0.5); colours[TextChannel] = RGBAColour(0.9, 0.6, 0.5, 0.5); colours[Trace] = RGBAColour(1.0, 1.0, 1.0); }
void AIObjective::RenderAlphas( double _predictionTime ) { bool render = (m_active && g_prefsManager->GetInt( "RenderAIInfo", 0 ) != 0 ); if( g_app->m_editing || render ) { #ifdef LOCATION_EDITOR Building::RenderAlphas( _predictionTime ); RGBAColour col( 255, 0, 0 ); if( m_defenseObjective ) col.Set( 0, 0, 255 ); if( !g_app->m_editing && m_active && fabs(sin(g_gameTime)) < 0.5 ) col.Set( 255, 255, 255 ); RenderSphere( m_pos, 50.0, col ); if( g_app->m_editing && g_app->m_locationEditor->m_mode == LocationEditor::ModeBuilding && g_app->m_locationEditor->m_selectionId == m_id.GetUniqueId() ) { RenderSphere( m_pos, 60.0f, RGBAColour( 255, 0, 0 ) ); } #endif } }
void RocketStatusPanel::Render() { // // Determine our rocket status EscapeRocket *rocket = GetMyRocket(); if( !rocket ) return; Team *team = g_app->m_location->m_teams[ m_teamId ]; if( !team ) return; float fuelPercent = rocket->m_fuel / 100.0f; int darwiniansInside = rocket->m_passengers; if( rocket->m_damage > m_lastDamage ) { m_damageTimer = GetHighResTime(); } m_lastDamage = rocket->m_damage; if( fuelPercent > 1.0f ) fuelPercent = 1.0f; double refuelRate = rocket->m_fuel - m_previousFuelLevel; m_previousFuelLevel = rocket->m_fuel; float h = m_w * 1.5f; glShadeModel( GL_SMOOTH ); // // Background team colour glColor4ub( team->m_colour.r*0.2f, team->m_colour.g*0.2f, team->m_colour.b*0.2f, 200 ); glBegin( GL_QUADS ); glVertex2f( m_x, m_y ); glVertex2f( m_x + m_w, m_y ); glVertex2f( m_x + m_w, m_y + h ); glVertex2f( m_x, m_y + h ); glEnd(); // // Refueling effect float fuelBase = m_y + h * 0.97f; float fuelFullH = h * 0.95f; float fuelH = fuelFullH * fuelPercent; int refuelAlpha = 128; glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); glEnable ( GL_TEXTURE_2D ); glBindTexture ( GL_TEXTURE_2D, g_app->m_resource->GetTexture( "textures/laser.bmp" ) ); glTexParameterf ( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR ); glTexParameterf ( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); glTexParameterf ( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT ); glTexParameterf ( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT ); if( fuelPercent < 1.0f ) { glColor4ub( team->m_colour.r, team->m_colour.g, team->m_colour.b, refuelAlpha ); float texY = fuelPercent * -100 + 0.5f; float texH = 1.0f; glBegin( GL_QUADS ); glTexCoord2f(0,texY); glVertex2f( m_x, fuelBase ); glTexCoord2f(1,texY); glVertex2f( m_x + m_w, fuelBase ); glTexCoord2f(1,texY+texH); glVertex2f( m_x + m_w, fuelBase - fuelFullH ); glTexCoord2f(0,texY+texH); glVertex2f( m_x, fuelBase - fuelFullH ); glEnd(); } // // Fuel level glBindTexture ( GL_TEXTURE_2D, g_app->m_resource->GetTexture( "textures/laser-long.bmp" ) ); glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); int fuelAlpha = 200; glBegin( GL_QUADS ); glColor4ub( 0,0,0, fuelAlpha ); glTexCoord2f( 0, 0.3f ); glVertex2f( m_x, fuelBase ); glTexCoord2f( 0, 0.7f ); glVertex2f( m_x + m_w, fuelBase ); glColor4ub( team->m_colour.r, team->m_colour.g, team->m_colour.b, fuelAlpha ); glTexCoord2f( 1, 0.7f ); glVertex2f( m_x + m_w, fuelBase - fuelH ); glTexCoord2f( 1, 0.3f ); glVertex2f( m_x, fuelBase - fuelH ); glEnd(); glDisable( GL_TEXTURE_2D ); // // Shadow above fuel level glBegin( GL_QUADS ); glColor4ub( 0,0,0, fuelAlpha*0.5f ); glVertex2f( m_x, fuelBase - fuelH ); glVertex2f( m_x + m_w, fuelBase - fuelH ); glColor4ub( 0,0,0, 0 ); glVertex2f( m_x + m_w, fuelBase - fuelH - h * 0.05f ); glVertex2f( m_x, fuelBase - fuelH - 10 - h * 0.05f ); glEnd(); // // Rocket bitmap overlay glColor4f( 1.0f, 1.0f, 1.0f, 1.0f ); glBlendFunc ( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); glEnable ( GL_TEXTURE_2D ); glBindTexture ( GL_TEXTURE_2D, g_app->m_resource->GetTexture( "icons/rocketstatuspanel.bmp" ) ); glBegin( GL_QUADS ); glTexCoord2i(0,1); glVertex2f( m_x, m_y ); glTexCoord2i(1,1); glVertex2f( m_x + m_w, m_y ); glTexCoord2i(1,0); glVertex2f( m_x + m_w, m_y + h ); glTexCoord2i(0,0); glVertex2f( m_x, m_y + h ); glEnd(); glDisable ( GL_TEXTURE_2D ); // // Damage effect glColor4f( 1.0f, 1.0f, 1.0f, rocket->m_damage/100.0f ); glBlendFunc ( GL_SRC_ALPHA, GL_ONE ); glEnable ( GL_TEXTURE_2D ); glBindTexture ( GL_TEXTURE_2D, g_app->m_resource->GetTexture( "icons/rocketcracked.bmp" ) ); glBegin( GL_QUADS ); glTexCoord2i(0,1); glVertex2f( m_x, m_y ); glTexCoord2i(1,1); glVertex2f( m_x + m_w, m_y ); glTexCoord2i(1,0); glVertex2f( m_x + m_w, m_y + h ); glTexCoord2i(0,0); glVertex2f( m_x, m_y + h ); glEnd(); glDisable ( GL_TEXTURE_2D ); // // Darwinians inside glBlendFunc ( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); if( fuelPercent >= 1.0f || darwiniansInside > 0 ) { float dwX = m_x + m_w * 0.25f; float dwW = m_w * 0.45f; float dwY = m_y + h * 0.225f; float dwH = h * 0.55f; float s = h * 0.04f; int astronautAlpha = 255; glEnable ( GL_TEXTURE_2D ); glBindTexture ( GL_TEXTURE_2D, g_app->m_resource->GetTexture( "sprites/darwinian.bmp" ) ); for( int i = 99; i >= 0; i-- ) { int xIndex = ( i % 10 ); int yIndex = 9 - int( i / 10 ); float xPos = dwX + dwW * xIndex/10; float yPos = dwY + dwH * yIndex/10; if( yIndex % 2 == 0 ) xPos += dwW/20.0f; RGBAColour astronautCol = team->m_colour; astronautCol.AddWithClamp( RGBAColour(50,50,50,255) ); astronautCol.a = astronautAlpha; if( i < darwiniansInside ) glColor4ub( team->m_colour.r, team->m_colour.g, team->m_colour.b, astronautAlpha ); else glColor4ub( team->m_colour.r*0.3f, team->m_colour.g*0.3f, team->m_colour.b*0.3f, astronautAlpha*0.2f ); Vector3 pos( xPos+s/2.0f, yPos+s/2.0f, 0 ); pos.x += sinf(i + GetHighResTime()) * 1.0f; pos.y += cosf(i + i + GetHighResTime()) * 1.0f; Vector3 offset( -s/2.0f, -s, 0 ); glBegin( GL_QUADS ); glTexCoord2f(0,1); glVertex2dv( (pos+offset).GetData() ); offset.RotateAroundZ(0.5f * M_PI); glTexCoord2f(1,1); glVertex2dv( (pos+offset).GetData() ); offset.RotateAroundZ(0.5f * M_PI); glTexCoord2f(1,0); glVertex2dv( (pos+offset).GetData() ); offset.RotateAroundZ(0.5f * M_PI); glTexCoord2f(0,0); glVertex2dv( (pos+offset).GetData() ); offset.RotateAroundZ(0.5f * M_PI); glEnd(); } glDisable( GL_TEXTURE_2D ); } // // Engine effect if( rocket->m_state == EscapeRocket::StateReady || rocket->m_state == EscapeRocket::StateCountdown || rocket->m_state == EscapeRocket::StateFlight) { float flameX = m_x + m_w * 0.35f; float flameY = m_y + h * 0.8f; float flameW = m_w * 0.3f; float flameH = m_w * 0.3f; glBlendFunc ( GL_SRC_ALPHA, GL_ONE ); glEnable( GL_TEXTURE_2D ); glBindTexture( GL_TEXTURE_2D, g_app->m_resource->GetTexture("textures/muzzleflash.bmp" ) ); if( fmodf( GetHighResTime()*30, 1.0f ) < 0.5f ) glColor4f( 1.0f, 1.0f, 1.0f, 1.0f ); else glColor4f( 1.0f, 1.0f, 1.0f, 0.2f ); glBegin( GL_QUADS ); glTexCoord2i(0,0); glVertex2f( flameX, flameY ); glTexCoord2i(0,1); glVertex2f( flameX+flameW, flameY ); glTexCoord2i(1,1); glVertex2f( flameX+flameW, flameY+flameH ); glTexCoord2i(1,0); glVertex2f( flameX, flameY+flameH ); glEnd(); glDisable( GL_TEXTURE_2D ); } // // Captions at the bottom // Determine our caption float mainCaptionY = m_y + h * 0.6f; float mainCaptionH = h * 0.05f; float mainCaptionG = mainCaptionH * 0.1f; bool timeFlashEffect = (fmodf( GetHighResTime() * 2, 1.0f ) > 0.55f); UnicodeString caption; RGBAColour captionColour(255,255,255,255); if( GetHighResTime() - m_damageTimer < 10.0f && rocket->m_state != EscapeRocket::StateExploding ) { char damage[256]; sprintf( damage, "%d%%", int(rocket->m_damage) ); caption = LANGUAGEPHRASE("multiwinia_rr_status_c"); caption.ReplaceStringFlag( L'T', damage ); captionColour.Set(255,0,0,255); if( timeFlashEffect ) captionColour.a *= 0.5f; } else if( rocket->m_state == EscapeRocket::StateCountdown ) { char captionC[256]; sprintf( captionC, "%d", (int)rocket->m_countdown + 1 ); caption = captionC; mainCaptionH *= 4; } else if( rocket->m_state == EscapeRocket::StateFlight ) { caption = LANGUAGEPHRASE("multiwinia_rr_status_d" ); mainCaptionH *= 1.5f; if( timeFlashEffect ) captionColour.a *= 0.25f; } else if( rocket->m_state == EscapeRocket::StateExploding ) { caption = LANGUAGEPHRASE("multiwinia_rr_status_e" ); if( timeFlashEffect ) captionColour.a *= 0.25f; } else if( fuelPercent >= 1.0f && darwiniansInside < 5 ) { caption = LANGUAGEPHRASE("multiwinia_rr_status_b"); if( timeFlashEffect ) captionColour.a *= 0.25f; } else if( rocket->m_refuelRate < 0.05f && fuelPercent < 0.01f ) { caption = LANGUAGEPHRASE("multiwinia_rr_status_a"); if( timeFlashEffect ) captionColour.a *= 0.25f; } else if( fuelPercent < 1.0f ) { char captionC[256]; sprintf( captionC, "%2.1f%%", fuelPercent * 100 ); caption = LANGUAGEPHRASE("multiwinia_rr_status_f"); caption.ReplaceStringFlag( L'T', captionC ); captionColour.a *= 0.75f; } // // Render our caption if( caption.Length() ) { LList<UnicodeString *> *wrapped = WordWrapText( caption, 1000, mainCaptionH, false, false ); for( int i = 0; i < wrapped->Size(); ++i ) { UnicodeString *thisString = wrapped->GetData(i); glColor4ub( captionColour.a, captionColour.a, captionColour.a, 0 ); g_titleFont.SetRenderOutline(true); g_titleFont.DrawText2DCentre( m_x + m_w/2, mainCaptionY, mainCaptionH, *thisString ); glColor4ubv( captionColour.GetData() ); g_titleFont.SetRenderOutline(false); g_titleFont.DrawText2DCentre( m_x + m_w/2, mainCaptionY, mainCaptionH, *thisString ); mainCaptionY += mainCaptionH; mainCaptionY += mainCaptionG; } wrapped->EmptyAndDelete(); delete wrapped; } // // White border glColor4f( 1.0f, 1.0f, 1.0f, 0.2f ); glBegin( GL_LINE_LOOP ); glVertex2f( m_x, m_y ); glVertex2f( m_x + m_w, m_y ); glVertex2f( m_x + m_w, m_y + h ); glVertex2f( m_x, m_y + h ); glEnd(); glShadeModel( GL_FLAT ); }
void LocationEditor::RenderModeLandTile() { Vector3 mousePos3D = g_app->m_userInput->GetMousePos3d(); Landscape *land = &g_app->m_location->m_landscape; // Highlight any tile under our mouse cursor LList<LandscapeTile *> *tiles = &g_app->m_location->m_levelFile->m_landscape.m_tiles; for (int i = 0; i < tiles->Size(); ++i) { if (i == m_selectionId) continue; LandscapeTile *tile = tiles->GetData(i); float worldX = tile->m_posX - tile->m_heightMap->m_cellSizeX; float worldZ = tile->m_posZ - tile->m_heightMap->m_cellSizeY; float sizeX = tile->m_size; float sizeY = tile->m_desiredHeight - tile->m_outsideHeight; float sizeZ = tile->m_size; if (mousePos3D.x > worldX && mousePos3D.x < worldX + sizeX && mousePos3D.z > worldZ && mousePos3D.z < worldZ + sizeZ) { Vector3 centre(worldX, tile->m_outsideHeight, worldZ); centre.x += sizeX * 0.5; centre.y += sizeY * 0.5; centre.z += sizeZ * 0.5; RenderCube(centre, sizeX, sizeY, sizeZ, RGBAColour(128,255,128,99)); } } // Render guide grids if( EclGetWindow("editor_guidegrid") ) { glEnable( GL_LINE_SMOOTH ); glEnable( GL_BLEND ); if (m_selectionId != -1) { LandscapeTile *tile = tiles->GetData(m_selectionId); if( tile->m_guideGrid && tile->m_guideGrid->GetNumColumns() > 0 ) { float gridCellSize = tile->m_size / (float) (tile->m_guideGrid->GetNumColumns()+1); for( int x = 0; x < tile->m_guideGrid->GetNumColumns()-1; ++x ) { for( int z = 0; z < tile->m_guideGrid->GetNumColumns()-1; ++z ) { float value1 = tile->m_desiredHeight * (tile->m_guideGrid->GetData( x, z ) / 256.0); float value2 = tile->m_desiredHeight * (tile->m_guideGrid->GetData( x+1, z ) / 256.0 ); float value3 = tile->m_desiredHeight * (tile->m_guideGrid->GetData( x+1, z+1 ) / 256.0 ); float value4 = tile->m_desiredHeight * (tile->m_guideGrid->GetData( x, z+1 ) / 256.0 ); float tileX = tile->m_posX + (x+1) * gridCellSize; float tileZ = tile->m_posZ + (z+1) * gridCellSize; float tileW = gridCellSize; float tileH = gridCellSize; glDisable( GL_DEPTH_TEST ); glLineWidth( 1.0 ); glColor4f( 1.0, 0.0, 0.0, 0.2 ); glBegin( GL_LINE_LOOP ); glVertex3f( tileX, tile->m_posY + value1, tileZ ); glVertex3f( tileX + tileW, tile->m_posY + value2, tileZ ); glVertex3f( tileX + tileW, tile->m_posY + value3, tileZ + tileH ); glVertex3f( tileX, tile->m_posY + value4, tileZ + tileH ); glEnd(); glEnable( GL_DEPTH_TEST ); glColor4f( 1.0, 0.0, 0.0, 0.8 ); glLineWidth( 3.0 ); glBegin( GL_LINE_LOOP ); glVertex3f( tileX, tile->m_posY + value1, tileZ ); glVertex3f( tileX + tileW, tile->m_posY + value2, tileZ ); glVertex3f( tileX + tileW, tile->m_posY + value3, tileZ + tileH ); glVertex3f( tileX, tile->m_posY + value4, tileZ + tileH ); glEnd(); } } } } glDisable( GL_BLEND ); glEnable( GL_DEPTH_TEST ); } // Render a green box around the currently selected tile (if any) if (m_selectionId != -1) { LandscapeTile *tile = tiles->GetData(m_selectionId); float x = tile->m_posX - tile->m_heightMap->m_cellSizeX; float y = tile->m_outsideHeight; float z = tile->m_posZ - tile->m_heightMap->m_cellSizeY; float sX = tile->m_size; float sY = tile->m_desiredHeight - tile->m_outsideHeight; float sZ = tile->m_size; Vector3 centre(x, y, z); centre.x += sX * 0.5; centre.y += sY * 0.5; centre.z += sZ * 0.5; RenderCube(centre, sX, sY, sZ, RGBAColour(128,255,128)); if( m_newLandscapeX != tile->m_posX || m_newLandscapeZ != tile->m_posZ ) { x = m_newLandscapeX; y = 1.0; z = m_newLandscapeZ; glColor3ub( 0, 0, 255 ); glBegin( GL_LINE_LOOP ); glVertex3f( x, y, z ); glVertex3f( x + sX, y, z ); glVertex3f( x + sX, y, z + sZ ); glVertex3f( x, y, z + sZ ); glEnd(); } } CHECK_OPENGL_STATE(); }
static RGBAColour White() { return RGBAColour(255, 255, 255, 255); }
static RGBAColour Black() { return RGBAColour(0, 0, 0, 255); }
// Colour constants static RGBAColour Clear() { return RGBAColour(0, 0, 0, 0); }
void AIObjectiveMarker::RenderAlphas( double _predictionTime ) { bool objectiveActive = m_objectiveId == -1 || ((AIObjective *)g_app->m_location->GetBuilding( m_objectiveId ))->m_active; bool render = (!g_app->m_editing && g_prefsManager->GetInt( "RenderAIInfo", 0 ) != 0 && objectiveActive ); if( g_app->m_editing || render) { #ifdef LOCATION_EDITOR Building::RenderAlphas( _predictionTime ); RGBAColour col; if( g_app->m_editing ) { col.Set( 255, 0, 0 ); } else if( m_id.GetTeamId() == 255 ) { col.Set( 150, 150, 150 ); } else { if( m_objectiveBuildingId != -1 && fabs(sin(g_gameTime)) < 0.5) { col = RGBAColour(255, 255, 255, 255); } else { col = g_app->m_location->m_teams[ m_id.GetTeamId() ]->m_colour; } } RenderSphere( m_pos, 25.0, col ); Building *b = g_app->m_location->GetBuilding( m_objectiveBuildingId ); if( b ) { RenderArrow( m_pos, b->m_pos, 5.0, col ); } if( g_app->m_editing && g_app->m_locationEditor->m_mode == LocationEditor::ModeBuilding && g_app->m_locationEditor->m_selectionId == m_id.GetUniqueId() ) { RenderSphere( m_pos, 30.0, RGBAColour( 255, 0, 0 ) ); Vector3 triggerPos = m_pos; int numSteps = 20; glBegin( GL_LINE_LOOP ); glLineWidth( 1.0 ); glColor4f( 1.0f, 0.0f, 0.0f, 1.0f ); for( int i = 0; i < numSteps; ++i ) { float angle = 2.0f * M_PI * (float)i / (float) numSteps; Vector3 thisPos = triggerPos + Vector3( sinf(angle)*m_scanRange, 0.0f, cosf(angle)*m_scanRange ); thisPos.y = g_app->m_location->m_landscape.m_heightMap->GetValue( thisPos.x, thisPos.z ); thisPos.y += 10.0f; glVertex3dv( thisPos.GetData() ); } glEnd(); } #endif } }