本文整理汇总了C++中CreateScene函数的典型用法代码示例。如果您正苦于以下问题:C++ CreateScene函数的具体用法?C++ CreateScene怎么用?C++ CreateScene使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CreateScene函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateScene
void FGLRenderer::DrawScene(int drawmode)
{
static int recursion=0;
if (camera != nullptr)
{
ActorRenderFlags savedflags = camera->renderflags;
if (drawmode != DM_PORTAL && !r_showviewer)
{
camera->renderflags |= RF_INVISIBLE;
}
CreateScene();
camera->renderflags = savedflags;
}
else
{
CreateScene();
}
GLRenderer->mClipPortal = NULL; // this must be reset before any portal recursion takes place.
RenderScene(recursion);
// Handle all portals after rendering the opaque objects but before
// doing all translucent stuff
recursion++;
GLPortal::EndFrame();
recursion--;
RenderTranslucent();
}
示例2: Window3
GeometryShadersWindow::GeometryShadersWindow(Parameters& parameters)
:
Window3(parameters)
{
if (!SetEnvironment() || !CreateScene())
{
parameters.created = false;
return;
}
mEngine->SetClearColor({ 1.0f, 1.0f, 1.0f, 1.0f });
InitializeCamera();
mCamera->SetFrustum(60.0f, GetAspectRatio(), 0.1f, 100.0f);
Vector4<float> camPosition{ 2.8f, 0.0f, 0.0f, 1.0f };
Vector4<float> camDVector{ -1.0f, 0.0f, 0.0f, 0.0f };
Vector4<float> camUVector{ 0.0f, 0.0f, 1.0f, 0.0f };
Vector4<float> camRVector = Cross(camDVector, camUVector);
mCamera->SetFrame(camPosition, camDVector, camUVector, camRVector);
#if defined(SAVE_RENDERING_TO_DISK)
mTarget = std::make_shared<DrawTarget>(1, DF_R8G8B8A8_UNORM, mXSize,
mYSize);
mTarget->GetRTTexture(0)->SetCopyType(Resource::COPY_STAGING_TO_CPU);
#endif
}
示例3: GetAspectRatio
//----------------------------------------------------------------------------
bool IntersectConvexPolyhedra::OnInitialize ()
{
if (!WindowApplication3::OnInitialize())
{
return false;
}
// Set up the camera.
mCamera->SetFrustum(60.0f, GetAspectRatio(), 0.1f, 1000.0f);
APoint camPosition(16.0f, 0.0f, 0.0f);
AVector camDVector(-1.0f, 0.0f, 0.0f);
AVector camUVector(0.0f, 0.0f, 1.0f);
AVector camRVector = camDVector.Cross(camUVector);
mCamera->SetFrame(camPosition, camDVector, camUVector, camRVector);
CreateScene();
// Initial update of objects.
mScene->Update();
// Initial culling of scene.
mCuller.SetCamera(mCamera);
mCuller.ComputeVisibleSet(mScene);
InitializeCameraMotion(0.01f, 0.001f);
InitializeObjectMotion(mScene);
return true;
}
示例4: GetAspectRatio
//----------------------------------------------------------------------------
bool BouncingSpheres::OnInitialize ()
{
if (!WindowApplication3::OnInitialize())
{
return false;
}
// Set up the camera.
mCamera->SetFrustum(60.0f, GetAspectRatio(), 1.0f, 1000.0f);
float angle = 0.02f*Mathf::PI;
float cs = Mathf::Cos(angle), sn = Mathf::Sin(angle);
APoint camPosition(27.5f, 8.0f, 8.9f);
AVector camDVector(-cs, 0.0f, -sn);
AVector camUVector(-sn, 0.0f, cs);
AVector camRVector = camDVector.Cross(camUVector);
mCamera->SetFrame(camPosition, camDVector, camUVector, camRVector);
CreateScene();
// Initial update of objects.
mScene->Update();
// Initialize balls with correct transformations.
PhysicsTick();
// Initial culling of scene.
mCuller.SetCamera(mCamera);
mCuller.ComputeVisibleSet(mScene);
return true;
}
示例5: main
int main (int argc, char *argv[]) {
try {
timer mainStartTime = gettimer();
global_window_title = window_title_string (argc, (const char**)argv);
argoptions opt = ParseCommandLine(argc, (const char**)argv);
if ( CreateScene(opt) != 0 )
return -1;
tachyon_video tachyon;
tachyon.threaded = true;
tachyon.init_console();
tachyon.title = global_window_title;
// always using window even if(!global_usegraphics)
global_usegraphics =
tachyon.init_window(global_xwinsize, global_ywinsize);
if(!tachyon.running)
return -1;
video = &tachyon;
tachyon.main_loop();
utility::report_elapsed_time(timertime(mainStartTime, gettimer()));
return 0;
} catch ( std::exception& e ) {
std::cerr<<"error occurred. error text is :\"" <<e.what()<<"\"\n";
return 1;
}
}
示例6: WriteHelper
BOOL CSceneManager::OnCmdCreateSceneReq( UINT16 wCommandID, UINT64 u64ConnID, CBufferHelper *pBufferHelper )
{
StSvrCreateSceneReq CreateSceneReq;
pBufferHelper->Read(CreateSceneReq);
StSvrCreateSceneAck CreateSceneAck;
CreateSceneAck.dwCreateParam = CreateSceneReq.CreateParam;
CreateSceneAck.dwSceneID = CreateSceneReq.dwSceneID;
CreateSceneAck.dwServerID= CGameService::GetInstancePtr()->GetServerID();
if (!CreateScene(CreateSceneReq.dwSceneID))
{
ASSERT_FAIELD;
CreateSceneAck.dwAckCode = E_FAILED;
}
else
{
CreateSceneAck.dwAckCode = E_SUCCESSED;
}
CBufferHelper WriteHelper(TRUE, &m_WriteBuffer);
WriteHelper.BeginWrite(CMD_SVR_CREATE_SCENE_ACK, 0, 0);
WriteHelper.Write(CreateSceneAck);
WriteHelper.EndWrite();
ServiceBase::GetInstancePtr()->SendCmdToConnection(u64ConnID, &m_WriteBuffer);
return TRUE;
}
示例7: GetAspectRatio
//----------------------------------------------------------------------------
bool RoughPlaneSolidBox::OnInitialize ()
{
if (!WindowApplication3::OnInitialize())
{
return false;
}
// Set up the camera.
mCamera->SetFrustum(60.0f, GetAspectRatio(), 1.0f, 100.0f);
float angle = 0.1f*Mathf::PI;
float cs = Mathf::Cos(angle), sn = Mathf::Sin(angle);
APoint camPosition(17.695415f, 0.0f, 6.4494629f);
AVector camDVector(-cs, 0.0f, -sn);
AVector camUVector(-sn, 0.0f, cs);
AVector camRVector = camDVector.Cross(camUVector);
mCamera->SetFrame(camPosition, camDVector, camUVector, camRVector);
InitializeModule();
CreateScene();
// Initial update of objects.
mScene->Update();
// Initial culling of scene.
mCuller.SetCamera(mCamera);
mCuller.ComputeVisibleSet(mScene);
InitializeCameraMotion(0.001f, 0.001f);
InitializeObjectMotion(mScene);
return true;
}
示例8: Camera
//----------------------------------------------------------------------------
bool ExtremalQuery::OnInitialize ()
{
if (!WindowApplication3::OnInitialize())
{
return false;
}
// Set up an orthogonal camera. This projection type is used to make it
// clear that the displayed extreme points really are extreme! (The
// perspective projection is deceptive.)
mCamera = new0 Camera(false);
mRenderer->SetCamera(mCamera);
mCamera->SetFrustum(1.0f, 1000.0f, -1.5f, 1.5f, -2.0, 2.0f);
APoint camPosition(4.0f, 0.0f, 0.0f);
AVector camDVector(-1.0f, 0.0f, 0.0f);
AVector camUVector(0.0f, 0.0f, 1.0f);
AVector camRVector = camDVector.Cross(camUVector);
mCamera->SetFrame(camPosition, camDVector, camUVector, camRVector);
// Set up the scene.
CreateScene();
// Initial update of objects.
mScene->Update();
// Initial culling of scene.
mCuller.SetCamera(mCamera);
mCuller.ComputeVisibleSet(mScene);
InitializeObjectMotion(mScene);
return true;
}
示例9: GetAspectRatio
//----------------------------------------------------------------------------
bool NonuniformScale::OnInitialize ()
{
if (!WindowApplication3::OnInitialize())
{
return false;
}
// Set up the camera.
mCamera->SetFrustum(60.0f, GetAspectRatio(), 1.0f, 100.0f);
float cs = 0.866025f, sn = 0.5f;
APoint camPosition(0.0f, -4.0f, 2.0f);
AVector camDVector(0.0f, cs, -sn);
AVector camUVector(0.0f, sn, cs);
AVector camRVector = camDVector.Cross(camUVector);
mCamera->SetFrame(camPosition, camDVector, camUVector, camRVector);
CreateScene();
// Initial update of objects.
mScene->Update();
// Initial culling of scene.
mCuller.SetCamera(mCamera);
mCuller.ComputeVisibleSet(mScene);
InitializeCameraMotion(0.01f, 0.001f);
InitializeObjectMotion(mScene);
return true;
}
示例10: QGLWidget
ModelViewGadgetWidget::ModelViewGadgetWidget(QWidget *parent)
: QGLWidget(new GLC_Context(QGLFormat(QGL::SampleBuffers)), parent)
, m_Light()
, m_World()
, m_GlView()
, m_MoverController()
, m_ModelBoundingBox()
, m_MotionTimer()
, acFilename()
, bgFilename()
, vboEnable(false)
{
connect(&m_GlView, SIGNAL(updateOpenGL()), this, SLOT(updateGL()));
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
m_Light.setPosition(4000.0, 40000.0, 80000.0);
// m_GlView.setBackgroundColor(Qt::white);
m_Light.setAmbientColor(Qt::lightGray);
m_GlView.cameraHandle()->setDefaultUpVector(glc::Z_AXIS);
m_GlView.cameraHandle()->setRearView();
QColor repColor;
repColor.setRgbF(1.0, 0.11372, 0.11372, 0.0);
m_MoverController = GLC_Factory::instance()->createDefaultMoverController(repColor, &m_GlView);
CreateScene();
// Get required UAVObjects
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
attState = AttitudeActual::GetInstance(objManager);
connect(&m_MotionTimer, SIGNAL(timeout()), this, SLOT(updateAttitude()));
}
示例11: Window
//----------------------------------------------------------------------------
PerformanceAMDWindow::PerformanceAMDWindow(Parameters& parameters)
:
Window(parameters),
mTextColor({ 0.0f, 0.0f, 0.0f, 1.0f }),
mPerformance(mEngine->GetDevice())
{
if (!SetEnvironment())
{
parameters.created = false;
return;
}
CreateCamera();
CreateTextureGenerator();
CreateScene();
// Disable back-face culling.
mNoCullingState.reset(new RasterizerState());
mNoCullingState->cullMode = RasterizerState::CULL_NONE;
mEngine->SetRasterizerState(mNoCullingState);
mPerformance.SaveCounterInformation("AMD7970Counters.txt");
mPerformance.Register(Listener);
mPerformance.SetAllCounters();
UpdateCW();
}
示例12: CreateScene
//----------------------------------------------------------------------------
bool GelatinCube::OnInitialize ()
{
if (!WindowApplication3::OnInitialize())
{
return false;
}
CreateScene();
// Center-and-fit for camera viewing.
mScene->Update();
mTrnNode->LocalTransform.SetTranslate(-mScene->WorldBound.GetCenter());
mCamera->SetFrustum(60.0f, GetAspectRatio(), 0.1f, 100.0f);
AVector camDVector(0.0f, 1.0f, 0.0f);
AVector camUVector(0.0f, 0.0f, 1.0f);
AVector camRVector = camDVector.Cross(camUVector);
APoint camPosition = APoint::ORIGIN -
2.0f*mScene->WorldBound.GetRadius()*camDVector;
mCamera->SetFrame(camPosition, camDVector, camUVector, camRVector);
// Initial update of objects.
mScene->Update();
// Initial culling of scene.
mCuller.SetCamera(mCamera);
mCuller.ComputeVisibleSet(mScene);
// Sort the box faces based on current camera parameters.
mBox->SortFaces(mCamera->GetDVector());
InitializeCameraMotion(0.01f, 0.001f);
InitializeObjectMotion(mScene);
return true;
}
示例13: GetAspectRatio
//----------------------------------------------------------------------------
bool Terrains::OnInitialize ()
{
if (!WindowApplication3::OnInitialize())
{
return false;
}
// Set up the camera. Position the camera in the middle of page[0][0].
// Orient it to look diagonally across the terrain pages.
mCamera->SetFrustum(60.0f, GetAspectRatio(), 1.0f, 1500.0f);
APoint camPosition(64.0f, 64.0f, mHeightAboveTerrain);
AVector camDVector(Mathf::INV_SQRT_2, Mathf::INV_SQRT_2, 0.0f);
AVector camUVector(0.0f, 0.0f, 1.0f);
AVector camRVector = camDVector.Cross(camUVector);
mCamera->SetFrame(camPosition, camDVector, camUVector, camRVector);
CreateScene();
// Initial update of objects.
mScene->Update();
// Initial culling of scene.
mCuller.SetCamera(mCamera);
mCuller.ComputeVisibleSet(mScene);
InitializeCameraMotion(1.0f, 0.01f);
MoveForward();
return true;
}
示例14: Window3
BSplineSurfaceFitterWindow::BSplineSurfaceFitterWindow(Parameters& parameters)
:
Window3(parameters)
{
if (!SetEnvironment())
{
parameters.created = false;
return;
}
mNoCullState = std::make_shared<RasterizerState>();
mNoCullState->cullMode = RasterizerState::CULL_NONE;
mNoCullWireState = std::make_shared<RasterizerState>();
mNoCullWireState->cullMode = RasterizerState::CULL_NONE;
mNoCullWireState->fillMode = RasterizerState::FILL_WIREFRAME;
mBlendState = std::make_shared<BlendState>();
mBlendState->target[0].enable = true;
mBlendState->target[0].srcColor = BlendState::BM_SRC_ALPHA;
mBlendState->target[0].dstColor = BlendState::BM_INV_SRC_ALPHA;
mBlendState->target[0].srcAlpha = BlendState::BM_SRC_ALPHA;
mBlendState->target[0].dstAlpha = BlendState::BM_INV_SRC_ALPHA;
mEngine->SetRasterizerState(mNoCullState);
mEngine->SetClearColor({ 0.0f, 0.5f, 0.75f, 1.0f });
CreateScene();
InitializeCamera();
}
示例15: main
int main (int argc, char *argv[]) {
try {
if ( CreateScene() != 0 ) return -1;
tachyon_video tachyon;
tachyon.threaded = true;
tachyon.init_console();
global_usegraphics = tachyon.init_window(global_xwinsize, global_ywinsize);
if(!tachyon.running) return -1;
//TODO: add a demo loop.
video = &tachyon;
if (video)video->running = true;
memset(g_pImg, 0, sizeof(unsigned int) * global_xsize * global_ysize);
tachyon.main_loop();
video->running=false;
return NULL;
} catch ( std::exception& e ) {
std::cerr<<"error occurred. error text is :\"" <<e.what()<<"\"\n";
return 1;
}
}