int plRTOmniLight::DrawConeAndLine( TimeValue t, INode* inode, GraphicsWindow *gw, int drawing ) { float atOneHalfDist; Matrix3 tm = inode->GetObjectTM( t ); gw->setTransform( tm ); gw->clearHitCode(); if( ( extDispFlags & EXT_DISP_ONLY_SELECTED ) ) { if( GetUseAtten() ) { // Draw hotspot as the point at which light is 1/2 intensity (just to help the visual) gw->setColor( LINE_COLOR, GetUIColor( COLOR_HOTSPOT ) ); if( fLightPB->GetInt( kAttenTypeRadio, t ) == 0 ) atOneHalfDist = GetAtten( t, ATTEN_END ) / ( fLightPB->GetFloat( kIntensity, t ) * plSillyLightKonstants::GetFarPowerKonst() - 1.f ); else atOneHalfDist = sqrt( GetAtten( t, ATTEN_END ) * GetAtten( t, ATTEN_END ) / ( fLightPB->GetFloat( kIntensity, t ) * plSillyLightKonstants::GetFarPowerKonst() - 1.f ) ); if( atOneHalfDist > 0.0f ) DrawCone( t, gw, atOneHalfDist ); gw->setColor( LINE_COLOR, GetUIColor( COLOR_FALLOFF ) ); DrawCone( t, gw, GetAtten( t, ATTEN_END ) ); } else DrawArrows( t, gw, 50 ); } return gw->checkHitCode(); }
void OVariousObjects::DrawAxes(GLfloat size,GLfloat linewidth) { //Axe de coordonate glEnableClientState(GL_VERTEX_ARRAY); //glEnableClientState(GL_NORMAL_ARRAY); glLineWidth(linewidth); GLfloat vx[]={ -size, 0.0f, 0.0f, size, 0.0f, 0.0f }; GLfloat vy[]={ 0.0f, -size, 0.0f, 0.0f, size, 0.0f }; GLfloat vz[]={ 0.0f, 0.0f, -size, 0.0f, 0.0f, size }; //x line glColor4f(1.0f,0.0f,0.0f,1.0f); glVertexPointer(3, GL_FLOAT, 0, vx); glDrawArrays(GL_LINE_STRIP, 0, 2); glPushMatrix(); glTranslatef(size,0.0f,0.0f); glRotatef(90.0f,0.0f,1.0f,0.0f); DrawCone(size/10.0f,size/50.0f,50); glPopMatrix(); //y line glColor4f(0.0f,1.0f,0.0f,1.0f); glVertexPointer(3, GL_FLOAT, 0, vy); glDrawArrays(GL_LINE_STRIP, 0, 2); glPushMatrix(); glTranslatef(0.0f,size,0.0f); glRotatef(-90.0f,1.0f,0.0f,0.0f); DrawCone(size/10.0f,size/50.0f,50); glPopMatrix(); //z line glColor4f(0.0f,0.0f,1.0f,1.0f); glVertexPointer(3, GL_FLOAT, 0, vz); glDrawArrays(GL_LINE_STRIP, 0, 2); glPushMatrix(); glTranslatef(0.0f,0.0f,size); DrawCone(size/10.0f,size/50.0f,50); glPopMatrix(); glColor4f(1.0f,1.0f,1.0f,1.0f); glLineWidth(1.0f); glDisableClientState(GL_VERTEX_ARRAY); //glDisableClientState(GL_NORMAL_ARRAY); }
/* ============ idAASLocal::ShowNearestCoverArea ============ */ void idAASLocal::ShowNearestCoverArea( const idVec3 &origin, int targetAreaNum ) const { int areaNum = PointReachableAreaNum( origin, DefaultSearchBounds(), AAS_AREA_REACHABLE_WALK, TravelFlagInvalidForTeam() ); idVec3 target = AreaCenter( targetAreaNum ); DrawCone( target, idVec3(0,0,1), 16.0f, colorYellow ); idAASCallback_FindCoverArea findCover( target ); idAASGoal goal; if ( FindNearestGoal( goal, areaNum, origin, TravelFlagInvalidForTeam(), findCover ) ) { DrawArea( goal.areaNum ); ShowWalkPath( areaNum, origin, goal.areaNum, goal.origin, TravelFlagForTeam(), TravelFlagWalkForTeam() ); DrawCone( goal.origin, idVec3( 0, 0, 1 ), 16.0f, colorWhite ); } }
void DrawBaeumchen() { // Boden modelViewMatrix.PushMatrix(); modelViewMatrix.PushMatrix(); modelViewMatrix.Translate(0, -25, 0); modelViewMatrix.Scale(20, -0.01, 20); shaderManager.UseStockShader(GLT_SHADER_FLAT_ATTRIBUTES, transformPipeline.GetModelViewProjectionMatrix()); modelViewMatrix.PopMatrix(); DrawCube(); // Baumstamm modelViewMatrix.PushMatrix(); modelViewMatrix.Translate(0, 0.0, 0); modelViewMatrix.PushMatrix(); modelViewMatrix.Scale(0.3, 0.5, 0.3); shaderManager.UseStockShader(GLT_SHADER_FLAT_ATTRIBUTES, transformPipeline.GetModelViewProjectionMatrix()); modelViewMatrix.PopMatrix(); DrawCylinder(); //unterster Kegel modelViewMatrix.PushMatrix(); modelViewMatrix.Translate(0, 25.0, 0); modelViewMatrix.Scale(1.5, 1.5, 1.5); shaderManager.UseStockShader(GLT_SHADER_FLAT_ATTRIBUTES, transformPipeline.GetModelViewProjectionMatrix()); DrawCone(); // mittlerer Kegel modelViewMatrix.PushMatrix(); modelViewMatrix.Translate(0, 40.0, 0); modelViewMatrix.Scale(0.75, 0.75, 0.75); shaderManager.UseStockShader(GLT_SHADER_FLAT_ATTRIBUTES, transformPipeline.GetModelViewProjectionMatrix()); DrawCone(); // Spitze modelViewMatrix.PushMatrix(); modelViewMatrix.Translate(0, 50.0, 0); modelViewMatrix.Scale(0.75, 0.75, 0.75); shaderManager.UseStockShader(GLT_SHADER_FLAT_ATTRIBUTES, transformPipeline.GetModelViewProjectionMatrix()); DrawCone(); modelViewMatrix.PopMatrix(); modelViewMatrix.PopMatrix(); modelViewMatrix.PopMatrix(); modelViewMatrix.PopMatrix(); modelViewMatrix.PopMatrix(); }
/* ============ idAASLocal::ShowHideArea ============ */ void idAASLocal::ShowHideArea( const idVec3 &origin, int targetAreaNum ) const { int areaNum, numObstacles; idVec3 target; aasGoal_t goal; aasObstacle_t obstacles[10]; areaNum = PointReachableAreaNum( origin, DefaultSearchBounds(), ( AREA_REACHABLE_WALK | AREA_REACHABLE_FLY ) ); target = AreaCenter( targetAreaNum ); // consider the target an obstacle obstacles[0].absBounds = idBounds( target ).Expand( 16 ); numObstacles = 1; DrawCone( target, idVec3( 0, 0, 1 ), 16.0f, colorYellow ); idAASFindCover findCover( target ); if( FindNearestGoal( goal, areaNum, origin, target, TFL_WALK | TFL_AIR, obstacles, numObstacles, findCover ) ) { DrawArea( goal.areaNum ); ShowWalkPath( origin, goal.areaNum, goal.origin ); DrawCone( goal.origin, idVec3( 0, 0, 1 ), 16.0f, colorWhite ); } }
void DebugDrawer::DrawAxes(const Vector3f& position, float size) { Color oldPrimaryColor = s_primaryColor; s_primaryColor = Color::Red; DrawLine(position, position + Vector3f::UnitX() * 3.f * size / 4.f); s_primaryColor = Color::Green; DrawLine(position, position + Vector3f::UnitY() * 3.f * size / 4.f); s_primaryColor = Color::Blue; DrawLine(position, position + Vector3f::UnitZ() * 3.f * size / 4.f); s_primaryColor = Color::Red; DrawCone(position + Vector3f::UnitX() * size, EulerAnglesf(0.f, 90.f, 0.f), 15, size / 4.f); s_primaryColor = Color::Green; DrawCone(position + Vector3f::UnitY() * size, EulerAnglesf(-90.f, 0.f, 0.f), 15, size / 4.f); s_primaryColor = Color::Blue; DrawCone(position + Vector3f::UnitZ() * size, EulerAnglesf(0.f, 0.f, 0.f), 15, size / 4.f); s_primaryColor = oldPrimaryColor; }
int plRTProjDirLight::DrawConeAndLine( TimeValue t, INode* inode, GraphicsWindow *gw, int drawing ) { Matrix3 tm = inode->GetObjectTM( t ); gw->setTransform( tm ); gw->clearHitCode(); if( extDispFlags & EXT_DISP_ONLY_SELECTED ) DrawCone( t, gw, 500 ); return gw->checkHitCode(); }
/* ============ idAASLocal::ShowNearestInsideArea ============ */ void idAASLocal::ShowNearestInsideArea( const idVec3 &origin ) const { int areaNum = PointReachableAreaNum( origin, DefaultSearchBounds(), AAS_AREA_REACHABLE_WALK, TravelFlagInvalidForTeam() ); idAASCallback_FindFlaggedArea findInside( AAS_AREA_OUTSIDE, false ); idAASGoal goal; if ( FindNearestGoal( goal, areaNum, origin, TravelFlagForTeam(), findInside ) ) { DrawArea( goal.areaNum ); ShowWalkPath( areaNum, origin, goal.areaNum, goal.origin, TravelFlagForTeam(), TravelFlagWalkForTeam() ); DrawCone( goal.origin, idVec3( 0, 0, 1 ), 16.0f, colorWhite ); } }
void DrawArrow(float size) { DrawCone(size * 0.05f, size * 0.15f, size); //glEnable(GL_BLEND); //glEnable(GL_LINE_SMOOTH); glLineWidth(1.5f); glBegin(GL_LINES); glVertex3f(0, 0, 0); glVertex3f(0, size, 0); glEnd(); glLineWidth(1.0f); //glDisable(GL_LINE_SMOOTH); //glDisable(GL_BLEND); }
void dSceneRender::DrawArrow (int segments, dFloat radius, dFloat heigh, const dVector& stemColor, const dVector& tipColor) { dMatrix matrix (dGetIdentityMatrix()); matrix.m_posit.m_x = heigh / 2.0f; PushMatrix(matrix); SetColor(stemColor); DrawCylinder(segments, radius, heigh); dFloat tipLength = heigh / 3.0f; matrix.m_posit.m_x = (heigh + tipLength) / 2.0f; PushMatrix(matrix); SetColor(tipColor); DrawCone(segments, radius * 2.0f, tipLength); PopMatrix(); PopMatrix(); }
void OVariousObjects::DrawVector(GLfloat ox, GLfloat oy, GLfloat oz, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat length) { GLfloat v[] = { ox, oy, oz, ox + nx*length, oy + ny*length, oz + nz*length }; GLfloat azimut = rad2deg(atan2(nx, nz)); GLfloat elevation = -rad2deg(asin(ny)); glVertexPointer(3, GL_FLOAT, 0, v); glDrawArrays(GL_LINE_STRIP, 0, 2); glPushMatrix(); glTranslatef(ox + nx*length, oy + ny*length, oz + nz*length); glRotatef(azimut, 0.0f, 1.0f, 0.0f); glRotatef(elevation, 1.0f, 0.0f, 0.0f); DrawCone(length/4.0f, length/20.0f, 5); glPopMatrix(); }
void LsysBranchRule::Draw(int nLevels, double arrLfProbabilities[][TOT_PARAMS_PER_BRANCH]) { // draw the main branch glColor3d(0.75, 0.5, 0.25); glEnable(GL_NORMALIZE); glPushMatrix(); glScaled(m_lfScale, m_lfScale, m_lfScale); DrawCone(); for(int i = 0; i < MAX_BRANCHES_PER_RULE; ++i) { InternalRecursiveDraw(nLevels-1, i, i+1, arrLfProbabilities); } glPopMatrix(); }
void LsysBranchRule::InternalRecursiveDraw(int nLevelsLeft, int nChildIdx, int nArrPos, ParamVector * arrParams) { if(arrParams[nArrPos][0] > m_BranchDescr[nChildIdx].m_lfProbability) { return; } glPushMatrix(); // draw the main branch //if(nLevelsLeft < 1) //{ // glColor3d(0.1, 0.7, 0.1); //} DoTransform(nChildIdx, nArrPos, arrParams); DrawCone(); if(nLevelsLeft < 1) { // glColor3d(0.75, 0.5, 0.25); glPopMatrix(); return; } int nPosNext = nArrPos*MAX_BRANCHES_PER_RULE; for(int i = 0; i < MAX_BRANCHES_PER_RULE; ++i) { // do this if the branch is not broken InternalRecursiveDraw(nLevelsLeft-1, i, nPosNext, arrParams); ++nPosNext; } glPopMatrix(); }