示例#1
0
void SE_TriSurfaceRenderUnit::getImage(int texIndex, SE_ImageData**& imageDataArray, int& imageDataNum)
{
    SE_Texture* tex = mSurface->getTexture();
    if(!tex)
    {
        imageDataArray = NULL;
        imageDataNum = 0;
        return;
    }
    SE_TextureUnit* texUnit = tex->getTextureUnit(texIndex);
    if(!texUnit)
    {
        imageDataArray = NULL;
        imageDataNum = 0;
        return;
    }
    texUnit->getImageData(imageDataArray, imageDataNum);
}
示例#2
0
void SE_MeshSimObject::inflate()
{
    SE_MeshTransfer* meshTransfer = SE_Application::getInstance()->getResourceManager()->getMeshTransfer(mMeshID);
    if(!meshTransfer)
    {
        //mMeshID = SE_MeshID::INVALID;
        if(SE_Application::getInstance()->SEHomeDebug)
            LOGI("[%s] meshTransfer not found!!!!,mesh id is %s\n",this->getName(),mMeshID.getStr());
        return;
    }



    if(mMesh)
    {
        //the object has inflated
        return;
    }

    SE_ResourceManager* resourceManager = SE_Application::getInstance()->getResourceManager();


    mMesh = meshTransfer->createMesh(SE_Application::getInstance()->getResourceManager());

    if(mMesh)
    {
        resourceManager->setObjectMesh(mMeshID,mMesh);
        mMesh->setMeshID(mMeshID);


        resourceManager->registerRes(SE_ResourceManager::MESH_RES, &mMeshID);
        resourceManager->registerRes(SE_ResourceManager::OBJECT_MESH_RES, &mMeshID);
        mOwnMesh = OWN;
    }
    else
    {
        return;
    }

    SE_Geometry* sp = (SE_Geometry*)getSpatial();

    if(!sp)
    {
        if(SE_Application::getInstance()->SEHomeDebug)
            LOGI("Error !!!!Mesh simobject not attach to a spatial !!!!!!!!!\n");
    }

    bool mipmap = sp->isNeedGenerateMipMap();
    if(!mipmap)
    {
        int num = this->getMesh()->getSurfaceNum();
        for(int i = 0; i < num; ++i)
        {
            SE_Texture* tx = this->getMesh()->getSurface(i)->getTexture();
            if(!tx)
            {
                continue;
            }
            int txnum = tx->getTexUnitNum();
            for(int j = 0; j < txnum; ++j)
            {
                tx->getTextureUnit(j)->setSampleMin(LINEAR);
            }
        }
    }
    SE_Vector4f spatialData = sp->getEffectData();
    int num = this->getMesh()->getSurfaceNum();

    for(int i = 0; i < num; ++i)
    {
        this->getMesh()->getSurface(i)->getMaterialData()->shiny = spatialData.x;
        this->getMesh()->getSurface(i)->getMaterialData()->shinessStrength = spatialData.y;

    }

    this->getSpatial()->applyLight();

}