Browse Source

doc: convert shader images to proper sRGB and HiDPI.

pull/268/merge
Vladimír Vondruš 8 years ago
parent
commit
295843189d
  1. 2
      doc/changelog.dox
  2. 18
      doc/generated/shaders.cpp
  3. BIN
      doc/shaders-distancefieldvector.png
  4. BIN
      doc/shaders-flat.png
  5. BIN
      doc/shaders-meshvisualizer.png
  6. BIN
      doc/shaders-phong.png
  7. BIN
      doc/shaders-vector.png
  8. BIN
      doc/shaders-vertexcolor.png
  9. 2
      src/Magnum/Shaders/DistanceFieldVector.h
  10. 2
      src/Magnum/Shaders/Flat.h
  11. 2
      src/Magnum/Shaders/MeshVisualizer.h
  12. 2
      src/Magnum/Shaders/Phong.h
  13. 3
      src/Magnum/Shaders/Vector.h
  14. 2
      src/Magnum/Shaders/VertexColor.h

2
doc/changelog.dox

@ -411,6 +411,8 @@ See also:
oversized on others (see oversized on others (see
[mosra/magnum#260](https://github.com/mosra/magnum/issues/260), [mosra/magnum#260](https://github.com/mosra/magnum/issues/260),
[mosra/magnum#261](https://github.com/mosra/magnum/issues/261)) [mosra/magnum#261](https://github.com/mosra/magnum/issues/261))
- Documentation of @ref Primitives and @ref Shaders namespaces now has proper
sRGB and HiDPi renderings of all primitives and shaders
@subsection changelog-latest-deprecated Deprecated APIs @subsection changelog-latest-deprecated Deprecated APIs

18
doc/generated/shaders.cpp

@ -84,7 +84,7 @@ struct ShaderVisualizer: Platform::WindowlessApplication {
}; };
namespace { namespace {
constexpr const Vector2i ImageSize{256}; constexpr const Vector2i ImageSize{512};
} }
int ShaderVisualizer::exec() { int ShaderVisualizer::exec() {
@ -103,7 +103,7 @@ int ShaderVisualizer::exec() {
} }
GL::Renderbuffer multisampleColor, multisampleDepth; GL::Renderbuffer multisampleColor, multisampleDepth;
multisampleColor.setStorageMultisample(16, GL::RenderbufferFormat::RGBA8, ImageSize); multisampleColor.setStorageMultisample(16, GL::RenderbufferFormat::SRGB8Alpha8, ImageSize);
multisampleDepth.setStorageMultisample(16, GL::RenderbufferFormat::DepthComponent24, ImageSize); multisampleDepth.setStorageMultisample(16, GL::RenderbufferFormat::DepthComponent24, ImageSize);
GL::Framebuffer multisampleFramebuffer{{{}, ImageSize}}; GL::Framebuffer multisampleFramebuffer{{{}, ImageSize}};
@ -113,12 +113,13 @@ int ShaderVisualizer::exec() {
CORRADE_INTERNAL_ASSERT(multisampleFramebuffer.checkStatus(GL::FramebufferTarget::Draw) == GL::Framebuffer::Status::Complete); CORRADE_INTERNAL_ASSERT(multisampleFramebuffer.checkStatus(GL::FramebufferTarget::Draw) == GL::Framebuffer::Status::Complete);
GL::Renderbuffer color; GL::Renderbuffer color;
color.setStorage(GL::RenderbufferFormat::RGBA8, ImageSize); color.setStorage(GL::RenderbufferFormat::SRGB8Alpha8, ImageSize);
GL::Framebuffer framebuffer{{{}, ImageSize}}; GL::Framebuffer framebuffer{{{}, ImageSize}};
framebuffer.attachRenderbuffer(GL::Framebuffer::ColorAttachment{0}, color); framebuffer.attachRenderbuffer(GL::Framebuffer::ColorAttachment{0}, color);
GL::Renderer::enable(GL::Renderer::Feature::DepthTest); GL::Renderer::enable(GL::Renderer::Feature::DepthTest);
GL::Renderer::setClearColor(0x000000_rgbaf); GL::Renderer::enable(GL::Renderer::Feature::FramebufferSrgb);
GL::Renderer::setClearColor(0x000000_srgbaf);
for(auto fun: {&ShaderVisualizer::phong, for(auto fun: {&ShaderVisualizer::phong,
&ShaderVisualizer::meshVisualizer, &ShaderVisualizer::meshVisualizer,
@ -143,13 +144,13 @@ int ShaderVisualizer::exec() {
namespace { namespace {
const auto Projection = Matrix4::perspectiveProjection(35.0_degf, 1.0f, 0.001f, 100.0f); const auto Projection = Matrix4::perspectiveProjection(35.0_degf, 1.0f, 0.001f, 100.0f);
const auto Transformation = Matrix4::translation(Vector3::zAxis(-5.0f)); const auto Transformation = Matrix4::translation(Vector3::zAxis(-5.0f));
const auto BaseColor = 0x2f83cc_rgbf; const auto BaseColor = 0x2f83cc_srgbf;
const auto OutlineColor = 0xdcdcdc_rgbf; const auto OutlineColor = 0xdcdcdc_srgbf;
} }
std::string ShaderVisualizer::phong() { std::string ShaderVisualizer::phong() {
MeshTools::compile(Primitives::uvSphereSolid(16, 32)).draw(Shaders::Phong{} MeshTools::compile(Primitives::uvSphereSolid(16, 32)).draw(Shaders::Phong{}
.setAmbientColor(0x22272e_rgbf) .setAmbientColor(0x22272e_srgbf)
.setDiffuseColor(BaseColor) .setDiffuseColor(BaseColor)
.setShininess(200.0f) .setShininess(200.0f)
.setLightPosition({5.0f, 5.0f, 7.0f}) .setLightPosition({5.0f, 5.0f, 7.0f})
@ -169,6 +170,7 @@ std::string ShaderVisualizer::meshVisualizer() {
.draw(Shaders::MeshVisualizer{Shaders::MeshVisualizer::Flag::Wireframe} .draw(Shaders::MeshVisualizer{Shaders::MeshVisualizer::Flag::Wireframe}
.setColor(BaseColor) .setColor(BaseColor)
.setWireframeColor(OutlineColor) .setWireframeColor(OutlineColor)
.setWireframeWidth(2.0f)
.setViewportSize(Vector2{ImageSize}) .setViewportSize(Vector2{ImageSize})
.setTransformationProjectionMatrix(projection)); .setTransformationProjectionMatrix(projection));
@ -191,7 +193,7 @@ std::string ShaderVisualizer::vertexColor() {
std::vector<Color3> colors; std::vector<Color3> colors;
colors.reserve(sphere.positions(0).size()); colors.reserve(sphere.positions(0).size());
for(Vector3 position: sphere.positions(0)) for(Vector3 position: sphere.positions(0))
colors.push_back(Color3::fromHsv(Math::lerp(240.0_degf, 420.0_degf, Math::max(1.0f - (position - target).length(), 0.0f)), 0.75f, 0.75f)); colors.push_back(Color3::fromHsv(Math::lerp(240.0_degf, 420.0_degf, Math::max(1.0f - (position - target).length(), 0.0f)), 0.85f, 0.666f));
GL::Buffer vertices, indices; GL::Buffer vertices, indices;
vertices.setData(MeshTools::interleave(sphere.positions(0), colors), GL::BufferUsage::StaticDraw); vertices.setData(MeshTools::interleave(sphere.positions(0), colors), GL::BufferUsage::StaticDraw);

BIN
doc/shaders-distancefieldvector.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.6 KiB

After

Width:  |  Height:  |  Size: 18 KiB

BIN
doc/shaders-flat.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

BIN
doc/shaders-meshvisualizer.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 35 KiB

BIN
doc/shaders-phong.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 34 KiB

BIN
doc/shaders-vector.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.3 KiB

After

Width:  |  Height:  |  Size: 24 KiB

BIN
doc/shaders-vertexcolor.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 29 KiB

2
src/Magnum/Shaders/DistanceFieldVector.h

@ -51,7 +51,7 @@ texture with a white color in an identity transformation, use
@ref setTransformationProjectionMatrix(), @ref setColor() and others to @ref setTransformationProjectionMatrix(), @ref setColor() and others to
configure the shader. configure the shader.
@image html shaders-distancefieldvector.png @image html shaders-distancefieldvector.png width=256px
@section Shaders-DistanceFieldVector-usage Example usage @section Shaders-DistanceFieldVector-usage Example usage

2
src/Magnum/Shaders/Flat.h

@ -63,7 +63,7 @@ multipled by the color, which is by default set to @cpp 0xffffffff_rgbaf @ce.
For coloring the texture based on intensity you can use the @ref Vector shader. For coloring the texture based on intensity you can use the @ref Vector shader.
@image html shaders-flat.png @image html shaders-flat.png width=256px
@section Shaders-Flat-usage Example usage @section Shaders-Flat-usage Example usage

2
src/Magnum/Shaders/MeshVisualizer.h

@ -45,7 +45,7 @@ renders the mesh with a white color in an identity transformation. Use
@ref setTransformationProjectionMatrix(), @ref setColor() and others to @ref setTransformationProjectionMatrix(), @ref setColor() and others to
configure the shader. configure the shader.
@image html shaders-meshvisualizer.png @image html shaders-meshvisualizer.png width=256px
@section Shaders-MeshVisualizer-wireframe Wireframe visualization @section Shaders-MeshVisualizer-wireframe Wireframe visualization

2
src/Magnum/Shaders/Phong.h

@ -54,7 +54,7 @@ don't forget to also call appropriate subset of @ref bindAmbientTexture(),
@ref bindTextures()). The texture is multipled by the color, which is by @ref bindTextures()). The texture is multipled by the color, which is by
default set to fully opaque white for enabled textures. default set to fully opaque white for enabled textures.
@image html shaders-phong.png @image html shaders-phong.png width=256px
@section Shaders-Phong-usage Example usage @section Shaders-Phong-usage Example usage

3
src/Magnum/Shaders/Vector.h

@ -50,8 +50,7 @@ white color in an identity transformation. Use
@ref setTransformationProjectionMatrix(), @ref setColor() and others to @ref setTransformationProjectionMatrix(), @ref setColor() and others to
configure the shader. configure the shader.
@image html shaders-vector.png @image html shaders-vector.png width=256px
@image latex shaders-vector.png
@section Shaders-Vector-usage Example usage @section Shaders-Vector-usage Example usage

2
src/Magnum/Shaders/VertexColor.h

@ -47,7 +47,7 @@ attributes in your triangle mesh. By default, the shader renders the mesh in
an identity transformation. Use @ref setTransformationProjectionMatrix() to an identity transformation. Use @ref setTransformationProjectionMatrix() to
configure the shader. configure the shader.
@image html shaders-vertexcolor.png @image html shaders-vertexcolor.png width=256px
@section Shaders-VertexColor-example Example usage @section Shaders-VertexColor-example Example usage

Loading…
Cancel
Save