本文整理汇总了C++中Space::layout方法的典型用法代码示例。如果您正苦于以下问题:C++ Space::layout方法的具体用法?C++ Space::layout怎么用?C++ Space::layout使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Space
的用法示例。
在下文中一共展示了Space::layout方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ExperimentalApp
ExperimentalApp() : GLFWApp(1280, 800, "Glass Material App")
{
igm.reset(new gui::ImGuiManager(window));
gui::make_dark_theme();
//cubeTex = load_cubemap();
int width, height;
glfwGetWindowSize(window, &width, &height);
glViewport(0, 0, width, height);
// Debugging views for offscreen surfaces
uiSurface.bounds = {0, 0, (float) width, (float) height};
uiSurface.add_child( {{0.0000f, +10},{0, +10},{0.1667f, -10},{0.133f, +10}});
uiSurface.add_child( {{0.1667f, +10},{0, +10},{0.3334f, -10},{0.133f, +10}});
uiSurface.layout();
grid = RenderableGrid(1, 100, 100);
cameraController.set_camera(&camera);
camera.look_at({0, 2.5, -2.5}, {0, 2.0, 0});
lights[0] = {{0, 10, -10}, {0, 0, 1}};
lights[1] = {{0, 10, 10}, {0, 1, 0}};
Renderable reflectiveSphere = Renderable(make_sphere(2.f));
reflectiveSphere.pose = Pose(float4(0, 0, 0, 1), float3(0, 2, 0));
glassModels.push_back(std::move(reflectiveSphere));
Renderable debugAxis = Renderable(make_axis(), false, GL_LINES);
debugAxis.pose = Pose(float4(0, 0, 0, 1), float3(0, 1, 0));
regularModels.push_back(std::move(debugAxis));
Renderable cubeA = Renderable(make_cube());
cubeA.pose = Pose(make_rotation_quat_axis_angle({1, 0, 1}, ANVIL_PI / 3), float3(5, 0, 0));
regularModels.push_back(std::move(cubeA));
Renderable cubeB = Renderable(make_cube());
cubeB.pose = Pose(make_rotation_quat_axis_angle({1, 0, 1}, ANVIL_PI / 4), float3(-5, 0, 0));
regularModels.push_back(std::move(cubeB));
glassMaterialShader = make_watched_shader(shaderMonitor, "assets/shaders/glass_vert.glsl", "assets/shaders/glass_frag.glsl");
simpleShader = make_watched_shader(shaderMonitor, "assets/shaders/simple_vert.glsl", "assets/shaders/simple_frag.glsl");
cubeCamera.reset(new CubemapCamera({1024, 1024}));
gl_check_error(__FILE__, __LINE__);
}
示例2: ExperimentalApp
ExperimentalApp() : GLFWApp(1280, 720, "Shadow App")
{
glfwSwapInterval(0);
gen = std::mt19937(rd());
igm.reset(new gui::ImGuiManager(window));
gui::make_dark_theme();
int width, height;
glfwGetWindowSize(window, &width, &height);
glViewport(0, 0, width, height);
cameraController.set_camera(&camera);
camera.farClip = 55.f;
camera.look_at({0, 0, +15}, {0, 0, 0});
// Debugging views
uiSurface.bounds = {0, 0, (float) width, (float) height};
uiSurface.add_child( {{0.0000f, +10},{0, +10},{0.1667f, -10},{0.133f, +10}});
uiSurface.add_child( {{0.1667f, +10},{0, +10},{0.3334f, -10},{0.133f, +10}});
uiSurface.add_child( {{0.3334f, +10},{0, +10},{0.5009f, -10},{0.133f, +10}});
uiSurface.add_child( {{0.5000f, +10},{0, +10},{0.6668f, -10},{0.133f, +10}});
uiSurface.add_child( {{0.6668f, +10},{0, +10},{0.8335f, -10},{0.133f, +10}});
uiSurface.add_child( {{0.8335f, +10},{0, +10},{1.0000f, -10},{0.133f, +10}});
uiSurface.layout();
fullscreen_post_quad = make_fullscreen_quad();
sceneShader = make_watched_shader(shaderMonitor, "assets/shaders/shadow/scene_vert.glsl", "assets/shaders/shadow/scene_frag.glsl");
shadowmapShader = make_watched_shader(shaderMonitor, "assets/shaders/shadow/shadowmap_vert.glsl", "assets/shaders/shadow/shadowmap_frag.glsl");
pointLightShader = make_watched_shader(shaderMonitor, "assets/shaders/shadow/point_light_vert.glsl", "assets/shaders/shadow/point_light_frag.glsl");
gaussianBlurShader = make_watched_shader(shaderMonitor, "assets/shaders/gaussian_blur_vert.glsl", "assets/shaders/gaussian_blur_frag.glsl");
skydome.recompute(2, 10.f, 1.15f);
auto lightDir = skydome.get_light_direction();
sunLight = std::make_shared<DirectionalLight>(lightDir, float3(.50f, .75f, .825f), 64.f);
// todo spotLightB
shadowDepthTexture.load_data(shadowmapResolution, shadowmapResolution, GL_DEPTH_COMPONENT32, GL_DEPTH_COMPONENT, GL_FLOAT, nullptr);
shadowFramebuffer.attach(GL_DEPTH_ATTACHMENT, shadowDepthTexture);
if (!shadowFramebuffer.check_complete()) throw std::runtime_error("incomplete shadow framebuffer");
shadowBlurTexture.load_data(shadowmapResolution, shadowmapResolution, GL_R32F, GL_RGBA, GL_FLOAT, nullptr);
shadowBlurFramebuffer.attach(GL_COLOR_ATTACHMENT0, shadowBlurTexture);
if (!shadowBlurFramebuffer.check_complete()) throw std::runtime_error("incomplete blur framebuffer");
auto spotLightA = std::make_shared<SpotLight>(float3(0.f, 10.f, 0.f), float3(0.f, -1.f, 0.f), float3(0.766f, 0.766f, 0.005f), 30.0f, float3(1.0f, 0.0f, 0.0001f));
spotLights.push_back(spotLightA);
// Single spotlight fbo
for (int i = 0; i < 1; ++i)
{
auto buffer = std::make_shared<SpotLightFramebuffer>();
buffer->create(shadowmapResolution);
spotLightFramebuffers.push_back(buffer);
}
// Point light init
{
pointLight.reset(new PointLight(float3(0.f, 0.f, 0.f), float3(0, 1, 1), float3(1.0f, 0.05f, 0.0002f)));
pointLightFramebuffer.reset(new PointLightFramebuffer());
pointLightFramebuffer->create(float2(shadowmapResolution));
pointLightSphere = std::make_shared<Renderable>(make_sphere(0.5f));
sceneObjects.push_back(pointLightSphere);
}
viewA.reset(new GLTextureView(shadowDepthTexture.get_gl_handle()));
viewB.reset(new GLTextureView(shadowBlurTexture.get_gl_handle()));
viewC.reset(new GLTextureView(spotLightFramebuffers[0]->shadowDepthTexture.get_gl_handle()));
viewD.reset(new GLTextureView(pointLightFramebuffer->depthBuffer.get_gl_handle()));
auto lucy = load_geometry_from_ply("assets/models/stanford/lucy.ply");
rescale_geometry(lucy, 8.0f);
auto lucyBounds = lucy.compute_bounds();
auto statue = std::make_shared<Renderable>(lucy);
statue->pose.position = {0, 0, 0};
//sceneObjects.push_back(statue);
auto hollowCube = load_geometry_from_ply("assets/models/geometry/CubeHollowOpen.ply");
for (auto & v : hollowCube.vertices) v *= 0.20f;
auto hCube = std::make_shared<Renderable>(hollowCube);
hCube->pose.position = float3(0, 0, 0);
hCube->pose.orientation = make_rotation_quat_around_x(ANVIL_PI / 2);
//sceneObjects.push_back(hCube);
auto curvedMesh = make_curved_plane(2, 1, 8, 8);
sceneObjects.push_back(std::make_shared<Renderable>(curvedMesh));
//floor = std::make_shared<Renderable>(make_plane(32.f, 32.f, 64, 64), false);
//floor->pose.orientation = make_rotation_quat_axis_angle({1, 0, 0}, -ANVIL_PI / 2);
//floor->pose.position = {0, lucyBounds.min().y, 0};
//sceneObjects.push_back(floor);
//.........这里部分代码省略.........