コード例 #1
0
ファイル: SE_NewGeometry.cpp プロジェクト: 3DHome/3DHomeHD
void SE_NewGeometry::updateWorldTransform()
{
    SE_Spatial::updateWorldTransform();
    SE_Matrix4f localM;
    localM.set(getLocalRotate().toMatrix3f(), getLocalScale(), getLocalTranslate());
    mWorldTransform = getPrevMatrix().mul(localM).mul(getPostMatrix());
    SE_NewGeometry::_Impl::SimObjectList::iterator it;
    for(it = mImpl->attachObject.begin() ; it != mImpl->attachObject.end() ; it++)
    {
        (*it)->doTransform(getWorldTransform());
    }
    std::list<SE_Spatial*>::iterator itchild = mImplchild->children.begin();
    for(; itchild != mImplchild->children.end() ; itchild++)
    {
        SE_Spatial* s = *itchild;
        s->updateWorldTransform();
    }
}
コード例 #2
0
bool EntityComponent::getProperty( Property* const inOutProperty )
{
    bool result(true);
    const he::FixedString& name(inOutProperty->getName());
    if (name == HEFS::strTranslate)
    {
        inOutProperty->set<vec3>(getLocalTranslate());
    }
    else if (name == HEFS::strRotate)
    {
        inOutProperty->set<vec3>(getLocalRotate().getEulerAngles());       
    }
    else if (name == HEFS::strScale)
    {
        inOutProperty->set<vec3>(getLocalScale());
    }
    else
    {
        result = false;
    }
    return result;
}
コード例 #3
0
ファイル: SE_Geometry.cpp プロジェクト: AiAndroid/3DHomeHD
SE_Spatial *SE_Geometry::clone(SE_Spatial* parent,  int index,bool createNewMesh,const char* statuslist)
{
    if(!parent)
    {
        if(SE_Application::getInstance()->SEHomeDebug)
        LOGI("No parent,clone fail.!!!!");
        return NULL;
    }

    SE_Geometry * dest = new SE_Geometry();

    SE_SimObject* destobj = getCurrentAttachedSimObj()->clone(index,createNewMesh);

    dest->setSpatialName(this->getSpatialName());
    dest->setCloneIndex(index);
    
    
    //attach obj
    dest->attachSimObject(destobj);    

    //set spatial property

    dest->setBVType(getBVType());

    SE_Vector3f a = getLocalTranslate();
    dest->setLocalTranslate(a);

    dest->setLocalRotate(getLocalRotate());

    dest->setLocalScale(getLocalScale());

    dest->setPrevMatrix(getPrevMatrix());

    dest->setPostMatrix(getPostMatrix());

    dest->setParent(parent);

    SE_Layer* l = this->getWorldLayer();
    SE_Layer* destL = dest->getWorldLayer();
    destL->setLayer(l->getLayer());    

    //set render state
    dest->setRenderState(DEPTHTESTSTATE ,this->getRenderState(DEPTHTESTSTATE));
    

    //SE_Application::getInstance()->getSceneManager()->updateSpatialIDMap();
    SE_Scene* scene = getScene();
    scene->addSpatial(parent, dest);

    parent->updateWorldTransform();
    parent->updateBoundingVolume();
    parent->updateRenderState();
    //parent->updateWorldLayer();

    //copy geometry para
    dest->setHasInflate(true);
    
    dest->setAlpha(this->getAlpha());
    

    unsigned int status = 0;
    if(statuslist)
    {
        status = SE_Util::stringToInt(statuslist);
    }
    dest->setEffectState(status);

    dest->setSpatialState(this->getSpatialState());

    dest->setSpatialEffectData(this->getSpatialEffectData());

    std::vector<std::string> lights;
    this->getLightsNameList(lights);
    for(int i = 0; i < lights.size(); ++i)
    {
        dest->addLightNameToList(lights[i].c_str());
    }

    scene->sceneApplyLight();
    
    //return clone object
    return dest;
}