15 auto fs_sky = am.get_asset<
gfx::shader>(
"engine:/data/shaders/atmospherics/fs_skybox.sc");
16 program_.program = std::make_unique<gpu_program>(vs_sky, fs_sky);
18 if(!program_.program->is_valid())
24 program_.cache_uniforms();
34 static pos_vertex s_cubeVertices[] = {
41 {-1.0f, -1.0f, -1.0f},
48 static const uint16_t s_cubeIndices[] = {
70 vb_ = std::make_unique<gfx::vertex_buffer>(
gfx::copy(s_cubeVertices,
sizeof(s_cubeVertices)),
73 ib_ = std::make_unique<gfx::index_buffer>(
gfx::copy(s_cubeIndices,
sizeof(s_cubeIndices)));
84 if(!program_.program->is_valid())
93 pass.
bind(target.get());
100 program_.program->begin();
106 BGFX_STATE_WRITE_RGB | BGFX_STATE_WRITE_A |
107 BGFX_STATE_DEPTH_TEST_LEQUAL;
118 program_.program->end();
std::shared_ptr< frame_buffer > ptr
Manages assets, including loading, unloading, and storage.
auto get_asset(const std::string &key, load_flags flags=load_flags::standard) -> asset_handle< T >
Gets an asset by its key.
void run(gfx::frame_buffer::ptr target, const camera &cam, gfx::render_view &rview, delta_t dt, const run_params ¶ms)
bool init(rtti::context &ctx)
Class representing a camera. Contains functionality for manipulating and updating a camera....
auto get_projection() const -> const math::transform &
Retrieves the current projection matrix.
auto get_view_relative() const -> const math::transform &
std::chrono::duration< float > delta_t
#define APPLOG_ERROR(...)
void submit(view_id _id, program_handle _handle, int32_t _depth, bool _preserveState)
void set_state(uint64_t _state, uint32_t _rgba)
void set_vertex_buffer(uint8_t _stream, vertex_buffer_handle _handle)
void discard(uint8_t _flags)
const memory_view * copy(const void *_data, uint32_t _size)
void set_index_buffer(index_buffer_handle _handle)
void set_texture(uint8_t _stage, uniform_handle _sampler, texture_handle _handle, uint32_t _flags)
auto get(bool wait=true) const -> std::shared_ptr< T >
Gets the shared pointer to the asset.
void set_view_proj(const float *v, const float *p)
void bind(const frame_buffer *fb=nullptr) const
static auto get_layout() -> const vertex_layout &
asset_handle< gfx::texture > cubemap