本文整理汇总了C++中IScene类的典型用法代码示例。如果您正苦于以下问题:C++ IScene类的具体用法?C++ IScene怎么用?C++ IScene使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IScene类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateShader
bool DirectxEngine::UpdateShader(const MeshData& mesh,
const IScene& scene,
bool alphaBlend,
float timer)
{
const int index = mesh.ShaderID();
if (index != NO_INDEX)
{
auto& shader = m_data->shaders[index];
if(index != m_data->selectedShader)
{
SetSelectedShader(index);
SendLights(scene.Lights());
shader->UpdateConstantMatrix("viewProjection", m_data->viewProjection);
shader->UpdateConstantFloat("cameraPosition", &m_data->cameraPosition.x, 3);
shader->UpdateConstantFloat("depthNear", &scene.Post().DepthNear(), 1);
shader->UpdateConstantFloat("depthFar", &scene.Post().DepthFar(), 1);
if (index == WATER_SHADER)
{
shader->UpdateConstantFloat("timer", &timer, 1);
}
}
SendTextures(mesh.TextureIDs());
SetRenderState(mesh.BackfaceCull(), m_data->isWireframe);
EnableAlphaBlending(alphaBlend, false);
return true;
}
return false;
}
示例2:
bool POD3DLayer::OnExit()
{
IScene* scene = SceneManager::Instance().Current();
auto camera= ResolutionAdapter::Instance().DefaultCamera2D();
scene->SetCamera(camera);
return true;
}
示例3: GetGLProgram
bool ParaEngine::CEffectFileOpenGL::begin(bool bApplyParam /*= true*/, DWORD flag /*= 0*/)
{
IScene* pScene = CGlobals::GetEffectManager()->GetScene();
auto program = GetGLProgram();
if (program != 0)
{
if (m_programs.size() == 1)
program->use();
else
{
// TODO: multiple pass effect in opengl is implemented as shader arrays.
// uniform values are currently NOT shared among different passes like directX.
// hence DO NOT set any uniform between begin() and beginPass().
// TODO: In future: uniform values should be cached until Commit() is called.
program->use();
}
if (bApplyParam)
{
// set the lighting parameters
// from the global light manager
applyGlobalLightingData(pScene->GetSunLight());
// set the camera matrix
applyCameraMatrices();
}
m_bIsBegin = true;
return true;
}
else
return false;
}
示例4: begin
bool CEffectFileDirectX::begin(bool bApplyParam, DWORD dwFlag, bool bForceBegin )
{
IScene* pScene = CGlobals::GetEffectManager()->GetScene();
if(m_pEffect!=NULL)
{
if(bApplyParam)
{
// set the lighting parameters
// from the global light manager
applyGlobalLightingData(pScene->GetSunLight());
// set the camera matrix
applyCameraMatrices();
}
if(bForceBegin|| !m_bSharedMode)
{
HRESULT result = m_pEffect->Begin(0, dwFlag);
if( SUCCEEDED( result ) )
{
m_bIsBegin = true;
return true;
}
else
{
OUTPUT_LOG("error: CEffectFileDirectX::begin failed: %s \n", m_filename.c_str());
return false;
}
}
return true;
}
else
return false;
}
示例5: deserialize
virtual bool deserialize(UniverseContext& ctx,
InputBlob& serializer) override
{
SerializedEngineHeader header;
serializer.read(header);
if (header.m_magic != SERIALIZED_ENGINE_MAGIC)
{
g_log_error.log("engine") << "Wrong or corrupted file";
return false;
}
if (header.m_version > SerializedEngineVersion::LATEST)
{
g_log_error.log("engine") << "Unsupported version";
return false;
}
if (!hasSerializedPlugins(serializer))
{
return false;
}
g_path_manager.deserialize(serializer);
ctx.m_universe->deserialize(serializer);
ctx.m_hierarchy->deserialize(serializer);
m_plugin_manager->deserialize(serializer);
int32_t scene_count;
serializer.read(scene_count);
for (int i = 0; i < scene_count; ++i)
{
char tmp[32];
serializer.readString(tmp, sizeof(tmp));
IScene* scene = ctx.getScene(crc32(tmp));
scene->deserialize(serializer);
}
g_path_manager.clear();
return true;
}
示例6: Enter
bool HelloWorldLayer::Enter()
{
auto winSize = ResolutionAdapter::Instance().WinSize();
auto* camera = CameraFactory::Instance().CreateFromModel("Camera01", "Scene.pod", winSize, false);
IScene* scene = (IScene*)mParent;
scene->SetCamera(camera);
return true;
}
示例7: Render
void DirectxEngine::Render(const IScene& scene, float timer)
{
RenderSceneMap(scene, timer);
RenderPreEffects(scene.Post());
RenderBlur(scene.Post());
RenderPostProcessing(scene.Post());
m_data->swapchain->Present(0, 0);
}
示例8:
void
PhysicsManager::eventReceived(const std::string & sender, const std::string & eventType, const std::shared_ptr<IEventData>& evt) {
if (m_PhysInst && eventType == "SCENE_TRANSFORM") {
std::string * strEvt = (std::string*) evt->getData();
IScene * scene = RENDERMANAGER->getScene(*strEvt).get();
m_PhysInst->setSceneTransform(scene->getName(), (float *)scene->getTransform().getMatrix());
}
}
示例9: RETURN_IF_FALSE
void InputManager::UpdateInputPassingRecursively()
{
RETURN_IF_FALSE(mIsDirty);
IScene* scene = SceneManager::Instance().RunningScene();
scene->ResetInputPassing();
FOR_EACH_COLLECTION(i, mDispatchers)
{
INode* node = *i;
node->EnableInputPassing();
}
示例10: factory
bool ScenesStack::push(FunctSceneFactory factory, SceneArguments const& args) {
IScene *scene = factory(args);
if (!scene->initialize()) {
delete scene;
return false;
}
else {
m_stack.push(scene);
return true;
}
}
示例11: deserialize
bool deserialize(UniverseContext& ctx, InputBlob& serializer) override
{
SerializedEngineHeader header;
serializer.read(header);
if (header.m_magic != SERIALIZED_ENGINE_MAGIC)
{
g_log_error.log("engine") << "Wrong or corrupted file";
return false;
}
if (header.m_version > SerializedEngineVersion::LATEST)
{
g_log_error.log("engine") << "Unsupported version";
return false;
}
if (!hasSerializedPlugins(serializer))
{
return false;
}
if (header.m_version > SerializedEngineVersion::SCENE_VERSION_CHECK &&
!hasSupportedSceneVersions(serializer, ctx))
{
return false;
}
m_path_manager.deserialize(serializer);
ctx.m_universe->deserialize(serializer);
if (header.m_version <= SerializedEngineVersion::HIERARCHY_COMPONENT)
{
ctx.getScene(HIERARCHY_HASH)->deserialize(serializer, 0);
}
m_plugin_manager->deserialize(serializer);
int32 scene_count;
serializer.read(scene_count);
for (int i = 0; i < scene_count; ++i)
{
char tmp[32];
serializer.readString(tmp, sizeof(tmp));
IScene* scene = ctx.getScene(crc32(tmp));
int scene_version = -1;
if (header.m_version > SerializedEngineVersion::SCENE_VERSION)
{
serializer.read(scene_version);
}
scene->deserialize(serializer, scene_version);
}
m_path_manager.clear();
return true;
}
示例12: OnBnClickedButtonDeleteterrain
void DlgTerrainHeight::OnBnClickedButtonDeleteterrain()
{
IScene *scene = TerrainEditorPlugin::getSingleton().getWorldEditor()->getMapManager()->getScene();
// 检查是否已经创建
if(!scene->hasSceneObject("Terrain_0_0"))
{
AfxMessageBox("地形已经不存在,删除失败。");
return;
}
if(AfxMessageBox("是否真的要删除地形?" , MB_YESNOCANCEL) == IDYES)
{
TerrainEditorPlugin::getSingleton().deactivateTerrain();
scene->destroySceneObject("Terrain_0_0");
}
}
示例13: applyWorldMatrices
void CEffectFileDirectX::applyWorldMatrices()
{
IScene* pScene = CGlobals::GetEffectManager()->GetScene();
CBaseCamera* pCamera = pScene->GetCurrentCamera();
if (pCamera)
{
const Matrix4* pWorld = &(CGlobals::GetEffectManager()->GetWorldTransform());
const Matrix4* pView = &(CGlobals::GetEffectManager()->GetViewTransform());
const Matrix4* pProj = &(CGlobals::GetEffectManager()->GetProjTransform());
Matrix4 ViewProj;
// set the world matrix
if (isMatrixUsed(k_worldMatrix))
{
setMatrix(k_worldMatrix, pWorld);
}
// set the world inverse matrix
if (isMatrixUsed(k_worldInverseMatrix))
{
Matrix4 mWorldInverse;
mWorldInverse = pWorld->inverse();
setMatrix(k_worldInverseMatrix, &mWorldInverse);
}
// set the world view matrix
if (isMatrixUsed(k_worldViewMatrix))
{
Matrix4 mWorldView;
ParaMatrixMultiply(&mWorldView, pWorld, pView);
setMatrix(k_worldViewMatrix, &mWorldView);
}
// set the world view projection matrix
if (isMatrixUsed(k_worldViewProjMatrix))
{
ParaMatrixMultiply(&ViewProj, pView, pProj);
Matrix4 mWorldViewProj;
ParaMatrixMultiply(&mWorldViewProj, pWorld, &ViewProj);
setMatrix(k_worldViewProjMatrix, &mWorldViewProj);
}
}
}
示例14: initGL
void RiftAppSkeleton::initGL()
{
for (std::vector<IScene*>::iterator it = m_scenes.begin();
it != m_scenes.end();
++it)
{
IScene* pScene = *it;
if (pScene != NULL)
{
pScene->initGL();
}
}
m_presentFbo.initProgram("presentfbo");
_initPresentFbo();
m_presentDistMeshL.initProgram("presentmesh");
m_presentDistMeshR.initProgram("presentmesh");
// Init the present mesh VAO *after* initVR, which creates the mesh
// sensible initial value?
allocateFBO(m_renderBuffer, 800, 600);
m_fm.Init();
}
示例15: VERIFY_MESSAGE_SIZE
DWORD COctreeSceneManager::OnRemoveSceneObject( DWORD size, void* params )
{
VERIFY_MESSAGE_SIZE(sizeof(SCENEOBJECTPARAMS), size);
SCENEOBJECTPARAMS *sop = (SCENEOBJECTPARAMS *)params;
if (sop->bBoundedObject)
{
ISceneNode *pSceneNode = sop->pObject->GetSceneNode();
if (pSceneNode)
{
pSceneNode->RemoveObject( sop->pObject );
}
}
else
{
IScene *pScene = sop->pObject->GetScene();
if (pScene)
{
pScene->RemoveGlobalObject( sop->pObject );
}
}
return MSG_HANDLED_PROCEED;
}