8#include <pxr/base/gf/camera.h>
9#include <pxr/imaging/glf/drawTarget.h>
10#include <pxr/usd/usdGeom/camera.h>
77 border = pxr::GfVec4i(x1, y1, x2, y2);
100 float coords[8] = {0.0, 0.0, 1.0, 0.0, 1.0, 1.0, 0.0, 1.0};
105 gpu::VertBuf *vbo = GPU_vertbuf_create_with_format(format);
123 if (buffer ==
nullptr) {
130 if (buffer->GetFormat() == pxr::HdFormat::HdFormatFloat16Vec4) {
131 texture_format = gpu::TextureFormat::SFLOAT_16_16_16_16;
135 texture_format = gpu::TextureFormat::SFLOAT_32_32_32_32;
147 if (texture_ ==
nullptr) {
157 void *
data = buffer->Map();
187 if (view_settings.
width() * view_settings.
height() == 0) {
193 pxr::GfVec4d viewport(0.0, 0.0, view_settings.
width(), view_settings.
height());
214 pxr::GfVec4d draw_viewport(view_settings.
border[0],
224 draw_texture_.create_from_buffer(
226 draw_texture_.draw(
shader, draw_viewport);
235 char elapsed_time[32];
243 std ::string(
"Time: ") + elapsed_time +
244 " | Done: " + std::to_string(
int(percent_done)) +
"%",
249 notify_status(percent_done / 100.0, std::string(
"Time: ") + elapsed_time,
"Rendering Done");
269 const std::string &info,
270 const std::string &status)
Camera data-block and utility functions.
Platform independent time functions.
gpu::Texture * texture() const
void draw(gpu::Shader *shader, const pxr::GfVec4d &viewport, gpu::Texture *tex=nullptr)
void create_from_buffer(pxr::HdRenderBuffer *buffer)
RenderEngine * bl_engine_
float renderer_percent_done()
pxr::HdTaskSharedPtrVector tasks()
std::unique_ptr< RenderTaskDelegate > render_task_delegate_
std::unique_ptr< io::hydra::CameraDelegate > free_camera_delegate_
std::unique_ptr< pxr::HdRenderIndex > render_index_
std::unique_ptr< LightTasksDelegate > light_tasks_delegate_
std::unique_ptr< pxr::HdEngine > engine_
gpu::Texture * get_aov_texture(pxr::TfToken const &aov_key)
void notify_status(float progress, const std::string &info, const std::string &status) override
const Object * camera_object() const override
pxr::GfCamera gf_camera(const Depsgraph *depsgraph, const View3D *v3d, const ARegion *region, const pxr::GfVec4f &border)
void RE_engine_update_stats(RenderEngine *engine, const char *stats, const char *info)
void GPU_framebuffer_bind(gpu::FrameBuffer *fb)
int GPU_shader_get_sampler_binding(gpu::Shader *shader, const char *name)
gpu::FrameBuffer * GPU_framebuffer_active_get()
gpu::Batch * GPU_batch_create_ex(GPUPrimType primitive_type, gpu::VertBuf *vertex_buf, gpu::IndexBuf *index_buf, GPUBatchFlag owns_flag)
void GPU_texture_update(gpu::Texture *texture, eGPUDataFormat data_format, const void *data)
gpu::TextureFormat GPU_texture_format(const gpu::Texture *texture)
bool BKE_camera_view_render_border(const struct Scene *scene, const struct Depsgraph *depsgraph, const struct View3D *v3d, const struct RegionView3D *rv3d, int winx, int winy, rctf *r_border, rctf *r_unrolled_border)
void GPU_batch_discard(gpu::Batch *batch)
void GPU_batch_set_shader(gpu::Batch *batch, gpu::Shader *shader, const gpu::shader::SpecializationConstants *constants_state=nullptr)
void * CTX_wm_region_data(const bContext *C)
void GPU_matrix_scale_2f(float x, float y)
@ GPU_TEXTURE_USAGE_GENERAL
BMesh const char void * data
T * DEG_get_evaluated(const Depsgraph *depsgraph, T *id)
Depsgraph * CTX_data_ensure_evaluated_depsgraph(const bContext *C, bool rna_write_check=false)
int GPU_texture_width(const gpu::Texture *texture)
void GPU_batch_draw(gpu::Batch *batch)
void GPU_shader_bind(gpu::Shader *shader, const gpu::shader::SpecializationConstants *constants_state=nullptr)
void GPU_shader_uniform_1i(gpu::Shader *sh, const char *name, int value)
void GPU_matrix_translate_2f(float x, float y)
uint GPU_vertformat_attr_add(GPUVertFormat *format, StringRef name, gpu::VertAttrType type)
gpu::Shader * GPU_shader_get_builtin_shader(GPUBuiltinShader shader)
void GPU_vertbuf_attr_fill(gpu::VertBuf *, uint a_idx, const void *data)
void GPU_texture_bind(gpu::Texture *texture, int unit)
int GPU_texture_height(const gpu::Texture *texture)
void GPU_texture_free(gpu::Texture *texture)
void GPU_vertbuf_data_alloc(gpu::VertBuf &verts, uint v_len)
double BLI_time_now_seconds()
Scene * DEG_get_evaluated_scene(const Depsgraph *graph)
size_t BLI_timecode_string_from_time_simple(char *str, size_t maxncpy, double time_seconds) ATTR_NONNULL()
ARegion * CTX_wm_region(const bContext *C)
View3D * CTX_wm_view3d(const bContext *C)
gpu::Texture * GPU_texture_create_2d(const char *name, int width, int height, int mip_len, gpu::TextureFormat format, eGPUTextureUsage usage, const float *data)
ViewSettings(bContext *context)