Example #1
0
void kStatus(char* name, char* status, bool good){
	kprintf("* %s",name);
	if (good)
		kColor(Black,LightGreen);
	else
		kColor(Black,LightRed);
	line_x = 80-5-strlen(status);
	kprintf("[ %s ]\n",status);
	kColorReset();
	kprintf("................................................................\n");
}
Example #2
0
	void    D3D10SkyBox::BuildParamMap()
	{
		// 建立参数表
		Key kProj( wstring( L"g_matProj" ) );
		m_kViewMatrix.SetName( wstring( L"g_matView" ) );
		m_kSkyTexture.SetName( wstring(L"g_Texture") );

		m_mParamMap[Material::Entity_ProjMatrix] = kProj;

		m_pEffect->AddParamHandle( Effect::Param_Matrix, kProj );
		m_pEffect->AddParamHandle( Effect::Param_Matrix, m_kViewMatrix );
		m_pEffect->AddParamHandle( Effect::Param_Texture, m_kSkyTexture );

		// 建立科技表
		Key kColor( wstring( L"Color" ) );
		m_mTechniqueMap[Material::Technique_Color] = kColor;
		m_pEffect->AddParamHandle( Effect::Param_Technique, kColor );
	}
Example #3
0
//----------------------------------------------------------------------------
void RipplingOcean::CreateRectangleMesh (TriMesh*& rpkMesh,
    const Vector3f& rkCenter, const Vector3f& rkU, const Vector3f& rkV,
    const Vector3f& rkAxis, float fUExtent, float fVExtent,
    int iUSamples, int iVSamples, bool bWantNormals, bool bWantColors, 
    bool bWantUVs)
{
    assert( iUSamples >=2 );
    assert( iVSamples >=2 );

    // allocate vertices
    int iVQuantity = iUSamples*iVSamples;
    Vector3f* akVertex = new Vector3f[iVQuantity];

    // allocate normals if requested
    Vector3f* akNormal = NULL;
    if ( bWantNormals )
        akNormal = new Vector3f[iVQuantity];

    // allocate colors if requested
    ColorRGB* akColor = NULL;
    if ( bWantColors )
    {
        akColor = new ColorRGB[iVQuantity];
        //memset(akColor,0,iVQuantity*sizeof(ColorRGB));

        // We want tangent data here.
        // rkV better be normalized!
        ColorRGB kColor( rkV.X()*0.5f+0.5f, rkV.Y()*0.5f+0.5f, 
            rkV.Z()*0.5f+0.5f );        

        for (int i = 0; i < iVQuantity; i++)
        {
            akColor[i] = kColor;
        }
    }

    // allocate texture coordinates if requested
    Vector2f* akUV = NULL;
    if ( bWantUVs )
        akUV = new Vector2f[iVQuantity];

    // allocate connectivity
    int iTQuantity = (iUSamples-1)*(iVSamples-1)*2;
    int* aiConnect = new int[3*iTQuantity];

    int iVNum = 0;

    // generate geometry
    float fInvU = 1.0f/(float)(iUSamples-1);
    float fInvV = 1.0f/(float)(iVSamples-1);

    float fCurU, fCurV;
    int iU, iV;
    for (iU = 0, fCurU = 0.0f; iU < iUSamples; iU++)
    {
        for (iV = 0, fCurV = 0.0f; iV < iVSamples; iV++)
        {
            akVertex[iVNum] = rkCenter + fUExtent*rkU*(fCurU-0.5f)
                + fVExtent*rkV*(fCurV-0.5f);

            if ( bWantUVs )
            {
                akUV[iVNum].X() = fCurU;
                akUV[iVNum].Y() = fCurV;
            }

            iVNum++;
            fCurV += fInvV;
        }
        fCurU += fInvU;
    }

    if ( bWantNormals )
    {
        for (int i = 0; i < iVQuantity; i++)
            akNormal[i] = rkAxis;
    }

    assert( iVNum == iVQuantity );

    int iC = 0;

    // generate connectivity
    for (iU = 0; iU < iUSamples-1; iU++)
    {
        for (iV = 0; iV < iVSamples-1; iV++)
        {
            int iV0, iV1, iV2, iV3;
            iV0 = iV + iVSamples*iU;
            iV1 = iV0 + 1;
            iV2 = iV0 + iVSamples;
            iV3 = iV2 + 1;

            aiConnect[iC++] = iV0;
            aiConnect[iC++] = iV1;
            aiConnect[iC++] = iV2;

            aiConnect[iC++] = iV2;
            aiConnect[iC++] = iV1;
            aiConnect[iC++] = iV3;
        }
    }

    assert( iC == iTQuantity*3 );

    if ( rpkMesh )
    {
        rpkMesh->Reconstruct(iVQuantity,akVertex,akNormal,akColor,akUV,
            iTQuantity,aiConnect);
    }
    else
    {
        rpkMesh = new TriMesh(iVQuantity,akVertex,akNormal,akColor,akUV,
            iTQuantity,aiConnect);
    }
}
Example #4
0
void kColorReset(){
	kColor(Black,White);
}