forked from blender/blender
Rename some functions #25
@ -70,7 +70,7 @@ CameraData::CameraData(bContext *context)
|
|||||||
/* Updating l_shift due to viewport zoom and view_camera_offset
|
/* Updating l_shift due to viewport zoom and view_camera_offset
|
||||||
* view_camera_offset should be multiplied by 2. */
|
* view_camera_offset should be multiplied by 2. */
|
||||||
lens_shift_ = pxr::GfVec2f((lens_shift_[0] + region_data->camdx * 2) / zoom,
|
lens_shift_ = pxr::GfVec2f((lens_shift_[0] + region_data->camdx * 2) / zoom,
|
||||||
(lens_shift_[1] + region_data->camdy * 2) / zoom);
|
(lens_shift_[1] + region_data->camdy * 2) / zoom);
|
||||||
|
|
||||||
if (mode_ == CAM_ORTHO) {
|
if (mode_ == CAM_ORTHO) {
|
||||||
ortho_size_ *= zoom;
|
ortho_size_ *= zoom;
|
||||||
@ -274,6 +274,4 @@ pxr::GfCamera CameraData::gf_camera(pxr::GfVec4f tile)
|
|||||||
return gf_camera;
|
return gf_camera;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace blender::render::hydra
|
} // namespace blender::render::hydra
|
||||||
|
@ -51,7 +51,7 @@ void FinalEngine::render(Depsgraph *depsgraph)
|
|||||||
|
|
||||||
free_camera_delegate_->SetCamera(camera);
|
free_camera_delegate_->SetCamera(camera);
|
||||||
render_task_delegate_->set_camera_and_viewport(free_camera_delegate_->GetCameraId(),
|
render_task_delegate_->set_camera_and_viewport(free_camera_delegate_->GetCameraId(),
|
||||||
pxr::GfVec4d(0, 0, res[0], res[1]));
|
pxr::GfVec4d(0, 0, res[0], res[1]));
|
||||||
render_task_delegate_->set_renderer_aov(pxr::HdAovTokens->color);
|
render_task_delegate_->set_renderer_aov(pxr::HdAovTokens->color);
|
||||||
if (simple_light_task_delegate_) {
|
if (simple_light_task_delegate_) {
|
||||||
simple_light_task_delegate_->set_camera_path(free_camera_delegate_->GetCameraId());
|
simple_light_task_delegate_->set_camera_path(free_camera_delegate_->GetCameraId());
|
||||||
@ -70,7 +70,7 @@ void FinalEngine::render(Depsgraph *depsgraph)
|
|||||||
float percent_done = 0.0;
|
float percent_done = 0.0;
|
||||||
|
|
||||||
std::map<std::string, std::vector<float>> render_images{
|
std::map<std::string, std::vector<float>> render_images{
|
||||||
{"Combined", std::vector<float>(res[0] * res[1] * 4)}}; /* 4 - number of channels. */
|
{"Combined", std::vector<float>(res[0] * res[1] * 4)}}; /* 4 - number of channels. */
|
||||||
std::vector<float> &pixels = render_images["Combined"];
|
std::vector<float> &pixels = render_images["Combined"];
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -171,7 +171,7 @@ void FinalEngineGL::render(Depsgraph *depsgraph)
|
|||||||
|
|
||||||
free_camera_delegate_->SetCamera(camera);
|
free_camera_delegate_->SetCamera(camera);
|
||||||
render_task_delegate_->set_camera_and_viewport(free_camera_delegate_->GetCameraId(),
|
render_task_delegate_->set_camera_and_viewport(free_camera_delegate_->GetCameraId(),
|
||||||
pxr::GfVec4d(0, 0, res[0], res[1]));
|
pxr::GfVec4d(0, 0, res[0], res[1]));
|
||||||
if (simple_light_task_delegate_) {
|
if (simple_light_task_delegate_) {
|
||||||
simple_light_task_delegate_->set_camera_path(free_camera_delegate_->GetCameraId());
|
simple_light_task_delegate_->set_camera_path(free_camera_delegate_->GetCameraId());
|
||||||
}
|
}
|
||||||
@ -192,17 +192,12 @@ void FinalEngineGL::render(Depsgraph *depsgraph)
|
|||||||
float percent_done = 0.0;
|
float percent_done = 0.0;
|
||||||
|
|
||||||
std::map<std::string, std::vector<float>> render_images{
|
std::map<std::string, std::vector<float>> render_images{
|
||||||
{"Combined", std::vector<float>(res[0] * res[1] * 4)}}; /* 4 - number of channels. */
|
{"Combined", std::vector<float>(res[0] * res[1] * 4)}}; /* 4 - number of channels. */
|
||||||
std::vector<float> &pixels = render_images["Combined"];
|
std::vector<float> &pixels = render_images["Combined"];
|
||||||
|
|
||||||
GPUFrameBuffer *framebuffer = GPU_framebuffer_create("fbHydraRenderFinal");
|
GPUFrameBuffer *framebuffer = GPU_framebuffer_create("fbHydraRenderFinal");
|
||||||
GPUTexture *texture = GPU_texture_create_2d("texHydraRenderFinal",
|
GPUTexture *texture = GPU_texture_create_2d(
|
||||||
res[0],
|
"texHydraRenderFinal", res[0], res[1], 1, GPU_RGBA32F, GPU_TEXTURE_USAGE_GENERAL, nullptr);
|
||||||
res[1],
|
|
||||||
1,
|
|
||||||
GPU_RGBA32F,
|
|
||||||
GPU_TEXTURE_USAGE_GENERAL,
|
|
||||||
nullptr);
|
|
||||||
GPU_texture_filter_mode(texture, true);
|
GPU_texture_filter_mode(texture, true);
|
||||||
GPU_texture_mipmap_mode(texture, true, true);
|
GPU_texture_mipmap_mode(texture, true, true);
|
||||||
GPU_framebuffer_texture_attach(framebuffer, texture, 0, 0);
|
GPU_framebuffer_texture_attach(framebuffer, texture, 0, 0);
|
||||||
|
@ -3,9 +3,9 @@
|
|||||||
|
|
||||||
#include "DEG_depsgraph_query.h"
|
#include "DEG_depsgraph_query.h"
|
||||||
|
|
||||||
|
#include "BLI_timer.h"
|
||||||
#include "camera.h"
|
#include "camera.h"
|
||||||
#include "preview_engine.h"
|
#include "preview_engine.h"
|
||||||
#include "BLI_timer.h"
|
|
||||||
|
|
||||||
namespace blender::render::hydra {
|
namespace blender::render::hydra {
|
||||||
|
|
||||||
@ -13,7 +13,8 @@ const double LIFETIME = 180.0;
|
|||||||
|
|
||||||
std::unique_ptr<PreviewEngine> PreviewEngine::instance_;
|
std::unique_ptr<PreviewEngine> PreviewEngine::instance_;
|
||||||
|
|
||||||
PreviewEngine *PreviewEngine::get_instance(RenderEngine *bl_engine, const std::string &render_delegate_id)
|
PreviewEngine *PreviewEngine::get_instance(RenderEngine *bl_engine,
|
||||||
|
const std::string &render_delegate_id)
|
||||||
{
|
{
|
||||||
if (!instance_) {
|
if (!instance_) {
|
||||||
instance_ = std::make_unique<PreviewEngine>(bl_engine, render_delegate_id);
|
instance_ = std::make_unique<PreviewEngine>(bl_engine, render_delegate_id);
|
||||||
@ -66,7 +67,7 @@ void PreviewEngine::render(Depsgraph *depsgraph)
|
|||||||
|
|
||||||
free_camera_delegate_->SetCamera(camera);
|
free_camera_delegate_->SetCamera(camera);
|
||||||
render_task_delegate_->set_camera_and_viewport(free_camera_delegate_->GetCameraId(),
|
render_task_delegate_->set_camera_and_viewport(free_camera_delegate_->GetCameraId(),
|
||||||
pxr::GfVec4d(0, 0, res[0], res[1]));
|
pxr::GfVec4d(0, 0, res[0], res[1]));
|
||||||
render_task_delegate_->set_renderer_aov(pxr::HdAovTokens->color);
|
render_task_delegate_->set_renderer_aov(pxr::HdAovTokens->color);
|
||||||
|
|
||||||
pxr::HdTaskSharedPtrVector tasks;
|
pxr::HdTaskSharedPtrVector tasks;
|
||||||
@ -75,7 +76,8 @@ void PreviewEngine::render(Depsgraph *depsgraph)
|
|||||||
}
|
}
|
||||||
tasks.push_back(render_task_delegate_->get_task());
|
tasks.push_back(render_task_delegate_->get_task());
|
||||||
|
|
||||||
std::vector<float> pixels = std::vector<float>(res[0] * res[1] * 4); /* 4 - number of channels. */
|
std::vector<float> pixels = std::vector<float>(res[0] * res[1] *
|
||||||
|
4); /* 4 - number of channels. */
|
||||||
|
|
||||||
{
|
{
|
||||||
/* Release the GIL before calling into hydra, in case any hydra plugins call into python. */
|
/* Release the GIL before calling into hydra, in case any hydra plugins call into python. */
|
||||||
@ -112,7 +114,6 @@ double PreviewEngine::free_instance(uintptr_t uuid, void *user_data)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PreviewEngine::update(RenderEngine *bl_engine, const std::string &render_delegate_id)
|
void PreviewEngine::update(RenderEngine *bl_engine, const std::string &render_delegate_id)
|
||||||
{
|
{
|
||||||
this->bl_engine_ = bl_engine;
|
this->bl_engine_ = bl_engine;
|
||||||
|
@ -30,7 +30,6 @@ class PreviewEngine : public FinalEngine {
|
|||||||
int width,
|
int width,
|
||||||
int height,
|
int height,
|
||||||
std::vector<float> &pixels);
|
std::vector<float> &pixels);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace blender::render::hydra
|
} // namespace blender::render::hydra
|
||||||
|
@ -172,7 +172,8 @@ bool InstancerData::set_instances()
|
|||||||
ID *prev_id = id_;
|
ID *prev_id = id_;
|
||||||
id_ = nullptr;
|
id_ = nullptr;
|
||||||
transforms_.clear();
|
transforms_.clear();
|
||||||
ListBase *lb = object_duplilist(scene_delegate_->depsgraph_, scene_delegate_->scene_, parent_obj_);
|
ListBase *lb = object_duplilist(
|
||||||
|
scene_delegate_->depsgraph_, scene_delegate_->scene_, parent_obj_);
|
||||||
LISTBASE_FOREACH (DupliObject *, dupli, lb) {
|
LISTBASE_FOREACH (DupliObject *, dupli, lb) {
|
||||||
if (!id_) {
|
if (!id_) {
|
||||||
/* TODO: We create instances only for object in first dupli.
|
/* TODO: We create instances only for object in first dupli.
|
||||||
|
@ -27,7 +27,8 @@ class InstancerData : public MeshData {
|
|||||||
pxr::GfMatrix4d get_transform() override;
|
pxr::GfMatrix4d get_transform() override;
|
||||||
bool update_visibility(View3D *view3d) override;
|
bool update_visibility(View3D *view3d) override;
|
||||||
|
|
||||||
pxr::HdPrimvarDescriptorVector get_instancer_primvar_descriptors(pxr::HdInterpolation interpolation);
|
pxr::HdPrimvarDescriptorVector get_instancer_primvar_descriptors(
|
||||||
|
pxr::HdInterpolation interpolation);
|
||||||
pxr::VtIntArray get_instance_indices();
|
pxr::VtIntArray get_instance_indices();
|
||||||
bool is_base(Object *object) const;
|
bool is_base(Object *object) const;
|
||||||
|
|
||||||
|
@ -131,7 +131,8 @@ pxr::VtValue MaterialData::get_material_resource()
|
|||||||
pxr::TfTokenVector render_contexts = render_delegate->GetMaterialRenderContexts();
|
pxr::TfTokenVector render_contexts = render_delegate->GetMaterialRenderContexts();
|
||||||
|
|
||||||
pxr::HdMaterialNetworkMap network_map;
|
pxr::HdMaterialNetworkMap network_map;
|
||||||
hdmtlx_convert_to_materialnetworkmap(path, shader_source_types, render_contexts, &network_map);
|
hdmtlx_convert_to_materialnetworkmap(
|
||||||
|
path, shader_source_types, render_contexts, &network_map);
|
||||||
|
|
||||||
material_network_map_ = network_map;
|
material_network_map_ = network_map;
|
||||||
}
|
}
|
||||||
|
@ -134,7 +134,8 @@ pxr::HdMeshTopology MeshData::get_mesh_topology()
|
|||||||
face_vertex_indices_);
|
face_vertex_indices_);
|
||||||
}
|
}
|
||||||
|
|
||||||
pxr::HdPrimvarDescriptorVector MeshData::get_primvar_descriptors(pxr::HdInterpolation interpolation)
|
pxr::HdPrimvarDescriptorVector MeshData::get_primvar_descriptors(
|
||||||
|
pxr::HdInterpolation interpolation)
|
||||||
{
|
{
|
||||||
pxr::HdPrimvarDescriptorVector primvars;
|
pxr::HdPrimvarDescriptorVector primvars;
|
||||||
if (interpolation == pxr::HdInterpolationVertex) {
|
if (interpolation == pxr::HdInterpolationVertex) {
|
||||||
|
@ -23,9 +23,9 @@
|
|||||||
namespace mx = MaterialX;
|
namespace mx = MaterialX;
|
||||||
|
|
||||||
void hdmtlx_convert_to_materialnetworkmap(std::string const &mtlx_path,
|
void hdmtlx_convert_to_materialnetworkmap(std::string const &mtlx_path,
|
||||||
pxr::TfTokenVector const &shader_source_types,
|
pxr::TfTokenVector const &shader_source_types,
|
||||||
pxr::TfTokenVector const &render_contexts,
|
pxr::TfTokenVector const &render_contexts,
|
||||||
pxr::HdMaterialNetworkMap *out)
|
pxr::HdMaterialNetworkMap *out)
|
||||||
{
|
{
|
||||||
if (mtlx_path.empty()) {
|
if (mtlx_path.empty()) {
|
||||||
return;
|
return;
|
||||||
|
@ -195,12 +195,12 @@ void DrawTexture::create(pxr::HdRenderBuffer *buffer)
|
|||||||
|
|
||||||
void *data = buffer->Map();
|
void *data = buffer->Map();
|
||||||
texture_ = GPU_texture_create_2d("texHydraRenderViewport",
|
texture_ = GPU_texture_create_2d("texHydraRenderViewport",
|
||||||
width_,
|
width_,
|
||||||
height_,
|
height_,
|
||||||
1,
|
1,
|
||||||
GPU_RGBA16F,
|
GPU_RGBA16F,
|
||||||
GPU_TEXTURE_USAGE_GENERAL,
|
GPU_TEXTURE_USAGE_GENERAL,
|
||||||
(float *)data);
|
(float *)data);
|
||||||
buffer->Unmap();
|
buffer->Unmap();
|
||||||
|
|
||||||
GPU_texture_filter_mode(texture_, true);
|
GPU_texture_filter_mode(texture_, true);
|
||||||
@ -245,10 +245,10 @@ void ViewportEngine::render(Depsgraph *depsgraph, bContext *context)
|
|||||||
pxr::GfCamera gf_camera = view_settings.gf_camera();
|
pxr::GfCamera gf_camera = view_settings.gf_camera();
|
||||||
free_camera_delegate_->SetCamera(gf_camera);
|
free_camera_delegate_->SetCamera(gf_camera);
|
||||||
render_task_delegate_->set_camera_and_viewport(free_camera_delegate_->GetCameraId(),
|
render_task_delegate_->set_camera_and_viewport(free_camera_delegate_->GetCameraId(),
|
||||||
pxr::GfVec4d(view_settings.border[0],
|
pxr::GfVec4d(view_settings.border[0],
|
||||||
view_settings.border[1],
|
view_settings.border[1],
|
||||||
view_settings.border[2],
|
view_settings.border[2],
|
||||||
view_settings.border[3]));
|
view_settings.border[3]));
|
||||||
if (simple_light_task_delegate_) {
|
if (simple_light_task_delegate_) {
|
||||||
simple_light_task_delegate_->set_camera_path(free_camera_delegate_->GetCameraId());
|
simple_light_task_delegate_->set_camera_path(free_camera_delegate_->GetCameraId());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user