本文整理汇总了C++中SE_ResourceManager类的典型用法代码示例。如果您正苦于以下问题:C++ SE_ResourceManager类的具体用法?C++ SE_ResourceManager怎么用?C++ SE_ResourceManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SE_ResourceManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: checkXml
void checkXml()
{
SE_ResourceManager* resourceManager = SE_Application::getInstance()->getResourceManager();
std::string inputDir = resourceManager->getLayoutPath();
std::string outputDir = resourceManager->getDataPath();
std::string outputFilePath = outputDir + SE_SEP + "checkxmlresult.txt";
FILE* f = fopen(outputFilePath.c_str(), "w");
if(!f)
{
LOGI("can not open output file : %s\n", outputFilePath.c_str());
return;
}
outputFile = f;
TCHAR inputDirWideChar[512];
memset(inputDirWideChar, 0, sizeof(TCHAR) * 512);
MultiByteToWideChar(CP_ACP, 0, inputDir.c_str(), -1, inputDirWideChar, 511);
DirWalk(inputDirWideChar, false);
std::string inputStr = inputDir;
std::list<_FileNameData>::iterator it ;
for(it = fileNameList.begin() ; it != fileNameList.end() ; it++)
{
_FileNameData fnd = *it;
std::string fileName = wcharToMultiByte(fnd.buf);
std::string filePath = fileName;
if(fileName != "")
{
handleContent(filePath.c_str());
}
}
fclose(f);
}
示例2:
SE_MeshSimObject::~SE_MeshSimObject()
{
#ifdef USE_RUMANAGER
for(int i = 0; i < getSurfaceNum(); ++i)
{
std::string indexStr = SE_Util::intToString(i);
std::string renderUnitName = std::string(getName()) + "_" + indexStr;
std::string renderUnitName_img = std::string(getName()) + "_" + indexStr + "img";
std::string renderUnitName_mirr = std::string(getName()) + "_" + indexStr + "mirr";
SE_RenderUnitManager* srum = SE_Application::getInstance()->getRenderUnitManager();
srum->remove(renderUnitName.c_str());
srum->remove(renderUnitName_img.c_str());
srum->remove(renderUnitName_mirr.c_str());
}
#endif
//use unregister instead delete,mesh may be used by clone object
/*if(mOwnMesh == OWN)
{
delete mMesh;
} */
SE_ResourceManager* resourceManager = SE_Application::getInstance()->getResourceManager();
if(mMesh != NULL) {
SE_MeshID id = mMesh->getMeshID();
resourceManager->unregisterRes(SE_ResourceManager::OBJECT_MESH_RES, &id);
}
//SE_ImageDataID imageid = mSecondImageKey.c_str();
//resourceManager->unregisterRes(SE_ResourceManager::IMAGE_RES, &imageid);
}
示例3: changeImageKey
bool SE_MeshSimObject::changeImageKey(const char* newKey)
{
#if 0
mSecondImageKey = newKey;
SE_ImageDataID id = newKey;
////id exist
//SE_TextureUnit* tu = this->getMesh()->getSurface(0)->getTexture()->getTextureUnit(0);
//
//SE_ImageDataID* imageDataIDArray = new SE_ImageDataID[1];
//imageDataIDArray[0] = id;
//tu->setImageDataID(imageDataIDArray,1);
SE_ResourceManager* rm = SE_Application::getInstance()->getResourceManager();
rm->registerRes(SE_ResourceManager::IMAGE_RES, &id);
if(rm->getImageData(id))
{
return true;
}
//id not exist,add it
rm->setImageData(id,NULL);
#endif
return false;
}
示例4: se_glReadPixels
static void se_glReadPixels(JNIEnv *env, jobject obj, jstring imageKey, jint x, jint y, jint w, jint h) {
int width = w;
int height = h;
int rowBytes = w * 4;
int pixelFormat = SE_ImageData::RGBA;
int pixNum = width * height;
char* newData = (char *)malloc(height * rowBytes);
glReadPixels(
(GLint)x,
(GLint)y,
(GLsizei)width,
(GLsizei)height,
(GLenum)GL_RGBA,
(GLenum)GL_UNSIGNED_BYTE,
(GLvoid *)newData
);
const char* imageKey8 = env->GetStringUTFChars(imageKey, 0);
SE_ResourceManager *resourceManager = SE_Application::getInstance()->getResourceManager();
SE_ImageData* newImgd = new SE_ImageData;
newImgd->setWidth(width);
newImgd->setHeight(height);
newImgd->setBytesPerRow(rowBytes);
newImgd->setPixelFormat(pixelFormat);
newImgd->setData(newData);
newImgd->setCompressType(SE_ImageData::RAW);
newImgd->setName(imageKey8);
resourceManager->insertPathImageData(imageKey8, newImgd, true);
env->ReleaseStringUTFChars(imageKey, imageKey8);
}
示例5: setImageData
void SE_Image::setImageData(SE_RectPrimitive* primitive)
{
SE_ResourceManager* resourceManager = SE_Application::getInstance()->getResourceManager();
int j = 0;
for(int i = 0 ; i < 5 ; i++)
{
SE_ImageUnit* imageUnit = mImageUnits[i].imageUnit;
if(imageUnit->isValid())
{
SE_ImageData* imageData = resourceManager->getImageData(imageUnit->imageDataID.getStr());
if(!imageData)
{
imageData = resourceManager->loadImage(imageUnit->imageDataID.getStr());
}
SE_ImageDataPortion dp;
dp.setX(imageUnit->imageRect.x);
dp.setY(imageUnit->imageRect.y);
dp.setWidth(imageUnit->imageRect.width);
dp.setHeight(imageUnit->imageRect.height);
primitive->setImageData(0, imageData, (SE_TEXUNIT_TYPE)j, NOT_OWN, dp);
j++;
mImageUnits[i].valid = 1;
}
}
}
示例6: handleContent
static void handleContent(const char* fileName)
{
SE_ResourceManager* resourceManager = SE_Application::getInstance()->getResourceManager();
SE_XMLTABLE_TYPE t = resourceManager->getXmlType(fileName);
switch(t)
{
case SE_ELEMENT_TABLE:
checkElementTable(fileName);
break;
case SE_IMAGE_TABLE:
checkImageTable(fileName);
break;
case SE_ACTION_TABLE:
checkActionTable(fileName);
break;
case SE_COLOREFFECT_TABLE:
checkColorEffectControllerTable(fileName);
break;
case SE_SEQUENCE_TABLE:
checkSequenceTable(fileName);
break;
case SE_STATE_TABLE:
break;
}
}
示例7: mMesh
SE_MeshSimObject::SE_MeshSimObject(SE_Mesh* mesh, SE_OWN_TYPE ownMesh) : mMesh(NULL), mOwnMesh(NOT_OWN)
{
SE_ResourceManager* resourceManager = SE_Application::getInstance()->getResourceManager();
resourceManager->registerRes(SE_ResourceManager::OBJECT_MESH_RES, &mMeshID);
mMesh = mesh;
mOwnMesh = ownMesh;
mSelected = false;
}
示例8: SE_ASSERT
void SE_NetDataCommand::handle(SE_TimeMS realDelta, SE_TimeMS simulateDelta)
{
SE_ASSERT(mMsg->len >= 3);
int id = mMsg->data[0];
unsigned short dataLen = 0;
memcpy(&dataLen, mMsg->data + 1, 2);
dataLen = SE_Util::net2HostInt16(dataLen);
int realDataLen = dataLen - 3;
std::string str;
if(realDataLen > 0)
{
str.assign((char*)mMsg->data + 3, realDataLen);
}
for(int i = 0 ; i < mMsg->len ; i++)
{
LOGI("%d\n", mMsg->data[i]);
}
LOGI("### msg len = %d , str = %s ###\n", mMsg->len, str.c_str());
if(id == 0 && str.size() > 0)
{
SE_ImageUnit iu;
SE_ResourceManager* resourceManager = SE_GET_RESOURCEMANAGER();
SE_ImageData* imageData = resourceManager->loadImageWithFullPath(str.c_str());
if(!imageData)
{
LOGI("can not load image\n");
return;
}
iu.imageDataID = str.c_str();
iu.imageRect.x = 0;
iu.imageRect.y = 0;
iu.imageRect.width = imageData->getWidth();
iu.imageRect.height = imageData->getHeight();
SE_ImageElement* imageElement = new SE_ImageElement("");
imageElement->setBaseColor(iu);
SE_SceneManager* sceneManager = SE_Application::getInstance()->getSceneManager();
SE_Scene* scene = new SE_2DScene;
scene->setBackground(SE_Vector4f(1.0f, 1.0f, 1.0f, 1.0f));
scene->setBound(480, 800);
scene->setRootElement(imageElement);
SE_SceneID sceneID = sceneManager->add(scene);
//create camera
SE_Camera* camera = SE_Camera::create2DSceneCamera(480, 800);
SE_CameraManager* cameraManager = SE_Application::getInstance()->getCameraManager();
SE_CameraID cameraID = cameraManager->add(camera);
scene->setCamera(cameraID);
//end
sceneManager->show(sceneID);
}
else
{
}
}
示例9: checkStateTable
static void checkStateTable(const char* fileName)
{
SE_ResourceManager* resourceManager = SE_Application::getInstance()->getResourceManager();
resourceManager->loadElementSchema(fileName);
TiXmlDocument* doc = getDocument(fileName);
if(doc)
{
checkDocument(fileName, doc, stateTableKeyword, sizeof(stateTableKeyword) / sizeof(const char*));
delete doc;
}
}
示例10: visit
void visit(const SE_StringID& id, const SE_ImageItem* imageItem)
{
const SE_ImageItemProperty& imageItemProperty = imageItem->getProperty();
SE_ImageDataID imageDataID = imageItemProperty.getImageDataID();
SE_ResourceManager* resourceManager = SE_Application::getInstance()->getResourceManager();
SE_ImageData* imageData = resourceManager->loadImage(imageDataID.getStr());
if(!imageData)
{
OUTSTRING("... image file can not find : %s", imageDataID.getStr());
}
}
示例11: se_inflateResource
static void se_inflateResource(JNIEnv* env, jobject obj, jint resource, jstring objName, jint objIndex, jstring nodeName, jint nodeIndex, jboolean removeTopNode)
{
//Invoke by gl thread
jstring sceneName = (jstring)env->GetObjectField(obj, sceneNameID);
const char* sceneName8 = env->GetStringUTFChars(sceneName, 0);
const char* nodeName8 = env->GetStringUTFChars(nodeName, NULL);
const char* objName8 = env->GetStringUTFChars(objName, NULL);
SE_Scene* scene = SE_Application::getInstance()->getSceneManager()->getScene(SE_FRAMEBUFFER_SCENE, SE_StringID(sceneName8));
SE_Spatial* node = SE_Application::getInstance()->getSceneManager()->findSpatialByName(nodeName8, nodeIndex);
SE_Spatial* s = (SE_Spatial*)resource;
if (!node)
{
env->ReleaseStringUTFChars(sceneName, sceneName8);
env->ReleaseStringUTFChars(nodeName, nodeName8);
env->ReleaseStringUTFChars(objName, objName8);
return;
}
if (s) {
SE_ResourceManager* m = SE_Application::getInstance()->getResourceManager();
SE_ResourceManager* loader = s->getCBFLoader();
m->copy(loader);
s->deleteCBFLoader();
if (removeTopNode) {
s->getChildByIndex(0)->setSpatialName(objName8);
s->getChildByIndex(0)->setCloneIndex(objIndex);
s->replaceChildParent(node);
node->setCloneIndex(objIndex);
scene->inflate();
node->updateWorldTransform();
node->updateBoundingVolume();
node->updateWorldLayer();
delete s;
} else {
s->setSpatialName(objName8);
s->setCloneIndex(objIndex);
std::string modelName = objName8;
modelName = modelName + "_model";
s->getChildByIndex(0)->setSpatialName(modelName.c_str());
s->getChildByIndex(0)->setCloneIndex(objIndex);
scene->addSpatial(node, s);
scene->inflate();
node = scene->getRoot();
node->updateWorldTransform();
node->updateBoundingVolume();
node->updateWorldLayer();
}
}
env->ReleaseStringUTFChars(sceneName, sceneName8);
env->ReleaseStringUTFChars(nodeName, nodeName8);
env->ReleaseStringUTFChars(objName, objName8);
}
示例12: getDocument
static TiXmlDocument* getDocument(const char* fileName)
{
SE_ResourceManager* resourceManager = SE_Application::getInstance()->getResourceManager();
std::string filePath = resourceManager->getLayoutPath() + SE_SEP + fileName;
TiXmlDocument* doc = new TiXmlDocument(filePath.c_str());
doc->LoadFile();
if(doc->Error() && doc->ErrorId() ==TiXmlBase::TIXML_ERROR_OPENING_FILE)
{
OUTSTRING("can not open xml file: %s\n", filePath);
return NULL;
}
return doc;
}
示例13: se_loadResource
static jint se_loadResource(JNIEnv* env, jobject obj, jstring scenePath, jstring dataPath) {
//Invoke by load thread
//All resource will be insert in a loader,not resource manager
SE_ResourceManager* loader = new SE_ResourceManager();
const char* scenePath8 = env->GetStringUTFChars(scenePath, NULL);
const char* dataPath8 = env->GetStringUTFChars(dataPath, NULL);
SE_Spatial* s = loader->loadScene(scenePath8);
s->setCBFLoader(loader);
loader->loadBaseData(NULL, dataPath8);
env->ReleaseStringUTFChars(dataPath, dataPath8);
env->ReleaseStringUTFChars(scenePath, scenePath8);
return (int)s;
}
示例14: se_savePixelsData
static void se_savePixelsData(JNIEnv *env, jobject obj, jstring savePath, jstring imageKey) {
const char* imageKey8 = env->GetStringUTFChars(imageKey, 0);
const char* savePath8 = env->GetStringUTFChars(savePath, 0);
SE_ImageDataID imageDataid(imageKey8);
SE_ResourceManager *resourceManager = SE_Application::getInstance()->getResourceManager();
SE_ImageData* imgd = resourceManager->getImageData(imageDataid);
if (imgd) {
SE_File fbase(savePath8, SE_File::WRITE);
fbase.write(imgd->getData(), imgd->getHeight() * imgd->getBytesPerRow());
LOGI("SEHome:#################savePixelsData success!!!");
}
env->ReleaseStringUTFChars(imageKey, imageKey8);
env->ReleaseStringUTFChars(savePath, savePath8);
}
示例15: getImageData
SE_ImageData* SE_Image::getImageData(const SE_ImageUnit& imageUnit)
{
SE_ResourceManager* resourceManager = SE_Application::getInstance()->getResourceManager();
SE_ImageData* imageData = NULL;
if(imageUnit.isValid())
{
imageData = resourceManager->getImageData(imageUnit.imageDataID.getStr());
if(!imageData)
{
imageData = resourceManager->loadImage(imageUnit.imageDataID.getStr());
}
}
return imageData;
}