コード例 #1
0
ファイル: common.hpp プロジェクト: souxiaosou/aether3d
 TexCoord operator+( const TexCoord& t ) const
 {
     return TexCoord( u + t.u, v + t.v );
 }
コード例 #2
0
ファイル: common.hpp プロジェクト: Dandarawy/aether3d
// Creates an interleaved vertex array.
void Mesh::Interleave()
{
    VertexInd newFace;

    for (std::size_t f = 0; f < face.size(); ++f)
    {
        // vertind 0
        ae3d::Vec3 tvertex = vertex [ face[ f ].vInd [ 0 ] ];
        ae3d::Vec3 tnormal = vnormal[ face[ f ].vnInd[ 0 ] ];
        TexCoord ttcoord = tcoord.empty() ? TexCoord() : tcoord[ face[ f ].uvInd[ 0 ] ];
        ae3d::Vec4 tcolor = colors.empty() ? ae3d::Vec4( 0, 0, 0, 1 ) : colors[ face[ f ].colInd[ 0 ] ];

        // Searches face f's vertex a from the vertex list.
        // If it's not found, it's added.
        bool found = false;
        
        for (std::size_t i = 0; i < indices.size(); ++i)
        {
            if (AlmostEquals( interleavedVertices[ indices[ i ].a ].position, tvertex ) &&
                AlmostEquals( interleavedVertices[ indices[ i ].a ].normal,   tnormal ) &&
                AlmostEquals( interleavedVertices[ indices[ i ].a ].texCoord, ttcoord ) &&
                AlmostEquals( interleavedVertices[ indices[ i ].a ].color, tcolor ))
            {
                found = true;
                newFace.a = indices[ i ].a;
                break;
            }
        }

        if (!found)
        {
            VertexPTNTC newVertex;
            newVertex.position = tvertex;
            newVertex.normal   = tnormal;
            newVertex.texCoord = ttcoord;
            newVertex.color    = tcolor;

            interleavedVertices.push_back( newVertex );

            newFace.a = (unsigned short)(interleavedVertices.size() - 1);
        }

        // vertind 1
        tvertex = vertex [ face[ f ].vInd [ 1 ] ];
        tnormal = vnormal[ face[ f ].vnInd[ 1 ] ];
        ttcoord = tcoord.empty() ? TexCoord() : tcoord [ face[ f ].uvInd[ 1 ] ];
        tcolor = colors.empty() ? ae3d::Vec4( 0, 0, 0, 1 ) : colors[ face[ f ].colInd[ 1 ] ];
        
        found = false;

        for (std::size_t i = 0; i < indices.size(); ++i)
        {
            if (AlmostEquals( interleavedVertices[ indices[ i ].b ].position, tvertex ) &&
                AlmostEquals( interleavedVertices[ indices[ i ].b ].normal,   tnormal ) &&
                AlmostEquals( interleavedVertices[ indices[ i ].b ].texCoord, ttcoord ) &&
                AlmostEquals( interleavedVertices[ indices[ i ].b ].color, tcolor ))
                
            {
                found = true;

                newFace.b = indices[ i ].b;
                break;
            }
        }

        if (!found)
        {
            VertexPTNTC newVertex;
            newVertex.position = tvertex;
            newVertex.normal   = tnormal;
            newVertex.texCoord = ttcoord;
            newVertex.color    = tcolor;

            interleavedVertices.push_back( newVertex );

            newFace.b = (unsigned short)(interleavedVertices.size() - 1);
        }

        // vertind 2
        tvertex = vertex [ face[ f ].vInd [ 2 ] ];
        tnormal = vnormal[ face[ f ].vnInd[ 2 ] ];
        ttcoord = tcoord.empty() ? TexCoord() :  tcoord [ face[ f ].uvInd[ 2 ] ];
        tcolor = colors.empty() ? ae3d::Vec4( 0, 0, 0, 1 ) : colors[ face[ f ].colInd[ 2 ] ];

        found = false;

        for (std::size_t i = 0; i < indices.size(); ++i)
        {
            if (AlmostEquals( interleavedVertices[ indices[ i ].c ].position, tvertex ) &&
                AlmostEquals( interleavedVertices[ indices[ i ].c ].normal,   tnormal ) &&
                AlmostEquals( interleavedVertices[ indices[ i ].c ].texCoord, ttcoord ) &&
                AlmostEquals( interleavedVertices[ indices[ i ].c ].color, tcolor ))
            {
                found = true;

                newFace.c = indices[ i ].c;
                break;
            }
        }

        if (!found)
        {
            VertexPTNTC newVertex;
            newVertex.position = tvertex;
            newVertex.normal   = tnormal;
            newVertex.texCoord = ttcoord;
            newVertex.color    = tcolor;

            interleavedVertices.push_back( newVertex );

            newFace.c = (unsigned short)(interleavedVertices.size() - 1);
        }

        indices.push_back( newFace );
    }

    if (interleavedVertices.size() > 65536)
    {
        std::cerr << "Mesh " << name << " has more than 65536 vertices!" << std::endl;
        exit( 1 );
    }
}
コード例 #3
0
ファイル: common.hpp プロジェクト: souxiaosou/aether3d
 TexCoord operator-( const TexCoord& t ) const
 {
     return TexCoord( u - t.u, v - t.v );
 }
コード例 #4
0
ファイル: OGLRender.cpp プロジェクト: Dieshi/mupen64plus-ae
bool OGLRender::RenderTexRect()
{
    glViewportWrapper(0, windowSetting.statusBarHeightToUse, windowSetting.uDisplayWidth, windowSetting.uDisplayHeight);
    OPENGL_CHECK_ERRORS;

    GLboolean cullface = glIsEnabled(GL_CULL_FACE);
    glDisable(GL_CULL_FACE);
    OPENGL_CHECK_ERRORS;

    float depth = -(g_texRectTVtx[3].z*2-1);

#if SDL_VIDEO_OPENGL

    glBegin(GL_TRIANGLE_FAN);

    glColor4f(g_texRectTVtx[3].r, g_texRectTVtx[3].g, g_texRectTVtx[3].b, g_texRectTVtx[3].a);
    TexCoord(g_texRectTVtx[3]);
    glVertex3f(g_texRectTVtx[3].x, g_texRectTVtx[3].y, depth);
    
    glColor4f(g_texRectTVtx[2].r, g_texRectTVtx[2].g, g_texRectTVtx[2].b, g_texRectTVtx[2].a);
    TexCoord(g_texRectTVtx[2]);
    glVertex3f(g_texRectTVtx[2].x, g_texRectTVtx[2].y, depth);

    glColor4f(g_texRectTVtx[1].r, g_texRectTVtx[1].g, g_texRectTVtx[1].b, g_texRectTVtx[1].a);
    TexCoord(g_texRectTVtx[1]);
    glVertex3f(g_texRectTVtx[1].x, g_texRectTVtx[1].y, depth);

    glColor4f(g_texRectTVtx[0].r, g_texRectTVtx[0].g, g_texRectTVtx[0].b, g_texRectTVtx[0].a);
    TexCoord(g_texRectTVtx[0]);
    glVertex3f(g_texRectTVtx[0].x, g_texRectTVtx[0].y, depth);

    glEnd();
    OPENGL_CHECK_ERRORS;

#elif SDL_VIDEO_OPENGL_ES2

    GLfloat colour[] = {
            g_texRectTVtx[3].r, g_texRectTVtx[3].g, g_texRectTVtx[3].b, g_texRectTVtx[3].a,
            g_texRectTVtx[2].r, g_texRectTVtx[2].g, g_texRectTVtx[2].b, g_texRectTVtx[2].a,
            g_texRectTVtx[1].r, g_texRectTVtx[1].g, g_texRectTVtx[1].b, g_texRectTVtx[1].a,
            g_texRectTVtx[0].r, g_texRectTVtx[0].g, g_texRectTVtx[0].b, g_texRectTVtx[0].a
    };

    GLfloat tex[] = {
            g_texRectTVtx[3].tcord[0].u,g_texRectTVtx[3].tcord[0].v,
            g_texRectTVtx[2].tcord[0].u,g_texRectTVtx[2].tcord[0].v,
            g_texRectTVtx[1].tcord[0].u,g_texRectTVtx[1].tcord[0].v,
            g_texRectTVtx[0].tcord[0].u,g_texRectTVtx[0].tcord[0].v
    };

    float w = windowSetting.uDisplayWidth / 2.0f, h = windowSetting.uDisplayHeight / 2.0f, inv = 1.0f;

    GLfloat vertices[] = {
            -inv + g_texRectTVtx[3].x / w, inv - g_texRectTVtx[3].y / h, depth, 1,
            -inv + g_texRectTVtx[2].x / w, inv - g_texRectTVtx[2].y / h, depth, 1,
            -inv + g_texRectTVtx[1].x / w, inv - g_texRectTVtx[1].y / h, depth, 1,
            -inv + g_texRectTVtx[0].x / w, inv - g_texRectTVtx[0].y / h, depth, 1
    };

    glVertexAttribPointer(VS_COLOR, 4, GL_FLOAT,GL_TRUE, 0, &colour );
    glVertexAttribPointer(VS_POSITION,4,GL_FLOAT,GL_FALSE,0,&vertices);
    glVertexAttribPointer(VS_TEXCOORD0,2,GL_FLOAT,GL_FALSE, 0, &tex);
    OPENGL_CHECK_ERRORS;
    glDrawArrays(GL_TRIANGLE_FAN,0,4);
    OPENGL_CHECK_ERRORS;

    //Restore old pointers
    glVertexAttribPointer(VS_COLOR, 4, GL_UNSIGNED_BYTE,GL_TRUE, sizeof(uint8)*4, &(g_oglVtxColors[0][0]) );
    glVertexAttribPointer(VS_POSITION,4,GL_FLOAT,GL_FALSE,sizeof(float)*5,&(g_vtxProjected5[0][0]));
    glVertexAttribPointer(VS_TEXCOORD0,2,GL_FLOAT,GL_FALSE, sizeof( TLITVERTEX ), &(g_vtxBuffer[0].tcord[0].u));

#endif

    if( cullface ) glEnable(GL_CULL_FACE);
    OPENGL_CHECK_ERRORS;

    return true;
}
コード例 #5
0
void RAS_StorageIM::IndexPrimitivesInternal(RAS_MeshSlot& ms, bool multi)
{ 
	bool obcolor = ms.m_bObjectColor;
	bool wireframe = m_drawingmode <= RAS_IRasterizer::KX_WIREFRAME;
	MT_Vector4& rgba = ms.m_RGBAcolor;
	RAS_MeshSlot::iterator it;

	if (ms.m_pDerivedMesh) {
		// mesh data is in derived mesh, 
		current_bucket = ms.m_bucket;
		current_polymat = current_bucket->GetPolyMaterial();
		current_ms = &ms;
		current_mesh = ms.m_mesh;
		current_wireframe = wireframe;
		// MCol *mcol = (MCol*)ms.m_pDerivedMesh->getFaceDataArray(ms.m_pDerivedMesh, CD_MCOL); /* UNUSED */

		// handle two-side
		if (current_polymat->GetDrawingMode() & RAS_IRasterizer::KX_BACKCULL)
			this->SetCullFace(true);
		else
			this->SetCullFace(false);

		if (current_polymat->GetFlag() & RAS_BLENDERGLSL) {
			// GetMaterialIndex return the original mface material index, 
			// increment by 1 to match what derived mesh is doing
			current_blmat_nr = current_polymat->GetMaterialIndex()+1;
			// For GLSL we need to retrieve the GPU material attribute
			Material* blmat = current_polymat->GetBlenderMaterial();
			Scene* blscene = current_polymat->GetBlenderScene();
			if (!wireframe && blscene && blmat)
				GPU_material_vertex_attributes(GPU_material_from_blender(blscene, blmat), &current_gpu_attribs);
			else
				memset(&current_gpu_attribs, 0, sizeof(current_gpu_attribs));
			// DM draw can mess up blending mode, restore at the end
			int current_blend_mode = GPU_get_material_alpha_blend();
			ms.m_pDerivedMesh->drawFacesGLSL(ms.m_pDerivedMesh, CheckMaterialDM);
			GPU_set_material_alpha_blend(current_blend_mode);
		} else {
			//ms.m_pDerivedMesh->drawMappedFacesTex(ms.m_pDerivedMesh, CheckTexfaceDM, mcol);
			current_blmat_nr = current_polymat->GetMaterialIndex();
			current_image = current_polymat->GetBlenderImage();
			ms.m_pDerivedMesh->drawFacesTex(ms.m_pDerivedMesh, CheckTexDM, NULL, NULL, DM_DRAW_USE_ACTIVE_UV);
		}
		return;
	}
	// iterate over display arrays, each containing an index + vertex array
	for (ms.begin(it); !ms.end(it); ms.next(it)) {
		RAS_TexVert *vertex;
		size_t i, j, numvert;
		
		numvert = it.array->m_type;

		if (it.array->m_type == RAS_DisplayArray::LINE) {
			// line drawing
			glBegin(GL_LINES);

			for (i = 0; i < it.totindex; i += 2)
			{
				vertex = &it.vertex[it.index[i]];
				glVertex3fv(vertex->getXYZ());

				vertex = &it.vertex[it.index[i+1]];
				glVertex3fv(vertex->getXYZ());
			}

			glEnd();
		}
		else {
			// triangle and quad drawing
			if (it.array->m_type == RAS_DisplayArray::TRIANGLE)
				glBegin(GL_TRIANGLES);
			else
				glBegin(GL_QUADS);

			for (i = 0; i < it.totindex; i += numvert)
			{
				if (obcolor)
					glColor4d(rgba[0], rgba[1], rgba[2], rgba[3]);

				for (j = 0; j < numvert; j++) {
					vertex = &it.vertex[it.index[i+j]];

					if (!wireframe) {
						if (!obcolor)
							glColor4ubv((const GLubyte *)(vertex->getRGBA()));

						glNormal3fv(vertex->getNormal());

						if (multi)
							TexCoord(*vertex);
						else
							glTexCoord2fv(vertex->getUV(0));
					}

					glVertex3fv(vertex->getXYZ());
				}
			}

			glEnd();
		}
	}
}
コード例 #6
0
ファイル: GraphicsSystem.cpp プロジェクト: Alucard014/OBS
void GraphicsSystem::TexCoord(float u, float v, int idTexture)
{
    UVCoord uv(u, v);
    TexCoord(uv, idTexture);
}
コード例 #7
0
ファイル: cxAtlas.cpp プロジェクト: cxuhua/cxengine
void cxAtlas::updateScale9()
{
    cxTexCoord *coord = TexCoord();
    if(coord == nullptr){
        renders.Clear();
        return;
    }
    const cxColor4F &color = Color();
    if(IsDirtyMode(DirtyModeSize|DirtyModeTexture)){
        Clear();
        cxSize2F size = Size();
        cxBox4F box = scalebox;
        
        if(size.w < scalebox.l + scalebox.r){
            box.l = (scalebox.l / scalebox.W()) * size.w;
            box.r = (scalebox.r / scalebox.W()) * size.w;
        }
        if(size.h < scalebox.t + scalebox.b){
            box.t = (scalebox.t / scalebox.H()) * size.h;
            box.b = (scalebox.b / scalebox.H()) * size.h;
        }
        box.l = !cxFloatIsOK(box.l)?0:box.l;
        box.r = !cxFloatIsOK(box.r)?0:box.r;
        box.t = !cxFloatIsOK(box.t)?0:box.t;
        box.b = !cxFloatIsOK(box.b)?0:box.b;
        //
        cxSize2F texsiz = Texture()->Size();
        cxSize2F tsize = coord->FrameSize();
        
        cxFloat tx = coord->rotated?(coord->frame.y/texsiz.h):(coord->frame.x/texsiz.w);
        cxFloat ty = coord->rotated?((coord->frame.x+coord->frame.h)/texsiz.w):(coord->frame.y/texsiz.h);
        cxFloat tw = coord->rotated?(coord->frame.w/texsiz.h):(coord->frame.w/texsiz.w);
        cxFloat th = coord->rotated?(coord->frame.h/texsiz.w):(coord->frame.h/texsiz.h);
        
        cxFloat txs[]={0.0f, box.l/tsize.w, (tsize.w - box.r)/tsize.w, 1.0f};
        cxFloat tys[]={0.0f, box.t/tsize.h, (tsize.h - box.b)/tsize.h, 1.0f};
        for(int i=0; i < 4; i++){
            txs[i] = coord->rotated?(txs[i] * tw + tx):(txs[i] * tw + tx);
            tys[i] = coord->rotated?(ty - tys[i] * th):(tys[i] * th + ty);
        }
        cxFloat bxs[]={0.0f, box.l, size.w - box.r, size.w};
        cxFloat bys[]={0.0f, box.t, size.h - box.b, size.h};
        
        cxFloat tx1=0,ty1=0,tx2=0,ty2=0;
        cxFloat bx1=0,by1=0,bx2=0,by2=0;
        cxFloat offx=0,offy=0;
        for(cxInt i=0; i < 9;i++){
            tx1 = txs[i%3];
            tx2 = txs[i%3 + 1];
            ty1 = tys[i/3];
            ty2 = tys[i/3 + 1];
            bx1 = bxs[i%3];
            bx2 = bxs[i%3 + 1];
            by1 = bys[i/3];
            by2 = bys[i/3 + 1];
            cxFloat hw = (bx2 - bx1)/2.0f;
            cxFloat hh = (by2 - by1)/2.0f;
            if(cxFloatIsEqual(hw, 0.0f) || cxFloatIsEqual(hh, 0.0f)){
                continue;
            }
            offx = (bx2 - bx1)/2.0f + bx1 - size.w/2.0f;
            offy = (size.h - (by2 - by1))/2.0f - by1;
            cxBoxRender &bp = renders.Inc();
            bp.SetColor(color);
            bp.lb.vertices = cxPoint3F(-hw + offx, -hh + offy, 0.0f);
            bp.rb.vertices = cxPoint3F( hw + offx, -hh + offy, 0.0f);
            bp.lt.vertices = cxPoint3F(-hw + offx,  hh + offy, 0.0f);
            bp.rt.vertices = cxPoint3F( hw + offx,  hh + offy, 0.0f);
            bp.lb.coords = coord->rotated?cxCoord2F(ty2, tx1):cxCoord2F(tx1, ty2);
            bp.rb.coords = coord->rotated?cxCoord2F(ty2, tx2):cxCoord2F(tx2, ty2);
            bp.lt.coords = coord->rotated?cxCoord2F(ty1, tx1):cxCoord2F(tx1, ty1);
            bp.rt.coords = coord->rotated?cxCoord2F(ty1, tx2):cxCoord2F(tx2, ty1);
        }
    }
    if(IsDirtyMode(DirtyModeColor)){
        for(cxInt i=0; i < renders.Size();i++){
            cxBoxRender &bp = renders.At(i);
            bp.SetColor(color);
        }
    }
}
コード例 #8
0
ファイル: AnimManager.cpp プロジェクト: Beulard/ecsftw
	void AddFrame( u32 id, int topLeftX, int topLeftY, int bottomRightX, int bottomRightY, float time ) {
		Anim& anim = anims[id];
		anim.frames.push_back( Frame( EntityManager::Create(), time ) );
		SpriteFactory::AttachSprite( anim.frames.back().id, anim.batch, Pos( anim.x, anim.y ), Size( anim.w, anim.h ), TexCoord( topLeftX, topLeftY ), TexCoord( bottomRightX, bottomRightY ) );
	}
コード例 #9
0
ファイル: filter_solids.cpp プロジェクト: DominikDeak/KFX
/*---------------------------------------------------------------------------
   Renders the filter effect. Assumes the Bind( ) method was called prior.
  ---------------------------------------------------------------------------*/
void FilterSolids::Render(void)
   {
   if (!Ready()) {return;}

   glEnable(GL_TEXTURE_2D);
   glEnable(GL_LIGHTING);
   glEnable(GL_BLEND);

   //Video texture uses its own matrix
   glMatrixMode(GL_TEXTURE);
   glActiveTexture(GL_TEXTURE1);
   glPushMatrix();
   glLoadMatrixf(MC.C);

   glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
   glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);

   Light.Bind();
   Mat.Bind();

   Program.Bind();
   Model.Bind(0);
   Depth.Bind(0);       
   Video.Bind(1);

   glMatrixMode(GL_MODELVIEW);

   for (uint Y = 0; Y < Grid.Y; Y++)
      {
      for (uint X = 0; X < Grid.X; X++)
         {
         vector2f Coord((float)X, (float)Y);
         Coord = (Coord - Offset) * 2.0f;

         vector2f TexCoord((float)X, (float)Y);
         TexCoord *= GridNorm;
         glUniform2f(UID, TexCoord.X, TexCoord.Y);

         glPushMatrix();
         glTranslatef(Coord.X, Coord.Y, 0.0f);
         Model.Render();
         glPopMatrix();
         }
      }

   Video.Unbind(1);
   Depth.Unbind(0);
   Model.Unbind(0);
   Program.Unbind();

   Light.Unbind();

   glMatrixMode(GL_TEXTURE);
   glActiveTexture(GL_TEXTURE1);
   glPopMatrix();

   glDisable(GL_BLEND);
   glDisable(GL_LIGHTING);
   glDisable(GL_TEXTURE_2D);

   #if defined (DEBUG)
      GLenum Error = glGetError();
      if (Error != GL_NO_ERROR) {throw dexception("OpenGL generated an error: %s", Debug::ErrorGL(Error));}
   #endif
   }
コード例 #10
0
ファイル: gLogo.cpp プロジェクト: KnIfER/armagetron
void gLogo::Display()
{
#ifndef DEDICATED
    if (!sr_glOut)
        return;

    if (sg_MoviePack() && !sg_LogoMPTitle)
    {
        sg_LogoMPTitle = tNEW(rFileTexture)(rTextureGroups::TEX_FONT, "moviepack/title.jpg",0,0,1);
        // sg_LogoMPTitle = tNEW(rFileTexture)(rTextureGroups::TEX_FONT, sg_mp_title, 0,0,1);
        sg_DisplayStatus = 1;
    }

    renderer->SetFlag(rRenderer::DEPTH_TEST, false);

    static REAL lasttime = 0;
    REAL time = tSysTimeFloat();
    REAL dt = time - lasttime;
    lasttime = time;

    if (!sg_Displayed && sg_DisplayStatus < .00001)
        return;

    if (sg_LogoMPTitle)
    {
        // update state variables
        if (sg_Displayed && sg_Big)
        {
            sg_DisplayStatus += dt;
            if (sg_DisplayStatus > 1)
                sg_DisplayStatus = 1;
        }
        else
        {
            sg_DisplayStatus -= dt;
            if (sg_DisplayStatus < 0)
                sg_DisplayStatus = 0;
        }

        sg_LogoMPTitle->Select();

        if (sg_DisplayStatus <= .01 || !sg_LogoMPTitle->Loaded())
            return;

        Color(1,1,1, sg_DisplayStatus);

        BeginQuads();
        TexCoord(0,0);
        Vertex(-1, 1);

        TexCoord(0,1);
        Vertex(-1, -1);

        TexCoord(1,1);
        Vertex(1, -1);

        TexCoord(1,0);
        Vertex(1, 1);

        RenderEnd();
    }
    else
    {
#ifndef KRAWALL
        sg_LogoMPTitle = tNEW(rFileTexture)(rTextureGroups::TEX_FONT, "textures/title.jpg",0,0,1);
        // sg_LogoMPTitle = tNEW(rFileTexture)(rTextureGroups::TEX_FONT, sg_title,0,0,1);

        sg_DisplayStatus = 1;

        // update state variables
        if (sg_Displayed && sg_Big)
        {
            sg_DisplayStatus += dt;
            if (sg_DisplayStatus > 1)
                sg_DisplayStatus = 1;
        }
        else
        {
            sg_DisplayStatus -= dt;
            if (sg_DisplayStatus < 0)
                sg_DisplayStatus = 0;
        }

        sg_LogoMPTitle->Select();

        if (sg_DisplayStatus <= .01 || !sg_LogoMPTitle->Loaded())
            return;

        Color(1,1,1, sg_DisplayStatus);

        BeginQuads();
        TexCoord(0,0);
        Vertex(-1, 1);

        TexCoord(0,1);
        Vertex(-1, -1);

        TexCoord(1,1);
        Vertex(1, -1);

        TexCoord(1,0);
        Vertex(1, 1);

        RenderEnd();
#endif	  

#ifdef KRAWALL
        sg_LogoTexture.Select();

        if ( !sg_LogoTexture.Loaded() )
        {
            return;
        }

        // update state variables
        if (sg_Spinning)
        {
            sg_SpinStatus = sg_SpinStatus.Turn(1, dt * 2 * .2 / (sg_SizeStatus + .2));
            sg_SpinStatus = sg_SpinStatus * (1/sqrt(sg_SpinStatus.NormSquared()));
        }

        if (sg_Big)
        {
            sg_SizeStatus += dt;
            if (sg_SizeStatus > 1)
                sg_SizeStatus = 1;
        }
        else
        {
            sg_SizeStatus *= (1 - 2 * dt);
            //      if (sg_SizeStatus < 0)
            //	sg_SizeStatus = 0;
        }

        if (sg_Displayed)
        {
            sg_DisplayStatus += dt;
            if (sg_DisplayStatus > 1)
                sg_DisplayStatus = 1;
        }
        else
        {
            sg_DisplayStatus -= dt*.3;
            if (sg_DisplayStatus < 0)
                sg_DisplayStatus = 0;
        }

        if (sg_DisplayStatus < 0)
            return;

        eCoord center(.8*(sg_SizeStatus*sg_SizeStatus-1), .8*(1-sg_SizeStatus));
        REAL e =.8 * (sg_SizeStatus + .1);
        eCoord extension(e, - .7 * e * fabs(sg_SpinStatus.x));

        eCoord ur = center - extension;
        eCoord ll = center + extension;

        Color(1,1,1, sg_DisplayStatus);

        BeginQuads();
        TexCoord(0,0);
        Vertex(ur.x, ur.y);

        TexCoord(0,1);
        Vertex(ur.x, ll.y);

        TexCoord(1,1);
        Vertex(ll.x, ll.y);

        TexCoord(1,0);
        Vertex(ll.x, ur.y);

        RenderEnd();
#endif

    }

#endif
}