Ejemplo n.º 1
0
Archivo: ao.cpp Proyecto: ezhangle/SMAK
void AddRenderedVertex(tvector<float>& aflVerts, const Vector& v, const Vector2D& vt)
{
    aflVerts.push_back(v.x);
    aflVerts.push_back(v.y);
    aflVerts.push_back(v.z);
    aflVerts.push_back(vt.x);
    aflVerts.push_back(vt.y);
}
Ejemplo n.º 2
0
Archivo: ao.cpp Proyecto: ezhangle/SMAK
void AddShadowMapVertex(tvector<float>& aflVerts, const Vector& v, const Vector& vn, const Vector2D& vt)
{
    aflVerts.push_back(v.x);
    aflVerts.push_back(v.y);
    aflVerts.push_back(v.z);
    aflVerts.push_back(vn.x);
    aflVerts.push_back(vn.y);
    aflVerts.push_back(vn.z);
    aflVerts.push_back(vt.x);
    aflVerts.push_back(vt.y);
}
Ejemplo n.º 3
0
void LoadMeshInstanceIntoToy(CConversionScene* pScene, CConversionMeshInstance* pMeshInstance, const Matrix4x4& mParentTransformations)
{
	if (!pMeshInstance->IsVisible())
		return;

	CConversionMesh* pMesh = pMeshInstance->GetMesh();

	for (size_t m = 0; m < pScene->GetNumMaterials(); m++)
	{
		for (size_t j = 0; j < pMesh->GetNumFaces(); j++)
		{
			size_t k;
			CConversionFace* pFace = pMesh->GetFace(j);

			if (pFace->m == ~0)
				continue;

			CConversionMaterial* pMaterial = NULL;
			CConversionMaterialMap* pConversionMaterialMap = pMeshInstance->GetMappedMaterial(pFace->m);

			if (!pConversionMaterialMap)
				continue;

			if (!pConversionMaterialMap->IsVisible())
				continue;

			if (pConversionMaterialMap->m_iMaterial != m)
				continue;

			while (g_asTextures.size() <= pConversionMaterialMap->m_iMaterial)
			{
				g_asTextures.push_back(pScene->GetMaterial(pConversionMaterialMap->m_iMaterial)->GetDiffuseTexture());
				g_aaflData.push_back();
			}

			size_t iMaterial = pConversionMaterialMap->m_iMaterial;

			CConversionVertex* pVertex0 = pFace->GetVertex(0);

			for (k = 2; k < pFace->GetNumVertices(); k++)
			{
				CConversionVertex* pVertex1 = pFace->GetVertex(k-1);
				CConversionVertex* pVertex2 = pFace->GetVertex(k);

				AddVertex(iMaterial, mParentTransformations * pMesh->GetVertex(pVertex0->v), pMesh->GetUV(pVertex0->vu));
				AddVertex(iMaterial, mParentTransformations * pMesh->GetVertex(pVertex1->v), pMesh->GetUV(pVertex1->vu));
				AddVertex(iMaterial, mParentTransformations * pMesh->GetVertex(pVertex2->v), pMesh->GetUV(pVertex2->vu));
			}
		}
	}
}
Ejemplo n.º 4
0
Archivo: ao.cpp Proyecto: ezhangle/SMAK
void CAOGenerator::RenderSetupSceneNode(CConversionSceneNode* pNode, tvector<tvector<float>>& aaflVerts)
{
    if (!pNode)
        return;

    for (size_t c = 0; c < pNode->GetNumChildren(); c++)
        RenderSetupSceneNode(pNode->GetChild(c), aaflVerts);

    for (size_t m = 0; m < pNode->GetNumMeshInstances(); m++)
    {
        CConversionMeshInstance* pMeshInstance = pNode->GetMeshInstance(m);
        CConversionMesh* pMesh = pMeshInstance->GetMesh();
        for (size_t f = 0; f < pMesh->GetNumFaces(); f++)
        {
            CConversionFace* pFace = pMesh->GetFace(f);

            size_t iMaterial = pMeshInstance->GetMappedMaterial(pFace->m)->m_iMaterial;
            while (aaflVerts.size() <= iMaterial)
                aaflVerts.push_back();

            CConversionVertex* pVertex0 = pFace->GetVertex(0);

            for (size_t k = 2; k < pFace->GetNumVertices(); k++)
            {
                CConversionVertex* pVertex1 = pFace->GetVertex(k-1);
                CConversionVertex* pVertex2 = pFace->GetVertex(k);

                AddRenderedVertex(aaflVerts[iMaterial], pMeshInstance->GetVertex(pVertex0->v), pMesh->GetUV(pVertex0->vu));
                AddRenderedVertex(aaflVerts[iMaterial], pMeshInstance->GetVertex(pVertex1->v), pMesh->GetUV(pVertex1->vu));
                AddRenderedVertex(aaflVerts[iMaterial], pMeshInstance->GetVertex(pVertex2->v), pMesh->GetUV(pVertex2->vu));
            }
        }
    }
}