本文整理汇总了C++中SE_Scene类的典型用法代码示例。如果您正苦于以下问题:C++ SE_Scene类的具体用法?C++ SE_Scene怎么用?C++ SE_Scene使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SE_Scene类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: se_setRoot
static void se_setRoot(JNIEnv* env, jobject obj, jstring rootName, jint index)
{
jstring sceneName = (jstring)env->GetObjectField(obj, sceneNameID);
const char* sceneName8 = env->GetStringUTFChars(sceneName, 0);
SE_Scene* scene = findScene(sceneName8);
if (scene)
{
const char* rootName8 = env->GetStringUTFChars(rootName, 0);
SE_Spatial* spatial = SE_Application::getInstance()->getSceneManager()->findSpatialByName(rootName8, index);
if (!spatial) {
spatial = new SE_CommonNode(SE_ID::createSpatialID());
spatial->setIsEntirety(true);
spatial->setSpatialName(rootName8);
spatial->setCloneIndex(index);
//save spatial name to map
/*SE_SpatialManager* sm = SE_Application::getInstance()->getSpatialManager();
sm->set(spatial->getSpatialName(),spatial);*/
spatial->updateWorldLayer();
spatial->updateWorldTransform();
spatial->updateBoundingVolume();
}
scene->setRoot(spatial);
env->ReleaseStringUTFChars(rootName, rootName8);
}
env->ReleaseStringUTFChars(sceneName, sceneName8);
}
示例2: SE_Geometry
SE_Spatial *SE_Geometry::clone(SE_SimObject *srcobj, int index)
{
#if 0
SE_Geometry * dest = new SE_Geometry();
SE_SimObject* destobj = srcobj->clone(index);
std::string srcobjname = srcobj->getName();
//attach obj
SE_SimObjectManager* simObjectManager = SE_Application::getInstance()->getSimObjectManager();
SE_SimObjectID id = SE_ID::createSimObjectID();
destobj->setID(id);
simObjectManager->set(id, destobj);
//set spatial property
SE_Spatial *srcSpatial = srcobj->getSpatial();
SE_SpatialID destSpatialID = SE_ID::createSpatialID();
dest->setSpatialID(destSpatialID);
dest->setBVType(srcSpatial->getBVType());
SE_Vector3f a = srcSpatial->getLocalTranslate();
dest->setLocalTranslate(a);
dest->setLocalRotate(srcSpatial->getLocalRotate());
dest->setLocalScale(srcSpatial->getLocalScale());
dest->setPrevMatrix(srcSpatial->getPrevMatrix());
dest->setPostMatrix(srcSpatial->getPostMatrix());
dest->setParent(srcSpatial->getParent());
dest->setLocalLayer(srcSpatial->getLocalLayer());
//set render state
dest->setRenderState(DEPTHTESTSTATE ,this->getRenderState(DEPTHTESTSTATE));
dest->attachSimObject(destobj);
//SE_Application::getInstance()->getSceneManager()->updateSpatialIDMap();
SE_Scene* scene = srcSpatial->getScene();
scene->addSpatial(srcSpatial->getParent(), dest);
srcSpatial->getParent()->updateWorldTransform();
srcSpatial->getParent()->updateBoundingVolume();
srcSpatial->getParent()->updateRenderState();
srcSpatial->getParent()->updateWorldLayer();
//return clone object
return dest;
#endif
return NULL;
}
示例3: se_addLightToScene
static void se_addLightToScene(JNIEnv* env, jobject obj, jstring lightName, jfloatArray lightpos, jfloatArray lightdir,jfloatArray spotdata,jint lighttype)
{
jstring sceneName = (jstring)env->GetObjectField(obj, sceneNameID);
const char* sceneName8 = env->GetStringUTFChars(sceneName, 0);
SE_Scene* scene = findScene(sceneName8);
if(scene)
{
float* lpos = env->GetFloatArrayElements(lightpos, 0);
float* ldir = env->GetFloatArrayElements(lightdir, 0);
float* lspotdata = env->GetFloatArrayElements(spotdata, 0);
SE_Vector3f pos = SE_Vector3f(lpos[0],lpos[1],lpos[2]);
SE_Vector3f dir = SE_Vector3f(ldir[0],ldir[1],ldir[2]);
SE_Light::LightType lt = (SE_Light::LightType)lighttype;
SE_Light* light = new SE_Light();
float att = lpos[3];
float spot_cutoff = lspotdata[0];
float spot_exp = lspotdata[1];
light->setLightType(lt);
light->setLightPos(pos);
light->setAttenuation(att);//point attenuation from 0 to 1.0, 0 means no attenuation
light->setLightDir(dir);
const char* lightName8 = env->GetStringUTFChars(lightName, 0);
light->setLightName(lightName8);
light->setSpotLightCutOff(spot_cutoff);
light->setSpotLightExp(spot_exp);
light->setDirLightStrength(1.0);
scene->addLightToScene(light);
env->ReleaseFloatArrayElements(lightpos, lpos, 0);
env->ReleaseFloatArrayElements(lightdir, ldir, 0);
env->ReleaseStringUTFChars(lightName, lightName8);
env->ReleaseFloatArrayElements(spotdata, ldir, 0);
}
env->ReleaseStringUTFChars(sceneName, sceneName8);
}
示例4: getMotionEventScene
SE_SceneManager::_PointedData SE_SceneManager::getPointedData(float x, float y)
{
std::list<SE_Scene*> sceneMotionEvent = getMotionEventScene();
std::list<SE_Scene*>::iterator itScene;
SE_SceneRenderSeq sceneRenderSeq = -1;
SE_Element* pointedElement = NULL;
SE_Scene* pointedScene = NULL;
SE_ElementManager* elementManager = SE_Application::getInstance()->getElementManager();
for(itScene = sceneMotionEvent.begin() ; itScene != sceneMotionEvent.end(); itScene++)
{
SE_Scene* scene = *itScene;
SE_Element* e = scene->getPointedElement(x, y);
if(e)
{
LOGI("### pointed element = %s ## \n", e->getName().getStr());
if(e->getSceneRenderSeq() > sceneRenderSeq)
{
pointedElement = e;
pointedScene = scene;
sceneRenderSeq = e->getSceneRenderSeq();
}
}
}
return _PointedData(pointedScene, pointedElement);
}
示例5: getUICamera
SE_Camera* SE_Application::getUICamera()
{
SE_Scene* scene = mSceneManager->getScene(SE_FRAMEBUFFER_SCENE,"GUI");
if (scene)
{
return scene->getCamera();
}
return NULL;
}
示例6: setCamera
/*
void SE_Application::setCamera(int index, SE_Camera* camera)
{
if(index < 0 || index >= MAX_CAMERA_NUM)
return;
SE_Camera* c = mCameraArray[index];
if(c)
delete c;
mCameraArray[index] = camera;
}
SE_Camera* SE_Application::getCamera(int index)
{
if(index < 0 || index >= MAX_CAMERA_NUM)
return NULL;
return mCameraArray[index];
}
void SE_Application::setCurrentCamera(int index)
{
if(index < 0 || index >= MAX_CAMERA_NUM)
return;
mCurrentCamera = mCameraArray[index];
}
*/
SE_Camera* SE_Application::getCurrentCamera()
{
//return mCurrentCamera;
SE_Scene* scene = mSceneManager->getMainScene();
if (scene)
{
return scene->getCamera();
}
return NULL;
}
示例7: se_setSceneType
/**
*set scene manager
*
*@type the type of scene manager
*/
static void se_setSceneType(JNIEnv* env, jobject obj, jint type)
{
jstring sceneName = (jstring)env->GetObjectField(obj, sceneNameID);
const char* sceneName8 = env->GetStringUTFChars(sceneName, 0);
SE_Scene* scene = findScene(sceneName8);
if(scene)
{
scene->setSceneManagerType(type);
}
env->ReleaseStringUTFChars(sceneName, sceneName8);
}
示例8: se_refreshSceneLightStatus
static void se_refreshSceneLightStatus(JNIEnv* env, jobject obj)
{
jstring sceneName = (jstring)env->GetObjectField(obj, sceneNameID);
const char* sceneName8 = env->GetStringUTFChars(sceneName, 0);
SE_Scene* scene = findScene(sceneName8);
if(scene)
{
scene->refreshSceneLightStatus();
}
env->ReleaseStringUTFChars(sceneName, sceneName8);
}
示例9: se_setLowestBrightness
static void se_setLowestBrightness(JNIEnv* env, jobject obj, jfloat lowestBrightnesss)
{
jstring sceneName = (jstring)env->GetObjectField(obj, sceneNameID);
const char* sceneName8 = env->GetStringUTFChars(sceneName, 0);
SE_Scene* scene = findScene(sceneName8);
if(scene)
{
scene->setLowestEnvBrightness(lowestBrightnesss);
}
env->ReleaseStringUTFChars(sceneName, sceneName8);
}
示例10: se_removeAllLight
static void se_removeAllLight(JNIEnv* env, jobject obj, jint lighttype)
{
jstring sceneName = (jstring)env->GetObjectField(obj, sceneNameID);
const char* sceneName8 = env->GetStringUTFChars(sceneName, 0);
SE_Scene* scene = findScene(sceneName8);
if(scene)
{
scene->removeAllLights();
}
env->ReleaseStringUTFChars(sceneName, sceneName8);
}
示例11: 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
{
}
}
示例12: se_setIsTranslucent
static void se_setIsTranslucent(JNIEnv* env, jobject obj, jboolean translucent)
{
jstring sceneName = (jstring)env->GetObjectField(obj, sceneNameID);
const char* sceneName8 = env->GetStringUTFChars(sceneName, 0);
SE_Scene* scene = findScene(sceneName8);
if (scene)
{
scene->setIsTranslucent(translucent);
}
env->ReleaseStringUTFChars(sceneName, sceneName8);
}
示例13: se_removeLightFromScene
static void se_removeLightFromScene(JNIEnv* env, jobject obj, jstring lightName) {
jstring sceneName = (jstring)env->GetObjectField(obj, sceneNameID);
const char* sceneName8 = env->GetStringUTFChars(sceneName, 0);
SE_Scene* scene = findScene(sceneName8);
if(scene)
{
const char* lightName8 = env->GetStringUTFChars(lightName, 0);
scene->removeLight(lightName8);
env->ReleaseStringUTFChars(lightName, lightName8);
}
env->ReleaseStringUTFChars(sceneName, sceneName8);
}
示例14: 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);
}
示例15: se_setRoot_II
static void se_setRoot_II(JNIEnv* env, jobject obj, jint object)
{
if (object > 0)
{
jstring sceneName = (jstring)env->GetObjectField(obj, sceneNameID);
const char* sceneName8 = env->GetStringUTFChars(sceneName, 0);
SE_Scene* scene = findScene(sceneName8);
if (scene)
{
scene->setRoot((SE_Spatial*)object);
}
env->ReleaseStringUTFChars(sceneName, sceneName8);
}
}