fix msvc compilation problem (far and near macros)

This commit is contained in:
2018-10-23 01:42:25 +07:00
parent b732d423ce
commit 9e7006512f
4 changed files with 16 additions and 12 deletions

View File

@@ -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)

View File

@@ -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};

View File

@@ -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 {

View File

@@ -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(