Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into sky
Browse files Browse the repository at this point in the history
  • Loading branch information
iaomw committed Jun 11, 2024
2 parents d4a645d + ea6f82e commit 93ca849
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 5 deletions.
4 changes: 1 addition & 3 deletions ui/zenoedit/viewport/displaywidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1383,12 +1383,10 @@ void DisplayWidget::onNodeSelected(const QModelIndex &subgIdx, const QModelIndex
Zenovis *pZenovis = m_glView->getZenoVis();
ZASSERT_EXIT(pZenovis && pZenovis->getSession());
auto scene = pZenovis->getSession()->get_scene();
auto _near = scene->camera->m_near;
auto _far = scene->camera->m_far;
auto fov = scene->camera->m_fov;
auto cz = glm::length(scene->camera->m_lodcenter);
if (depth != 0) {
cz = scene->camera->m_near / depth;
cz = scene->camera->inf_z_near / depth;
}
auto w = scene->camera->m_nx;
auto h = scene->camera->m_ny;
Expand Down
10 changes: 10 additions & 0 deletions zeno/include/zeno/utils/to_string.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,16 @@ struct _to_stream_impl {
return _helper_tuple_to_stream(os, t, fms, std::make_index_sequence<std::tuple_size_v<T> - 1>{});
}

template <class Os, class T>
static auto to_stream(Os &os, T const &t, std::string_view fms) -> decltype((std::enable_if_t<!_has_stream_bit_shl<Os &, T const &>::value && !_has_range_begin_end<T>::value, void>)(std::declval<T&>()[0], std::declval<T&>().length())) {
os << "[glm: ";
for (int i = 0; i < t.length(); ++i) {
to_stream(os, t[i], fms);
os << ", ";
}
os << "]";
}

template <class Os, class T, std::enable_if_t<!_has_stream_bit_shl<Os &, T const &>::value
&& (std::tuple_size<T>::value == 0), int> = 0>
static void to_stream(Os &os, T const &t, std::string_view fms) {
Expand Down
1 change: 1 addition & 0 deletions zenovis/include/zenovis/Camera.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ struct ZOptixCameraSettingInfo {
};

struct Camera {
float inf_z_near = 0.001f;
int m_nx{512}, m_ny{512};
glm::mat4x4 m_view{1}, m_proj{1};

Expand Down
4 changes: 2 additions & 2 deletions zenovis/src/Camera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ void Camera::placeCamera(glm::vec3 pos, glm::vec3 front, glm::vec3 up) {
m_proj = glm::orthoZO(-radius * getAspect(), radius * getAspect(), -radius,
radius, m_far, m_near);
} else {
m_proj = MakeInfReversedZProjRH(glm::radians(m_fov), getAspect(), 0.001);
m_proj = MakeInfReversedZProjRH(glm::radians(m_fov), getAspect(), inf_z_near);
}
}

Expand All @@ -107,7 +107,7 @@ void Camera::updateMatrix() {
void Camera::setResolution(int nx, int ny) {
m_nx = nx;
m_ny = ny;
m_proj = MakeInfReversedZProjRH(glm::radians(m_fov), getAspect(), m_near);
m_proj = MakeInfReversedZProjRH(glm::radians(m_fov), getAspect(), inf_z_near);
}
void Camera::setResolutionInfo(bool block, int nx, int ny)
{
Expand Down
9 changes: 9 additions & 0 deletions zenovis/src/optx/RenderEngineOptx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1227,6 +1227,15 @@ struct RenderEngineOptx : RenderEngine, zeno::disable_copy {
}
}
}
// add light map
for(auto const &[_, ld]: xinxinoptix::get_lightdats()) {
if (ld.profileKey.size()) {
realNeedTexPaths.emplace_back(ld.profileKey);
}
if (ld.textureKey.size()) {
realNeedTexPaths.emplace_back(ld.textureKey);
}
}
std::vector<std::string> needToRemoveTexPaths;
for(auto const &[tex, _]: OptixUtil::g_tex) {
if (std::find(realNeedTexPaths.begin(), realNeedTexPaths.end(), tex) != realNeedTexPaths.end()) {
Expand Down
5 changes: 5 additions & 0 deletions zenovis/xinxinoptix/optixPathTracer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2053,6 +2053,11 @@ static std::map<std::string, LightDat> lightdats;
static std::vector<float2> triangleLightCoords;
static std::vector<float3> triangleLightNormals;


std::map<std::string, LightDat> &get_lightdats() {
return lightdats;
}

void unload_light(){

lightdats.clear();
Expand Down
1 change: 1 addition & 0 deletions zenovis/xinxinoptix/xinxinoptixapi.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,5 @@ void updatePortalLights(const std::vector<Portal>& portals);
void updateDistantLights(std::vector<zeno::DistantLightData>& dldl);
// void optixUpdateUniforms(std::vector<float4> & inConstants);
void optixUpdateUniforms(void *inConstants, std::size_t size);
std::map<std::string, LightDat> &get_lightdats();
}

0 comments on commit 93ca849

Please sign in to comment.