void CMUBmd::BmdSkeleton::calcLocalMatrix(unsigned long uBoneID) { //m_bCalc if (setBmdBone.size()<=uBoneID) { return; } BmdBone& b = setBmdBone[uBoneID]; Matrix m = Matrix::UNIT; if (b.setTrans.size()>0) { m *= Matrix::newTranslation(fixCoordSystemPos(b.setTrans[0])); } if (b.setRotate.size()>0) { m *= Matrix::newQuatRotate(fixCoordSystemRotate(b.setRotate[0])); } if (b.nParent==-1) { b.mLocal = m; } else { calcLocalMatrix(b.nParent); b.mLocal = getLocalMatrix(b.nParent)*m; } }
SE_Vector3f SE_SimObject::localToWorld(const SE_Vector3f& v) { SE_Spatial* spatial = getSpatial(); SE_Matrix4f worldTransform = spatial->getWorldTransform(); SE_Vector4f v4(v, 1); v4 = worldTransform.mul(getLocalMatrix()).map(v4); return v4.xyz(); }
const glm::mat4& Node::getWorldMatrix() const { if( _dirty ) { // Clear our dirty flag immediately to prevent this block from being entered if our // parent calls our getWorldMatrix() method as a result of the following calculations. _dirty = false; // If we have a parent, multiply our parent world transform by our local // transform to obtain our final resolved world transform. auto parent = getParent(); if( !parent.expired() ) { m_worldMatrix = parent.lock()->getWorldMatrix() * getLocalMatrix(); } else { m_worldMatrix = getLocalMatrix(); } } return m_worldMatrix; }
void Transformable::logTransformableInfo() { mat4f m; Console::log("Local transform:"); m = getLocalMatrix(); Console::log(" %.3f ; %.3f ; %.3f ; %.3f", m.a, m.b, m.c, m.d); Console::log(" %.3f ; %.3f ; %.3f ; %.3f", m.e, m.f, m.g, m.h); Console::log(" %.3f ; %.3f ; %.3f ; %.3f", m.i, m.j, m.k, m.l); Console::log(" %.3f ; %.3f ; %.3f ; %.3f", m.m, m.n, m.o, m.p); Console::log(" "); Console::log("World transform:"); m = getWorldMatrix(); Console::log(" %.3f ; %.3f ; %.3f ; %.3f", m.a, m.b, m.c, m.d); Console::log(" %.3f ; %.3f ; %.3f ; %.3f", m.e, m.f, m.g, m.h); Console::log(" %.3f ; %.3f ; %.3f ; %.3f", m.i, m.j, m.k, m.l); Console::log(" %.3f ; %.3f ; %.3f ; %.3f", m.m, m.n, m.o, m.p); Console::log(" "); }
DeviceLocalMatrix<ST> getNonconstDeviceData (const Teuchos::RCP<Thyra_LinearOp>& lop) { // Allow failure, since we don't know what the underlying linear algebra is auto tmat = getTpetraMatrix(lop,false); if (!tmat.is_null()) { // Get the local matrix from tpetra. DeviceLocalMatrix<ST> data = tmat->getLocalMatrix(); return data; } // TODO: to add epetra, create device matrix, get values view, create host copy, extract data // from matrix into values host view, deep copy to device. We could otherwise ENFORCE // PHX::Device to be a host exec space for Epetra. // If all the tries above are not successful, throw an error. TEUCHOS_TEST_FOR_EXCEPTION (true, std::runtime_error, "Error! Could not cast Thyra_Vector to any of the supported concrete types.\n"); // Dummy return value, to silence compiler warnings DeviceLocalMatrix<ST> dummy; return dummy; }
std::unique_ptr<GrFragmentProcessor> Gr2PtConicalGradientEffect::Make( const GrGradientEffect::CreateArgs& args) { const SkTwoPointConicalGradient& shader = *static_cast<const SkTwoPointConicalGradient*>(args.fShader); SkMatrix matrix; if (!shader.getLocalMatrix().invert(&matrix)) { return nullptr; } if (args.fMatrix) { SkMatrix inv; if (!args.fMatrix->invert(&inv)) { return nullptr; } matrix.postConcat(inv); } GrGradientEffect::CreateArgs newArgs(args.fContext, args.fShader, &matrix, args.fWrapMode, args.fDstColorSpace); // Data and matrix has to be prepared before constructing TwoPointConicalEffect so its parent // class can have the right matrix to work with during construction. TwoPointConicalEffect::Data data(shader, matrix); return TwoPointConicalEffect::Make(newArgs, data); }
SE_SimObject::RenderUnitVector SE_MeshSimObject::createUnitForTarget(RENDERTARGET_TYPE type,SE_RenderTarget* rt) { RenderUnitVector ruv; int surfaceNum = this->getSurfaceNum(); if(type == MIRROR) { for(int i = 0; i < surfaceNum; ++i) { SE_Surface* surface = getMesh()->getSurface(i); SE_TriSurfaceRenderUnit* tsru = new SE_TriSurfaceRenderUnit(surface); std::string indexStr = SE_Util::intToString(i); std::string spatialName = this->getSpatial()->getSpatialName(); std::string renderUnitName = spatialName + "_" + indexStr; tsru->setLayer(*getSpatial()->getWorldLayer()); tsru->setEnableCullFace(false); tsru->setName(renderUnitName.c_str()); tsru->setPrimitiveType(getPrimitiveType()); tsru->setRenderableSpatial(this->getSpatial()); if(!isUseWorldMatrix()) { tsru->setWorldTransform(getSpatial()->getWorldTransform().mul(getLocalMatrix())); } else { tsru->setWorldTransform(getWorldMatrix()); } for(int j = 0 ; j < RENDERSTATE_NUM ; j++) { tsru->setRenderState((RENDER_STATE_TYPE)j, getSpatial()->getRenderState((RENDER_STATE_TYPE)j), NOT_OWN); } tsru->setBlendState(this->getSpatial()->isSpatialEffectHasAttribute(SE_SpatialAttribute::BLENDABLE)); //render fbo no need alpha effect; tsru->setAlpha(1.0); //need render mirror tsru->setNeedGenerateMirror(true); tsru->setShaderName(DRAWMIRROR_SHADER); tsru->setRenderName(DRAWMIRROR_RENDERER); //tsru->setRenderToFbo(true); /*SE_Spatial* mirrorobj = this->getSpatial()->getMirrorObject(); if(mirrorobj) { tsru->setMirrorObject(mirrorobj); }*/ tsru->setMirrorPlan(this->getSpatial()->getMirrorPlan()); tsru->setRenderTarget(rt); ruv.push_back(tsru); } } if(type == SHADOW) { for(int i = 0; i < surfaceNum; ++i) { SE_Surface* surface = getMesh()->getSurface(i); SE_TriSurfaceRenderUnit* tsru = new SE_TriSurfaceRenderUnit(surface); std::string indexStr = SE_Util::intToString(i); std::string spatialName = this->getSpatial()->getSpatialName(); std::string renderUnitName = spatialName + "_" + indexStr; tsru->setLayer(*getSpatial()->getWorldLayer()); tsru->setEnableCullFace(false); tsru->setName(renderUnitName.c_str()); tsru->setPrimitiveType(getPrimitiveType()); tsru->setRenderableSpatial(this->getSpatial()); if(!isUseWorldMatrix()) { tsru->setWorldTransform(getSpatial()->getWorldTransform().mul(getLocalMatrix())); } else { tsru->setWorldTransform(getWorldMatrix()); } for(int j = 0 ; j < RENDERSTATE_NUM ; j++) { tsru->setRenderState((RENDER_STATE_TYPE)j, getSpatial()->getRenderState((RENDER_STATE_TYPE)j), NOT_OWN); } tsru->setNeedGenerateShadow(true); if(USEVSM) { tsru->setShaderName(VSM_SHADER); tsru->setRenderName(VSM_RENDERER); SE_Application::getInstance()->getRenderManager()->setNeedBlurShadow(false); } else { tsru->setShaderName(DRAWDEPTH_SHADER); tsru->setRenderName(DRAWDEPTH_RENDERER); } tsru->setEnableCullFace(true); tsru->setRenderTarget(rt); ruv.push_back(tsru); } } return ruv; }
SE_SimObject::RenderUnitVector SE_MeshSimObject::createRenderUnit() { if(!mMesh) return RenderUnitVector(); RenderUnitVector ruv; SE_SimObject* simple = getSpatial()->getSimpleObject(); if(!simple) { simple = this; } bool enableDof = SE_Application::getInstance()->getCurrentCamera()->isNeedDof(); SE_Camera* c = SE_Application::getInstance()->getCurrentCamera(); if(this->getSpatial()->isSpatialEffectHasAttribute(SE_SpatialAttribute::MIRRORGENERATOR) &&( SE_Application::getInstance()->getRenderManager()->isNeedUpdateMirrorMap() || c->isChanged()) ) { SE_Application::getInstance()->getRenderManager()->insertMirrorGenerator(this->getSpatial()); } if(this->getSpatial()->isSpatialEffectHasAttribute(SE_SpatialAttribute::SHADOWGENERATOR) &&( SE_Application::getInstance()->getRenderManager()->isNeedUpdateShadowMap() || c->isChanged()) ) { SE_Application::getInstance()->getRenderManager()->insertShadowGenerator(this->getSpatial()); } if(!SE_Application::getInstance()->getSceneManager()->isSceneManagerHasStatus(ENABLELIGHT)) { this->getSpatial()->setSpatialEffectAttribute(SE_SpatialAttribute::LIGHTING,false); } if(this->getSpatial()->isSpatialEffectHasAttribute(SE_SpatialAttribute::SHADOWOBJECT)) { //if enable shadow, disable draw shadow object this->getSpatial()->setShadowObjectVisibility(false); return RenderUnitVector();; } //render object int surfaceNum = getSurfaceNum(); for(int i = 0 ; i < surfaceNum; i++) { std::string indexStr = SE_Util::intToString(i); std::string renderUnitName = std::string(getName()) + "_" + indexStr; SE_Surface* surface = mMesh->getSurface(i); //SE_TriSurfaceRenderUnit* tsru = new SE_TriSurfaceRenderUnit(surface); #ifdef USE_RUMANAGER SE_RenderUnitManager* srum = SE_Application::getInstance()->getRenderUnitManager(); SE_TriSurfaceRenderUnit* tsru = (SE_TriSurfaceRenderUnit*)srum->find(renderUnitName.c_str()); if(!tsru) { tsru = new SE_TriSurfaceRenderUnit(surface); srum->insert(renderUnitName.c_str(),tsru); } else { tsru->reset(); } #else SE_TriSurfaceRenderUnit* tsru = new SE_TriSurfaceRenderUnit(surface); #endif if(this->getSpatial()->isSpatialHasRuntimeAttribute(SE_SpatialAttribute::IGNORVERTEXBUFFER)) { tsru->setDontUseVertexBuffer(true); } tsru->setTexCoordXYReverse(this->getSpatial()->getTexCoordXYReverse()); if(enableDof) { tsru->setName(renderUnitName.c_str()); tsru->setPrimitiveType(getPrimitiveType()); tsru->setRenderableSpatial(this->getSpatial()); if(!isUseWorldMatrix()) { tsru->setWorldTransform(getSpatial()->getWorldTransform().mul(getLocalMatrix())); } else { tsru->setWorldTransform(getWorldMatrix()); } //SE_RenderState** rs = getRenderState(); for(int j = 0 ; j < RENDERSTATE_NUM ; j++) { //tsru->setRenderState((RENDER_STATE_TYPE)j, rs[j], NOT_OWN); tsru->setRenderState((RENDER_STATE_TYPE)j, getSpatial()->getRenderState((RENDER_STATE_TYPE)j), NOT_OWN); } //fix me: tsru->setBlendState(false); tsru->setLayer(*getSpatial()->getWorldLayer()); bool needCullFace = getSpatial()->isSpatialEffectHasAttribute(SE_SpatialAttribute::CULLFACE); tsru->setEnableCullFace(needCullFace); if(this->getSpatial()->isSpatialEffectHasAttribute(SE_SpatialAttribute::LIGHTING)) { tsru->setShaderName(DOFLIGHTGEN_SHADER); tsru->setRenderName(DOFLIGHTGEN_RENDERER); } else { tsru->setShaderName(DOFGEN_SHADER); tsru->setRenderName(DOFGEN_RENDERER); } //tsru->setRenderToFbo(true); tsru->setNeedDofGen(true); SE_Application::getInstance()->getRenderManager()->setNeedBlurShadow(true); } else { SE_Application::getInstance()->getRenderManager()->setNeedBlurShadow(false); tsru->setName(renderUnitName.c_str()); tsru->setPrimitiveType(getPrimitiveType()); tsru->setRenderableSpatial(this->getSpatial()); SE_AABBBV* aabbbv = (SE_AABBBV*)getSpatial()->getWorldBoundingVolume(); if(aabbbv) { SE_Vector3f min = aabbbv->getGeometry().getMin(); SE_Vector3f max = aabbbv->getGeometry().getMax(); tsru->setMinBounding(min); tsru->setMaxBounding(max); } //tsru->setNewImageKey(mSecondImageKey.c_str()); if(!isUseWorldMatrix()) { tsru->setWorldTransform(getSpatial()->getWorldTransform().mul(getLocalMatrix())); } else { tsru->setWorldTransform(getWorldMatrix()); } //SE_RenderState** rs = getRenderState(); for(int j = 0 ; j < RENDERSTATE_NUM ; j++) { //tsru->setRenderState((RENDER_STATE_TYPE)j, rs[j], NOT_OWN); tsru->setRenderState((RENDER_STATE_TYPE)j, getSpatial()->getRenderState((RENDER_STATE_TYPE)j), NOT_OWN); } if(this->getSpatial()->isSpatialEffectHasAttribute(SE_SpatialAttribute::BLENDABLE)) { tsru->setBlendState(true); tsru->setAlpha(this->getSpatial()->getAlpha()); } else { tsru->setBlendState(false); } if(this->getSpatial()->isNeedForeverBlend()) { tsru->setBlendState(true); this->getSpatial()->setSpatialEffectAttribute(SE_SpatialAttribute::BLENDABLE,true); SE_Vector4f d = this->getSpatial()->getEffectData(); if(d.z > 0.1) { tsru->setAlpha(d.z); } else { tsru->setAlpha(this->getSpatial()->getAlpha()); } } //for shadow object if(this->getSpatial()->isSpatialEffectHasAttribute(SE_SpatialAttribute::SHADOWOBJECT)) { tsru->setBlendState(true); tsru->setAlpha(1.0); #if 0 SE_Layer* l = this->getSpatial()->getWorldLayer(); if(this->getSpatial()->isSelected()) { l->setLayer(2); } else { l->setLayer(0); } #endif } tsru->setLayer(*getSpatial()->getWorldLayer()); bool needCullFace = getSpatial()->isSpatialEffectHasAttribute(SE_SpatialAttribute::CULLFACE); tsru->setEnableCullFace(needCullFace); tsru->setShaderName(DEFAULT_SHADER); tsru->setRenderName(DEFAULT_RENDERER); if(this->getSpatial()->isSpatialEffectHasAttribute(SE_SpatialAttribute::NEEDFOG)) { tsru->setShaderName(DEFAULTFOG_SHADER); tsru->setRenderName(DEFAULTFOG_RENDERER); } tsru->setIsUseFbo(false); //one object has just one effect,now /*int mirrorGeneratorCount = SE_Application::getInstance()->getSpatialManager()->mirrorGeneratorCount(); int shadowGeneratorCount = SE_Application::getInstance()->getSpatialManager()->shadowGeneratorCount();*/ if(this->getSpatial()->isSpatialEffectHasAttribute(SE_SpatialAttribute::ALPHATEST)) { tsru->setShaderName(ALPHATEST_SHADER); tsru->setRenderName(ALPHATEST_RENDERER); } else if(this->getSpatial()->isSpatialEffectHasAttribute(SE_SpatialAttribute::FLAGWAVE)) { tsru->setShaderName(FLAGWAVE_SHADER); tsru->setRenderName(FLAGWAVE_RENDERER); if(this->getSpatial()->isSpatialEffectHasAttribute(SE_SpatialAttribute::NEEDFOG)) { tsru->setShaderName(FLAGWAVEFOG_SHADER); tsru->setRenderName(FLAGWAVEFOG_RENDERER); } tsru->setEnableCullFace(false); } else if(this->getSpatial()->isSpatialEffectHasAttribute(SE_SpatialAttribute::CLOAKFLAGWAVE)) { tsru->setShaderName(CLOAKFLAGWAVE_SHADER); tsru->setRenderName(CLOAKFLAGWAVE_RENDERER); tsru->setEnableCullFace(false); } else if(this->getSpatial()->isNeedDrawLine()) { tsru->setShaderName(DRAWLINE_SHADER); tsru->setRenderName(DRAWLINE_RENDERER); tsru->setDontUseVertexBuffer(true); } else if(this->getSpatial()->isSpatialEffectHasAttribute(SE_SpatialAttribute::SHADOWRENDER)) { tsru->setNeedRenderShadow(true); if(USEVSM) { //vsm //need render shadow,disable other fbo function tsru->setFboReplaceCurrentTexture(false); tsru->setShaderName(SHADOWMAP_SHADER); tsru->setRenderName(SHADOWMAP_RENDERER); tsru->setNeedUseBluredShadowMap(false); //tsru->setIsUseFbo(true); if(tsru->getRenderableSpatial()->isSpatialEffectHasAttribute(SE_SpatialAttribute::LIGHTING)) { tsru->setShaderName(SHADOWMAPWITHLIGHT_SHADER); tsru->setRenderName(SHADOWMAPWITHLIGHT_RENDERER); } } else { //normal shadow map tsru->setShaderName(RENDERDEPTHSHADOW_SHADER); tsru->setRenderName(RENDERDEPTHSHADOW_RENDERER); } } else if(this->getSpatial()->isSpatialEffectHasAttribute(SE_SpatialAttribute::MIRRORRENDER)) { tsru->setNeedRenderMirror(true); tsru->setFboReplaceCurrentTexture(false); tsru->setShaderName(MIRROR_SHADER); tsru->setRenderName(MIRROR_RENDERER); tsru->setIsUseFbo(true); tsru->setBlendState(this->getSpatial()->isSpatialEffectHasAttribute(SE_SpatialAttribute::BLENDABLE)); #if 0 SE_Layer* l = this->getSpatial()->getWorldLayer(); l->setLayer(3); #endif tsru->setLayer(*getSpatial()->getWorldLayer()); tsru->setAlpha(this->getSpatial()->getAlpha()); //tsru->setMirrorObject(this->getSpatial()); tsru->setMirrorPlan(this->getSpatial()->getMirrorPlan()); } else if(this->getSpatial()->isSpatialEffectHasAttribute(SE_SpatialAttribute::UVANIMATION)) { tsru->setShaderName(UVANIMATION_SHADER); tsru->setRenderName(UVANIMATION_RENDERER); if(this->getSpatial()->isSpatialEffectHasAttribute(SE_SpatialAttribute::NEEDFOG)) { //disable now /* tsru->setShaderName(UVANIMATIONFOG_SHADER); tsru->setRenderName(UVANIMATIONFOG_RENDERER); */ } tsru->setTexCoordOffset(this->getSpatial()->getTexCoordOffset()); } else if(this->getSpatial()->isNeedParticle()) { tsru->setShaderName(PARTICLE_SHADER); tsru->setRenderName(PARTICLE_RENDERER); if(this->getSpatial()->isNeedDepthTest()) { tsru->setDepthState(true); } else { tsru->setDepthState(false); } } else if(this->getSpatial()->isSpatialEffectHasAttribute(SE_SpatialAttribute::LIGHTING)) { if(this->getMesh()->getSurface(0)->hasSpotLight()) { tsru->setShaderName(SIMPLELIGHTING_SPOT_SHADER); tsru->setRenderName(SIMPLELIGHTING_SPOT_RENDERER); } else { #ifdef WIN32 tsru->setShaderName(SIMPLELIGHTING_SHADER); tsru->setRenderName(SIMPLELIGHTING_RENDERER); #else tsru->setShaderName(SIMPLELIGHTING_SHADER); tsru->setRenderName(SIMPLELIGHTING_RENDERER); #endif } //for "pc_face" object tsru->setNeedSpecLight(this->getSpatial()->isNeedSpecLight()); } else { } #if 0 tsru->setRenderToFbo(true); //just for demo std::string spatialname = this->getSpatial()->getSpatialName(); // if(spatialname == "guang@group_house@ceshi_basedata.cbf" || spatialname == "guang1@group_house@ceshi_basedata.cbf" || spatialname == "guang2@group_house@ceshi_basedata.cbf" || spatialname == "guang3@group_house@ceshi_basedata.cbf" || spatialname == "guang4@group_house@ceshi_basedata.cbf" || spatialname == "guang05@group_house@ceshi_basedata.cbf" || spatialname == "guang06@group_house@ceshi_basedata.cbf") { SE_Layer* l = this->getSpatial()->getWorldLayer(); l->setLayer(2); tsru->setLayer(*l); tsru->setNeedColorEffect(true); tsru->setBlendState(true); tsru->setAlpha(1.0); } if(spatialname == "Object50@group_house@ceshi_basedata.cbf" || spatialname == "Object51@group_house@ceshi_basedata.cbf" || spatialname == "Object52@group_house@ceshi_basedata.cbf" || spatialname == "Object53@group_house@ceshi_basedata.cbf" || spatialname == "Object54@group_house@ceshi_basedata.cbf" || spatialname == "Object55@group_house@ceshi_basedata.cbf" || spatialname == "Object02@group_house@ceshi_basedata.cbf" || spatialname == "Object56@group_house@ceshi_basedata.cbf") { SE_Layer* l = this->getSpatial()->getWorldLayer(); l->setLayer(1); tsru->setLayer(*l); } if(spatialname == "wenzi@group_house@ceshi_basedata.cbf" || spatialname == "Box01@group_house@ceshi_basedata.cbf" || spatialname == "Box02@group_house@ceshi_basedata.cbf" || spatialname == "Box03@group_house@ceshi_basedata.cbf" || spatialname == "Plane18@group_house@ceshi_basedata.cbf") { tsru->setNeedHighLight(true); } #endif } ruv.push_back(tsru); } #if 0 //forward additive if(this->getSpatial()->isNeedLighting() && enablelighting && !this->getSpatial()->isNeedBlend() && 0) { for(int i = 0 ; i < surfaceNum; i++) { std::string indexStr = SE_Util::intToString(i); std::string renderUnitName = std::string(getName()) + "_" + indexStr; SE_Surface* surface = mMesh->getSurface(i); //SE_TriSurfaceRenderUnit* tsru = new SE_TriSurfaceRenderUnit(surface); #ifdef USE_RUMANAGER SE_RenderUnitManager* srum = SE_Application::getInstance()->getRenderUnitManager(); SE_TriSurfaceRenderUnit* tsru = (SE_TriSurfaceRenderUnit*)srum->find(renderUnitName.c_str()); if(!tsru) { tsru = new SE_TriSurfaceRenderUnit(surface); srum->insert(renderUnitName.c_str(),tsru); } else { tsru->reset(); } #else SE_TriSurfaceRenderUnit* tsru = new SE_TriSurfaceRenderUnit(surface); #endif tsru->setName(renderUnitName.c_str()); tsru->setPrimitiveType(getPrimitiveType()); tsru->setRenderableSpatial(this->getSpatial()); if(!isUseWorldMatrix()) { tsru->setWorldTransform(getSpatial()->getWorldTransform().mul(getLocalMatrix())); } else { tsru->setWorldTransform(getWorldMatrix()); } //SE_RenderState** rs = getRenderState(); for(int j = 0 ; j < RENDERSTATE_NUM ; j++) { //tsru->setRenderState((RENDER_STATE_TYPE)j, rs[j], NOT_OWN); tsru->setRenderState((RENDER_STATE_TYPE)j, getSpatial()->getRenderState((RENDER_STATE_TYPE)j), NOT_OWN); } //additive do not need blend tsru->setBlendState(false); tsru->setLayer(*getSpatial()->getWorldLayer()); bool needCullFace = getSpatial()->isSpatialEffectHasAttribute(SE_SpatialAttribute::CULLFACE); tsru->setEnableCullFace(needCullFace); tsru->setShaderName(DEFAULT_SHADER); tsru->setRenderName(DEFAULT_RENDERER); tsru->setIsUseFbo(false); tsru->setIsAdditive(1); //one object has just one effect,now if(this->getSpatial()->isNeedLighting() && enablelighting) { #ifdef WIN32 tsru->setShaderName(SIMPLELIGHTING_SHADER); tsru->setRenderName(SIMPLELIGHTING_RENDERER); #else tsru->setShaderName(SIMPLELIGHTINGPLUGIN_SHADER); tsru->setRenderName(SIMPLELIGHTINGPLUGIN_RENDERER); #endif } else { //do not need render shadow //set replace current mesh texture //bool replace = getMesh()->getSurface(0)->isNeedFboReplaceCurrentTexture(); //tsru->setFboReplaceCurrentTexture(replace); ////which mesh texture should be replace with fbo(0-3) //tsru->setFboReplaceTextureIndex(getMesh()->getSurface(0)->getFboReplaceTextureIndex()); //std::string fboname = surface->getUsedFboName(); //if(fboname.empty()) //{ // tsru->setUsedFboName(getSpatial()->getSpatialName()); //} //else //{ // tsru->setUsedFboName(fboname.c_str()); //} } ruv.push_back(tsru); } } #endif return ruv; }
mat4f Transformable::getWorldMatrix() { i32 i; Node *curr; Transformable *list[RC_SCENE_GRAPH_MAX_DEPTH]; u32 n_list; mat4f w; if (frozen) { return worldMatrix; } curr = this; n_list = 0; while (curr) { ASSERT(curr->isActive); if (curr->is_transformable) { list[n_list++] = (Transformable *) curr; ASSERT(n_list < RC_SCENE_GRAPH_MAX_DEPTH); // UNLIKELY } curr = curr->getParent(); } if (n_list == 1) { transformTime++; /* This might not be needed at all */ worldMatrix = getLocalMatrix(); worldTime = transformTime; return worldMatrix; } i = n_list - 1; if (list[i]->transformTime != list[i]->worldTime) { list[i]->worldMatrix = list[i]->getLocalMatrix(); list[i]->worldTime = list[i]->transformTime; i--; } else { do { i--; } while (i >= 0 && list[i]->parentWorldTime == list[i + 1]->worldTime && list[i]->worldTime == list[i]->transformTime); if (i < 0) return worldMatrix; } w = list[i + 1]->worldMatrix; while (i >= 0) { w = w.affineMul(list[i]->getLocalMatrix()); list[i]->transformTime++; list[i]->worldMatrix = w; list[i]->worldTime = list[i]->transformTime; list[i]->parentWorldTime = list[i + 1]->worldTime; i--; } return worldMatrix; }
Matrix CMUBmd::BmdSkeleton::getRotateMatrix(unsigned char uBoneID) { Matrix mRotate=getLocalMatrix(uBoneID); mRotate._14=0;mRotate._24=0;mRotate._34=0; return mRotate; }