Example #1
0
void DrawCapsule(NxShape* capsule, const NxVec3& color)
{
	NxMat34 pose = capsule->getGlobalPose();

	const NxReal & r = capsule->isCapsule()->getRadius();
	const NxReal & h = capsule->isCapsule()->getHeight();

	glPushMatrix();
	SetupGLMatrix(pose.t, pose.M);

	glPushMatrix();
	glTranslatef(0.0f, h*0.5f, 0.0f);
	glScalef(r,r,r);
	RenderSphere();
	glPopMatrix();

	glPushMatrix();
	glTranslatef(0.0f,-h*0.5f, 0.0f);
	glScalef(r,r,r);
	RenderSphere();
	glPopMatrix();

	glPushMatrix();
	glTranslatef(0.0f,h*0.5f, 0.0f);
	glScalef(r,h,r);
	glRotatef(90.0f,1.0f,0.0f,0.0f);
	RenderCylinder();
	glPopMatrix();

	glPopMatrix();
}
Example #2
0
void CArea::TAmbienceInstance::Render()
{
	float fBoxSize = 10.0f;
	STATEMANAGER.SetRenderState(D3DRS_TEXTUREFACTOR, 0xff00ff00);
	RenderCube(fx-fBoxSize, fy-fBoxSize, fz-fBoxSize, fx+fBoxSize, fy+fBoxSize, fz+fBoxSize);
	STATEMANAGER.SetRenderState(D3DRS_TEXTUREFACTOR, 0xffffffff);
	RenderSphere(NULL, fx, fy, fz, float(dwRange) * fMaxVolumeAreaPercentage, D3DFILL_POINT);
	RenderSphere(NULL, fx, fy, fz, float(dwRange), D3DFILL_POINT);
	RenderCircle2d(fx, fy, fz, float(dwRange) * fMaxVolumeAreaPercentage);
	RenderCircle2d(fx, fy, fz, float(dwRange));

	for (int i = 0; i < 4; ++i)
	{
		float fxAdd = cosf(float(i) * D3DX_PI/4.0f) * float(dwRange) / 2.0f;
		float fyAdd = sinf(float(i) * D3DX_PI/4.0f) * float(dwRange) / 2.0f;

		if (i%2)
		{
			fxAdd /= 2.0f;
			fyAdd /= 2.0f;
		}

		RenderLine2d(fx + fxAdd, fy + fyAdd, fx - fxAdd, fy - fyAdd, fz);
	}
}
void dik_SphereChainWithInvisibility()
{
	float x_motion;
	float y_motion;

	InitialiseTransparents();

	sineAngle += 0.07f;
	angle += 1.5f;
	if(angle >= 360.0f)
		angle = 0.0f;
	if(sineAngle >= 360.0f)
		sineAngle = 0.0f;

	for(counter = 0; counter < CHAINMAXLENGTH; counter++)
	{
		x_motion = static_cast <float> (-counter);
		y_motion = chainBounce[counter];

		x_motion += XTRAVELSTART;

		if(animationCounter >= 1.0f)
			RenderSphere(x_motion, y_motion, -10.0f, ASphere[counter], &textureGeneration, 1.0f, RenderBackdrop);
		else
		{
			if(!soundPlayed)
			{
				factorR = 1.0f;
				factorG = 1.0f;
				factorB = 1.0f;
				lpDSBSounds[2]->GetStatus(&dwStatus);
				if(dwStatus & DSBSTATUS_BUFFERLOST)
					RestoreDSBuffers();
				else
				{
					lpDSBSounds[2]->SetFrequency(37500);
					lpDSBSounds[2]->SetVolume(DSBVOLUME_MAX);
					if (!(dwStatus & DSBSTATUS_PLAYING))
						lpDSBSounds[2]->Play(0, 0, 0);
					else
					if(dwStatus & DSBSTATUS_PLAYING)
						lpDSBSounds[2]->Stop();
					soundPlayed = true;
				}
			}
			RenderSphere(x_motion, y_motion, -10.0f, ASphere[counter], &quadTextureGeneration, animationCounter/25.0f, RenderBackdrop);
		}
	}

	ConstructModelChainMotion();

	glFlush();
	SwapBuffers(g_HDC);

}
Example #4
0
void DrawMonsterball (tObject *objP, float red, float green, float blue, float alpha)
{
#if !SIMPLE_SPHERE
    if (!gameData.render.monsterball.pSphere) {
        gameData.render.monsterball.nTessDepth = 3;
        gameData.render.monsterball.nFaces = CreateSphere (&gameData.render.monsterball);
    }
    if (gameData.render.monsterball.nFaces > 0)
#endif
    {
        if ((gameOpts->render.bDepthSort > 0) || (gameOpts->render.nPath && !gameOpts->render.bDepthSort))
            RIAddSphere (riMonsterball, red, green, blue, alpha, objP);
        else {
            static tOOF_vector p = {0,0,0};
            float r = f2fl (objP->size);
            gameStates.ogl.bUseTransform = 1;
            OglSetupTransform (0);
            G3StartInstanceMatrix (&objP->position.vPos, &objP->position.mOrient);
            RenderSphere (&gameData.render.monsterball, &p,
                          r, r, r, red, green, blue, gameData.hoard.monsterball.bm.bmTexBuf ? 1.0f : alpha,
                          &gameData.hoard.monsterball.bm, 4);
            G3DoneInstance ();
            OglResetTransform (1);
            gameStates.ogl.bUseTransform = 0;
        }
    }
}
Example #5
0
void DrawShieldSphere (tObject *objP, float red, float green, float blue, float alpha)
{
if (!CreateShieldSphere ())
	return;
#if !SIMPLE_SPHERE
if (gameData.render.shield.nFaces > 0)
#endif
	{
	if ((gameOpts->render.bDepthSort > 0) || (RENDERPATH && !gameOpts->render.bDepthSort))
		TIAddSphere (riSphereShield, red, green, blue, alpha, objP);
	else {
		tOOF_vector	p = {0, 0, 0};
		fix nSize = gameData.models.polyModels [objP->rType.polyObjInfo.nModel].rad;
		float	fScale, r = X2F (nSize) /** 1.05f*/;
		tTransformation *posP = OBJPOS (objP);
		vmsVector vPos;
		//gameStates.ogl.bUseTransform = 1;
		glBlendFunc (GL_ONE, GL_ONE);
		G3StartInstanceMatrix (*PolyObjPos (objP, &vPos), posP->mOrient);
		RenderSphere (&gameData.render.shield, &p, r, r, r, red, green, blue, alpha, bmpShield, 1, 1);
		G3DoneInstance ();
		gameStates.ogl.bUseTransform = 0;
		fScale = gameData.render.shield.pPulse->fScale;
		G3StartInstanceMatrix (vPos, posP->mOrient);
		vPos.SetZero();
		RenderObjectHalo (&vPos, 3 * nSize / 2, red * fScale, green * fScale, blue * fScale, alpha * fScale, 0);
		G3DoneInstance ();
		}
	}
}
void SmokeMarker::RenderAlphas( float _predictionTime )
{
    if( g_app->m_editing )
    {
#ifdef LOCATION_EDITOR
        Building::RenderAlphas( _predictionTime );
        RenderSphere( m_pos, 30.0f );
        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, 35.0f );
        }
#endif
    }
}
Example #7
0
File: sphere.c Project: paud/d2x-xl
void DrawShieldSphere (tObject *objP, float red, float green, float blue, float alpha)
{
if (!CreateShieldSphere ())
	return;
#if !SIMPLE_SPHERE
if (gameData.render.shield.nFaces > 0) 
#endif
	{
	if ((gameOpts->render.bDepthSort > 0) || (gameOpts->render.nPath && !gameOpts->render.bDepthSort))
		RIAddSphere (riSphereShield, red, green, blue, alpha, objP);
	else {
		tOOF_vector	p;
		fix nSize = gameData.models.polyModels [objP->rType.polyObjInfo.nModel].rad;
		float	fScale, r = f2fl (nSize) * 1.05f;
		tPosition *posP = OBJPOS (objP);
		vmsVector vPos;
		gameStates.ogl.bUseTransform = 1;
		G3StartInstanceMatrix (&posP->vPos, &posP->mOrient);
		RenderSphere (&gameData.render.shield, (tOOF_vector *) OOF_VecVms2Oof (&p, gameData.models.offsets + objP->rType.polyObjInfo.nModel),
						  r, r, r, red, green, blue, alpha, bmpShield, 1);
		G3DoneInstance ();
		gameStates.ogl.bUseTransform = 0;
		fScale = gameData.render.shield.pPulse->fScale;
		VmVecRotate (&vPos, gameData.models.offsets + objP->rType.polyObjInfo.nModel, ObjectView (objP));
		VmVecInc (&vPos, &posP->vPos);
		RenderObjectHalo (&vPos, 3 * nSize / 2, red * fScale, green * fScale, blue * fScale, alpha * fScale, 0);
		}
	}
}
Example #8
0
void Indicator::DrawCamera(GraphicsDevice &GD, MatrixController &MC, const Matrix4 &Perspective, float Radius, float Length, const Camera &C)
{
    Vec3f Frustrum[8], Target;
    GetCameraLine(Perspective, C, 0.0f, 0.0f, Frustrum[0], Frustrum[4]);
    GetCameraLine(Perspective, C, 1.0f, 0.0f, Frustrum[1], Frustrum[5]);
    GetCameraLine(Perspective, C, 1.0f, 1.0f, Frustrum[2], Frustrum[6]);
    GetCameraLine(Perspective, C, 0.0f, 1.0f, Frustrum[3], Frustrum[7]);    //get the 8 vertices of the perspective cube in world space

    RenderCylinder(GD, MC, Radius, Frustrum[0], Frustrum[1], RGBColor::White);
    RenderCylinder(GD, MC, Radius, Frustrum[1], Frustrum[2], RGBColor::White);
    RenderCylinder(GD, MC, Radius, Frustrum[2], Frustrum[3], RGBColor::White);
    RenderCylinder(GD, MC, Radius, Frustrum[3], Frustrum[0], RGBColor::White);

    RenderCylinder(GD, MC, Radius, Frustrum[0], Frustrum[4], RGBColor::White);
    RenderCylinder(GD, MC, Radius, Frustrum[1], Frustrum[5], RGBColor::White);
    RenderCylinder(GD, MC, Radius, Frustrum[2], Frustrum[6], RGBColor::White);
    RenderCylinder(GD, MC, Radius, Frustrum[3], Frustrum[7], RGBColor::White);

    RenderCylinder(GD, MC, Radius, Frustrum[4], Frustrum[5], RGBColor::White);
    RenderCylinder(GD, MC, Radius, Frustrum[5], Frustrum[6], RGBColor::White);
    RenderCylinder(GD, MC, Radius, Frustrum[6], Frustrum[7], RGBColor::White);
    RenderCylinder(GD, MC, Radius, Frustrum[7], Frustrum[4], RGBColor::White);    //render the 12 line segments of the perspective cube in world space

    RenderSphere(GD, MC, Radius * 2.0f, C.VecEye(), RGBColor::Blue);            //render the camera eye vector

    Target = C.VecEye() - C.VecLookDir() * Length;
    RenderCylinder(GD, MC, Radius, C.VecEye(), Target, RGBColor::Red);

    Target = C.VecEye() + C.VecUp() * Length;
    RenderCylinder(GD, MC, Radius, C.VecEye(), Target, RGBColor::Green);

    Target = C.VecEye() + C.VecRight() * Length;
    RenderCylinder(GD, MC, Radius, C.VecEye(), Target, RGBColor::Yellow);        //render the C.VecLookDir, C.VecUp, and C.VecLeft vectors
}
void Manipulator::Render(const Matrix& projection, const Matrix& view,
        const D3DXVECTOR3& position, const Manipulator::MeshPtr& selectedMesh)
{
    if(m_selectedTool != NONE)
    {
        if(m_selectedTool == ANIMATE)
        {
            // As the mesh is moving, draw white dots when 
            // it stops and blue dots for the motion in between

            m_shader->SetTechnique(DxConstant::DefaultTechnique);
            const std::vector<D3DXVECTOR3> points = selectedMesh->GetAnimationPoints();

            Transform world;
            world.SetPosition(points[0]);
            RenderSphere(m_shader, projection, view, ANIMATION_COLOR, world);
            const float lineScale = 0.5f;

            for(unsigned int i = 1; i < points.size(); ++i)
            {
                world.SetPosition(points[i]);
                RenderSphere(m_shader, projection, view, ANIMATION_COLOR, world);
            
                world.SetScale(lineScale);
                D3DXVECTOR3 line(points[i]-points[i-1]);
                const float length = D3DXVec3Length(&line);
                line /= length;

                const int spheres = static_cast<int>(std::ceil(length / LINE_SPACING));
                for(int j = 1; j < spheres; ++j)
                {
                    world.SetPosition(points[i-1] + (line * (j * LINE_SPACING)));
                    RenderSphere(m_shader, projection, view, LINE_COLOR, world);
                }
                world.SetScale(1.0f);
            }
        }

        std::for_each(m_tools[m_selectedTool]->axis.begin(), m_tools[m_selectedTool]->axis.end(), 
            [&selectedMesh, &position, &projection, &view](const MeshPtr& mesh)
            {
                mesh->SetPosition(selectedMesh->Position());
                mesh->DrawMesh(position, projection, view);
            });
    }
}
Example #10
0
void FireflyEmitter::DebugRender()
{
    glTranslatef( Origin.x, Origin.y, Origin.z );

    // RenderSphere( glm::vec4(0.0f, 0.0f, 1.0f, 1.0f), MinimumRadius );
     RenderSphere( glm::vec4(1.0f, 0.0f, 0.0f, 1.0f), MaximumRadius );

    glTranslatef( -Origin.x, -Origin.y, -Origin.z );
}
void LocationEditor::RenderModeInstantUnit()
{
	if (m_selectionId != -1)
	{
		InstantUnit *iu = g_app->m_location->m_levelFile->m_instantUnits.GetData(m_selectionId);
		Vector3 pos(iu->m_posX, 0, iu->m_posZ);
		pos.y = g_app->m_location->m_landscape.m_heightMap->GetValue(pos.x, pos.z);
		RenderSphere(pos, iv_sqrt(iu->m_number) * INSTANT_UNIT_SIZE_FACTOR);	
	}
}
Example #12
0
void DrawSphere(NxShape* sphere, const NxVec3& color)
{
	NxMat34 pose = sphere->getGlobalPose();

	glPushMatrix();
	SetupGLMatrix(pose.t, pose.M);
	NxReal r = sphere->isSphere()->getRadius();
	glScalef(r,r,r);
	RenderSphere();
	glPopMatrix();
}
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 SafeArea::Render( double predictionTime )
{
    if( g_app->m_editing )
    {
        RGBAColour colour;

        if( m_id.GetTeamId() != 255 )
        {
            colour = g_app->m_location->m_teams[ m_id.GetTeamId() ]->m_colour;    
        }
        colour.a = 255;

#ifdef DEBUG_RENDER_ENABLED
        RenderSphere( m_pos, 20.0, colour );
#endif
        int numSteps = 30;
        double angle = 0.0;

        glColor4ubv(colour.GetData() );
        glLineWidth( 2.0 );
        glBegin( GL_LINE_LOOP );
        for( int i = 0; i <= numSteps; ++i )
        {
            double xDiff = m_size * iv_sin(angle);
            double zDiff = m_size * iv_cos(angle);
            Vector3 pos = m_pos + Vector3(xDiff,5,zDiff);
	        pos.y = g_app->m_location->m_landscape.m_heightMap->GetValue(pos.x, pos.z) + 10.0;
            if( pos.y < 2 ) pos.y = 2;
            glVertex3dv( pos.GetData() );
            angle += 2.0 * M_PI / (double) numSteps;
        }
        glEnd();
    }
    else
    {
/*
        double angle = g_gameTime * 2.0;
        Vector3 dif( m_size * iv_sin(angle), 0.0, m_size * iv_cos(angle) );
        
        Vector3 pos = m_pos + dif;
        pos.y = g_app->m_location->m_landscape.m_heightMap->GetValue( pos.x, pos.z ) + 5.0;
        g_app->m_particleSystem->CreateParticle( pos, g_upVector*2 + dif/30, Particle::TypeMuzzleFlash, 100.0 );

        pos = m_pos - dif;
        pos.y = g_app->m_location->m_landscape.m_heightMap->GetValue( pos.x, pos.z ) + 5.0;
        g_app->m_particleSystem->CreateParticle( pos, g_upVector*2 - dif/30, Particle::TypeMuzzleFlash, 100.0 );
*/
    }
    

    //char *entityTypeRequired = Entity::GetTypeName( m_entityTypeRequired );
    //g_editorFont.DrawText3DCentre( m_pos + Vector3(0,m_size/2,0), 10.0, "%d / %d %ss", m_entitiesCounted, m_entitiesRequired, entityTypeRequired );
}
Example #15
0
void DrawCapsule(const NxVec3& color, NxF32 r, NxF32 h)
{
	glColor4f(color.x, color.y, color.z, 1.0f);

	glPushMatrix();
	glTranslatef(0.0f, h*0.5f, 0.0f);
	glScalef(r,r,r);
	RenderSphere();
	glPopMatrix();

	glPushMatrix();
	glTranslatef(0.0f,-h*0.5f, 0.0f);
	glScalef(r,r,r);
	RenderSphere();
	glPopMatrix();

	glPushMatrix();
	glTranslatef(0.0f,h*0.5f, 0.0f);
	glScalef(r,h,r);
	glRotatef(90.0f,1.0f,0.0f,0.0f);
	RenderCylinder();
	glPopMatrix();
}
void Building::RenderHitCheck()
{
#ifdef DEBUG_RENDER_ENABLED
	if (m_shape)
	{
		Matrix34 mat(m_front, m_up, m_pos);
		m_shape->RenderHitCheck(mat);
	}
	else
	{
		RenderSphere(m_pos, m_radius);
	}
#endif
}
Example #17
0
File: sphere.c Project: paud/d2x-xl
void DrawMonsterball (tObject *objP, float red, float green, float blue, float alpha)
{
if (!gameData.render.monsterball.pSphere) {
	gameData.render.monsterball.nTessDepth = 3;
	gameData.render.monsterball.nFaces = CreateSphere (&gameData.render.monsterball);
	}
if (gameData.render.monsterball.nFaces > 0) {
	tOOF_vector	p;
	G3StartInstanceMatrix (&objP->pos, &objP->orient);
	RenderSphere (&gameData.render.monsterball, (tOOF_vector *) OOF_VecVms2Oof (&p, &objP->pos), 
					  f2fl (objP->size), red, green, blue, alpha, &gameData.hoard.monsterball.bm);
	G3DoneInstance ();
	}
}
Example #18
0
File: sphere.c Project: paud/d2x-xl
void DrawObjectSphere (object *objP, float red, float green, float blue, float alpha)
{
    if (gameData.render.sphere.nTessDepth != gameOpts->render.textures.nQuality + 2) {
        if (gameData.render.sphere.pSphere)
            DestroySphere ();
        gameData.render.sphere.nTessDepth = gameOpts->render.textures.nQuality + 2;
    }
    if (!gameData.render.sphere.pSphere)
        gameData.render.sphere.nFaces = CreateSphere (&gameData.render.sphere.pSphere);
    if (gameData.render.sphere.nFaces > 0) {
        tOOF_vector	p;
        RenderSphere ((tOOF_vector *) OOF_VecVms2Oof (&p, &objP->pos), gameData.render.sphere.pSphere,
                      gameData.render.sphere.nFaces, f2fl (objP->size) * 1.1f,
                      red, green, blue, alpha);
    }
}
Example #19
0
File: sphere.c Project: paud/d2x-xl
void DrawShieldSphere (tObject *objP, float red, float green, float blue, float alpha)
{
if (gameData.render.shield.nTessDepth != gameOpts->render.textures.nQuality + 2) {
	if (gameData.render.shield.pSphere)
		DestroySphere (&gameData.render.shield);
	gameData.render.shield.nTessDepth = gameOpts->render.textures.nQuality + 2;
	}
if (!gameData.render.shield.pSphere)
	gameData.render.shield.nFaces = CreateSphere (&gameData.render.shield);
if (gameData.render.shield.nFaces > 0) {
	tOOF_vector	p;
	G3StartInstanceMatrix (&objP->pos, &objP->orient);
	RenderSphere (&gameData.render.shield, (tOOF_vector *) OOF_VecVms2Oof (&p, &objP->pos),
					  f2fl (objP->size) * 1.1f, red, green, blue, alpha, NULL);
	G3DoneInstance ();
	}
}
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 StaticShape::Render( float _predictionTime )
{
    if( m_shape )
    {
        Matrix34 mat( m_front, m_up, m_pos );
        mat.u *= m_scale;
        mat.r *= m_scale;
        mat.f *= m_scale;

        glEnable( GL_NORMALIZE );
        m_shape->Render( _predictionTime, mat );
        glDisable( GL_NORMALIZE );
    }
    else
    {
        RenderSphere( m_pos, 40.0f );
    }
}
Example #22
0
File: sphere.c Project: paud/d2x-xl
void DrawMonsterball (tObject *objP, float red, float green, float blue, float alpha)
{
if (!gameData.render.monsterball.pSphere) {
	gameData.render.monsterball.nTessDepth = 3;
	gameData.render.monsterball.nFaces = CreateSphere (&gameData.render.monsterball);
	}
if (gameData.render.monsterball.nFaces > 0) {
	if ((gameOpts->render.bDepthSort > 0) || (gameOpts->render.nPath && !gameOpts->render.bDepthSort))
		RIAddSphere (riMonsterball, red, green, blue, alpha, objP);
	else {
		tOOF_vector	p;
		float r = f2fl (objP->size);
		G3StartInstanceMatrix (&objP->position.vPos, &objP->position.mOrient);
		RenderSphere (&gameData.render.monsterball, (tOOF_vector *) OOF_VecVms2Oof (&p, &objP->position.vPos), 
						  r, r, r, red, green, blue, gameData.hoard.monsterball.bm.bmTexBuf ? 1.0f : alpha, 
						  &gameData.hoard.monsterball.bm, 4);
		G3DoneInstance ();
		}
	}
}
Example #23
0
void SlideDraw::Display() {
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); //カラーバッファ,デプスバッファ指定
  // 光源と視点が一緒に動かず固定されている場合
  // const GLfloat light0pos[4] = {lightpos[0][0],
  //                               lightpos[0][1],
  //                               lightpos[0][2],
  //                               lightpos[0][3]};
  // glLightfv(GL_LIGHT0, GL_POSITION, light0pos);

  for (auto&& ptcl : Particle) {
    if (IsDrawnObject(ptcl)) RenderSphere(ptcl);
  }

  ChangeCrossSection();
  // DrawCubic();
  // Drawxyz();

  const float col[][3] {{0.0, 1.0, 0.0}, {0.0, 0.0, 1.0}, {1.0, 0.0, 0.0}};
  DrawAxis(0.02, 0.3, col);
  RenderCurTime();
  glutSwapBuffers();
}
Example #24
0
/*!****************************************************************************
 @Function		RenderScene
 @Return		bool		true if no error occured
 @Description	Main rendering loop function of the program. The shell will
				call this function every frame.
				eglSwapBuffers() will be performed by PVRShell automatically.
				PVRShell will also manage important OS events.
				Will also manage relevent OS events. The user has access to
				these events through an abstraction layer provided by PVRShell.
******************************************************************************/
bool OGLES2ParticleSystem::RenderScene()
{
	HandleInput();
	UpdateParticles();
	UpdateFramerateCounter();

	float time_delta = PVRShellGetTime() / 10000.0f;
	PVRTVec3 vFrom = PVRTVec3((float) sin(time_delta) * 50.0f, 30.0f, (float) cos(time_delta) * 50.0f);
	m_mView = PVRTMat4::LookAtRH(vFrom, PVRTVec3(0.0f, 5.0f, 0.0f), PVRTVec3(0.0f, 1.0f, 0.0f));
	m_mViewProjection = m_mProjection * m_mView;

	// Clear colour and depth buffers
	glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	// Enables depth testing
	glEnable(GL_DEPTH_TEST);
	
	// Render floor
	RenderFloor();

	for (unsigned int i=0; i < g_cuiNumSpheres; i++)
		RenderSphere(g_caSpheres[i].aPosition, g_caSpheres[i].fRadius);

	// Render particles
	RenderParticles();	
	
	// Display info text.

	char lower_buffer[64];
	unsigned int numParticles = m_pParticleSystem->GetNumberOfParticles();
	sprintf(lower_buffer, "No. of Particles: %d", numParticles);
	m_Print3D.DisplayDefaultTitle("Particle System", NULL, ePVRTPrint3DSDKLogo);
	m_Print3D.Print3D(2.0f, 90.0f, 1.0f, 0xFFFFFFFF, "No. of Particles: %d", numParticles);
	m_Print3D.Flush();

	return true;
}
void dik_StandardSphereChain()
{
	float x_motion;
	float y_motion;

	InitialiseTransparents();

	sineAngle += 0.07f;
	angle += 1.5f;
	if(angle >= 360.0f)
		angle = 0.0f;
	if(sineAngle >= 360.0f)
		sineAngle = 0.0f;

	glBindTexture(GL_TEXTURE_2D, backdropTexture);

	for(counter = 0; counter < CHAINMAXLENGTH; counter++)
	{
		x_motion = static_cast <float> (-counter);
		y_motion = chainBounce[counter];

		x_motion += XTRAVELSTART;

		RenderSphere(x_motion, y_motion, -10.0f, ASphere[counter], &textureGeneration, 1.0f, RenderBackdrop);
	}

/*	Preceding for loop follows this pattern...
	RenderSphere(xTravel, bounce[0], -7.0f, ASphere[0]);
	RenderSphere(-1.0f+xTravel, bounce[1], -10.0f, ASphere[1]);
	RenderSphere(-2.0f+xTravel, bounce[2], -10.0f, ASphere[2]); */

	ConstructModelChainMotion();
	glRotatef(rotationAngle, 0.0f, 1.0f, 0.0f);

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