void Geometry::_renderMesh() { if (NULL == mMesh) { return; } if (NULL == mMaterial) { return; } Euclid::Effect* fx = mMaterial->getEffect(); if (NULL == fx) { return; } // mMaterial->apply(); // if (NULL != mSkeleton) { // std::vector<Mat4> matrices; for(Euclid::BoneIDReferenceMap::iterator it = mMesh->_bones.begin(); it != mMesh->_bones.end(); ++it) { if (it->first < 255) { matrices.push_back(mSkeleton->_matrices[it->first]); } } if (matrices.size() >= 60) { mHardwareSkin = false; } else { mHardwareSkin = true; } fx->setMatrixArray("gMatrixPalette", &matrices[0], matrices.size()); } u32 passes = 0; fx->begin(&passes); for (u32 i = 0; i != passes; ++i) { fx->beginPass(i); mMesh->render(); fx->endPass(); } fx->end(); }
void Geometry::_renderMesh() { if (NULL == mMesh) { return; } if (NULL == mMaterial) { return; } Euclid::Effect* fx = mMaterial->getEffect(); if (NULL == fx) { return; } // mMaterial->apply(); // if (NULL != mSkeleton) { // std::vector<Mat4> matrices; for(Euclid::BoneIDReferenceMap::iterator it = mMesh->_bones.begin(); it != mMesh->_bones.end(); ++it) { if (it->first < 255) { matrices.push_back(mSkeleton->_matrices[it->first]); } } if (matrices.size() >= 60 || matrices.empty()) { mHardwareSkin = false; } else { fx->setMatrixArray("gMatrixPalette", &matrices[0], matrices.size()); mHardwareSkin = true; } fx->setBool("gSkinned", mHardwareSkin); } fx->setMatrix("gUVMatrix", &mUVMatrix); float alpha = mMaterial->mAlphaKFs.getFrame(&mMaterial->mAlphaAnimationTime); mMaterial->mDiffuse.a *= alpha; Euclid::AnimationTime at; Euclid::Color3 c = mMaterial->mColorKFs.getFrame(&at); mMaterial->mDiffuse.r *= c.r; mMaterial->mDiffuse.g *= c.g; mMaterial->mDiffuse.b *= c.b; fx->setFloatArray("gDiffuse", &mMaterial->mDiffuse.r, 4); fx->setBool("gUseVertexColor", mMaterial->mUseVertexColor); u32 passes = 0; fx->begin(&passes); for (u32 i = 0; i != passes; ++i) { fx->beginPass(i); mMesh->render(); fx->endPass(); } fx->end(); }