mirror of
https://github.com/enduro2d/enduro2d.git
synced 2025-12-15 00:11:55 +07:00
fix msvc compilation problem (far and near macros)
This commit is contained in:
@@ -18,6 +18,10 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
add_definitions(/MP)
|
||||
endif(MSVC)
|
||||
|
||||
if(APPLE)
|
||||
add_compile_options(-Wno-deprecated-declarations)
|
||||
endif(APPLE)
|
||||
|
||||
@@ -419,13 +419,13 @@ namespace e2d
|
||||
depth_state& write(bool enable) noexcept;
|
||||
depth_state& func(compare_func func) noexcept;
|
||||
|
||||
f32 near() const noexcept;
|
||||
f32 far() const noexcept;
|
||||
f32 range_near() const noexcept;
|
||||
f32 range_far() const noexcept;
|
||||
bool write() const noexcept;
|
||||
compare_func func() const noexcept;
|
||||
private:
|
||||
f32 near_ = 0.0f;
|
||||
f32 far_ = 1.0f;
|
||||
f32 range_near_ = 0.0f;
|
||||
f32 range_far_ = 1.0f;
|
||||
bool write_ = true;
|
||||
compare_func func_ = compare_func::less;
|
||||
u8 _pad[2] = {0};
|
||||
|
||||
@@ -235,8 +235,8 @@ namespace e2d
|
||||
//
|
||||
|
||||
render::depth_state& render::depth_state::range(f32 near, f32 far) noexcept {
|
||||
near_ = near;
|
||||
far_ = far;
|
||||
range_near_ = near;
|
||||
range_far_ = far;
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -250,12 +250,12 @@ namespace e2d
|
||||
return *this;
|
||||
}
|
||||
|
||||
f32 render::depth_state::near() const noexcept {
|
||||
return near_;
|
||||
f32 render::depth_state::range_near() const noexcept {
|
||||
return range_near_;
|
||||
}
|
||||
|
||||
f32 render::depth_state::far() const noexcept {
|
||||
return far_;
|
||||
f32 render::depth_state::range_far() const noexcept {
|
||||
return range_far_;
|
||||
}
|
||||
|
||||
bool render::depth_state::write() const noexcept {
|
||||
|
||||
@@ -245,8 +245,8 @@ namespace e2d
|
||||
|
||||
render::internal_state& render::internal_state::set_depth_state(const depth_state& ds) noexcept {
|
||||
GL_CHECK_CODE(debug_, glDepthRange(
|
||||
math::numeric_cast<GLclampd>(math::saturate(ds.near())),
|
||||
math::numeric_cast<GLclampd>(math::saturate(ds.far()))));
|
||||
math::numeric_cast<GLclampd>(math::saturate(ds.range_near())),
|
||||
math::numeric_cast<GLclampd>(math::saturate(ds.range_far()))));
|
||||
GL_CHECK_CODE(debug_, glDepthMask(
|
||||
ds.write() ? GL_TRUE : GL_FALSE));
|
||||
GL_CHECK_CODE(debug_, glDepthFunc(
|
||||
|
||||
Reference in New Issue
Block a user