本文整理汇总了C++中core::Context::get_height方法的典型用法代码示例。如果您正苦于以下问题:C++ Context::get_height方法的具体用法?C++ Context::get_height怎么用?C++ Context::get_height使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core::Context
的用法示例。
在下文中一共展示了Context::get_height方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: material
Material_test::Material_test(Core::Context &ctx)
: App(ctx)
, m_timer(0.f)
, m_cube_entity(get_world())
, m_plane_entity(get_world())
, m_camera_entity(get_world())
, m_camera(m_camera_entity, ctx.get_width(), ctx.get_height())
{
namespace Mat_utils = ::Test::Material_test_utils;
ctx.set_title("Material Renderer");
// ** Setup Entities ** //
{
// Move cube up so its not intersecting with plane.
{
m_cube_entity.set_name("Material Test Cube");
const Core::Transform cube_trans(
math::vec3_init(0.f, scene_cube_scale * 0.5f, 0.f),
math::vec3_init(scene_cube_scale),
math::quat_init()
);
Core::Entity_component::set_transform(m_cube_entity, cube_trans);
}
// Scale up plane
{
m_plane_entity.set_name("Material Test Plane");
const Core::Transform scaled_up(
math::vec3_zero(),
math::vec3_init(scene_plane_scale, 1.f, scene_plane_scale),
math::quat_init()
);
Core::Entity_component::set_transform(m_plane_entity, scaled_up);
}
// Back and up for the camera.
{
m_camera_entity.set_name("Material Test Camera");
Core::Entity_component::set_transform(
m_camera_entity,
Common::Orbit_transform(0.f,
camera_tilt,
camera_distance,
camera_height)
);
}
}
// ** Create Materials ** //
{
// Creates the material and stores it in the out.
auto add_material = [](const Core::Shader &shd,
const Core::Texture &tex,
const uint32_t index,
Core::Material *out)
{
char name[256];
memset(name, 0, sizeof(name));
sprintf(name, "test_material_%02d", index);
Core::Material material(name);
material.set_shader(shd);
if(tex)
{
material.set_map_01(tex);
}
*out = material;
};
uint32_t curr_mat = 0;
assert(curr_mat < Mat_utils::max_materials());
add_material(Shader_factory::get_fullbright(), Texture_factory::get_dev_green(), curr_mat, &m_materials[curr_mat]);
++curr_mat;
assert(curr_mat < Mat_utils::max_materials());
add_material(Shader_factory::get_fullbright(), Texture_factory::get_dev_red(), curr_mat, &m_materials[curr_mat]);
++curr_mat;
assert(curr_mat < Mat_utils::max_materials());
add_material(Shader_factory::get_fullbright(), Texture_factory::get_dev_squares(), curr_mat, &m_materials[curr_mat]);
++curr_mat;
assert(curr_mat < Mat_utils::max_materials());
add_material(Shader_factory::get_fullbright(), Texture_factory::get_dev_squares_large(), curr_mat, &m_materials[curr_mat]);
++curr_mat;
assert(curr_mat < Mat_utils::max_materials());
add_material(Shader_factory::get_fullbright(), Texture_factory::get_dev_colored_squares(), curr_mat, &m_materials[curr_mat]);
++curr_mat;
assert(curr_mat < Mat_utils::max_materials());
add_material(Shader_factory::get_noise(), Core::Texture(), curr_mat, &m_materials[curr_mat]);
//.........这里部分代码省略.........