45#ifndef _SOURCE_SHADERS_TFPHONG_H_
46#define _SOURCE_SHADERS_TFPHONG_H_
48#include "Magnum/GL/AbstractShaderProgram.h"
49#include "Magnum/Shaders/Generic.h"
50#include "Magnum/Shaders/visibility.h"
53using namespace Magnum;
59 class Phong:
public GL::AbstractShaderProgram {
64 typedef Magnum::Shaders::Generic3D::Position
Position;
69 typedef Magnum::Shaders::Generic3D::Normal
Normal;
74 typedef Magnum::Shaders::Generic3D::Tangent
Tangent;
79 typedef typename Magnum::Shaders::Generic3D::Tangent4
Tangent4;
84 typedef typename Magnum::Shaders::Generic3D::Bitangent
Bitangent;
94 typedef Magnum::Shaders::Generic3D::Color3
Color3;
99 typedef Magnum::Shaders::Generic3D::Color4
Color4;
101 #ifndef MAGNUM_TARGET_GLES2
105 typedef Magnum::Shaders::Generic3D::ObjectId
ObjectId;
129 #ifndef MAGNUM_TARGET_GLES2
140 enum class Flag: UnsignedShort {
181 #ifndef MAGNUM_TARGET_GLES2
207 typedef Containers::EnumSet<Flag>
Flags;
219 explicit Phong(NoCreateT)
noexcept: GL::AbstractShaderProgram{NoCreate} {}
291 Phong&
bindTextures(GL::Texture2D* ambient, GL::Texture2D* diffuse, GL::Texture2D* specular, GL::Texture2D* normal
292 #ifdef MAGNUM_BUILD_DEPRECATED
309 #ifndef MAGNUM_TARGET_GLES2
349 #ifdef MAGNUM_BUILD_DEPRECATED
351 CORRADE_DEPRECATED(
"use setLightPositions(Containers::ArrayView<const Vector4>) instead")
Phong&
setLightPositions(Containers::ArrayView<const Vector3> positions);
353 CORRADE_DEPRECATED(
"use setLightPositions(std::initializer_list<Vector4>) instead")
Phong&
setLightPositions(std::initializer_list<Vector3> positions);
369 #ifdef MAGNUM_BUILD_DEPRECATED
371 CORRADE_DEPRECATED(
"use setLightPosition(UnsignedInt, const Vector4&) instead")
Phong&
setLightPosition(UnsignedInt
id, const Vector3& position);
373 CORRADE_DEPRECATED(
"use setLightPositions(std::initializer_list<Vector4>) instead")
Phong&
setLightPosition(const Vector3& position);
384 #ifdef MAGNUM_BUILD_DEPRECATED
386 CORRADE_DEPRECATED(
"use setLightColors(Containers::ArrayView<const Magnum::Color3>) instead")
Phong&
setLightColors(Containers::ArrayView<const Magnum::
Color4> colors);
388 CORRADE_DEPRECATED(
"use setLightColors(std::initializer_list<Magnum::Color3>) instead")
Phong&
setLightColors(std::initializer_list<Magnum::
Color4> colors);
397 #ifdef MAGNUM_BUILD_DEPRECATED
399 CORRADE_DEPRECATED(
"use setLightColor(UnsignedInt, const Magnum::Color3&) instead")
Phong&
setLightColor(UnsignedInt
id, const Magnum::
Color4& color);
401 CORRADE_DEPRECATED(
"use setLightColor(std::initializer_list<Color3>) instead")
Phong&
setLightColor(const Magnum::
Color4& color);
432 unsigned clipPlaneCount()
const {
433 return _clipPlaneCount;
438 #ifndef MAGNUM_TARGET_GLES
439 using GL::AbstractShaderProgram::drawTransformFeedback;
441 #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
442 using GL::AbstractShaderProgram::dispatchCompute;
446 UnsignedInt _lightCount{};
447 Int _transformationMatrixUniform{0},
448 _projectionMatrixUniform{1},
449 _normalMatrixUniform{2},
450 _textureMatrixUniform{3},
451 _ambientColorUniform{4},
452 _diffuseColorUniform{5},
453 _specularColorUniform{6},
454 _shininessUniform{7},
455 _normalTextureScaleUniform{8},
456 _alphaMaskUniform{9};
457 #ifndef MAGNUM_TARGET_GLES2
458 Int _objectIdUniform{10};
460 Int _lightPositionsUniform{11},
462 _lightSpecularColorsUniform,
466 UnsignedInt _clipPlaneCount{1};
468 Int _clipPlanesUniform;
471 MAGNUM_SHADERS_EXPORT Debug& operator<<(Debug& debug,
Phong::Flag value);
472 MAGNUM_SHADERS_EXPORT Debug& operator<<(Debug& debug,
Phong::Flags value);
Phong & setSpecularColor(const Magnum::Color4 &color)
Set specular color.
Magnum::Shaders::Generic3D::Color3 Color3
Three-component vertex color.
Definition tfPhong.h:94
Phong & setLightRanges(Containers::ArrayView< const Float > ranges)
Set light attenuation ranges.
Phong & setclipPlaneEquation(UnsignedInt id, const Vector4 &position)
Set clip plane equation for given clip plane.
Phong & setObjectId(UnsignedInt id)
Set object ID.
Magnum::Shaders::Generic3D::TextureOffset TextureOffset
(Instanced) texture offset
Definition tfPhong.h:121
Magnum::Shaders::Generic3D::TransformationMatrix TransformationMatrix
(Instanced) transformation matrix
Definition tfPhong.h:111
Magnum::Shaders::Generic3D::Position Position
Vertex position.
Definition tfPhong.h:64
Phong(Phong &&) noexcept=default
Move constructor.
Magnum::Shaders::Generic3D::Tangent Tangent
Tangent direction.
Definition tfPhong.h:74
Magnum::Shaders::Generic3D::NormalMatrix NormalMatrix
(Instanced) normal matrix
Definition tfPhong.h:116
Phong(NoCreateT) noexcept
Construct without creating the underlying OpenGL object.
Definition tfPhong.h:219
Phong & setLightRange(UnsignedInt id, Float range)
Set attenuation range for given light.
Phong & setLightPositions(Containers::ArrayView< const Vector4 > positions)
Set light positions.
Phong & setNormalMatrix(const Matrix3x3 &matrix)
Set normal matrix.
Phong & setShininess(Float shininess)
Set shininess.
Magnum::Shaders::Generic3D::ObjectId ObjectId
(Instanced) object ID
Definition tfPhong.h:105
Magnum::Shaders::Generic3D::Color4 Color4
Four-component vertex color.
Definition tfPhong.h:99
Containers::EnumSet< Flag > Flags
Flags.
Definition tfPhong.h:207
UnsignedInt lightCount() const
Light count.
Definition tfPhong.h:237
Phong & setTextureMatrix(const Matrix3 &matrix)
Set texture coordinate transformation matrix.
Phong & setTransformationMatrix(const Matrix4 &matrix)
Set transformation matrix.
Flags flags() const
Flags.
Definition tfPhong.h:234
Magnum::Shaders::Generic3D::Normal Normal
Normal direction.
Definition tfPhong.h:69
Phong & setLightSpecularColor(UnsignedInt id, const Magnum::Color3 &color)
Set position for given light.
Magnum::Shaders::Generic3D::TextureCoordinates TextureCoordinates
2D texture coordinates
Definition tfPhong.h:89
Phong & setAlphaMask(Float mask)
Set alpha mask value.
Phong & setProjectionMatrix(const Matrix4 &matrix)
Set projection matrix.
Phong & setDiffuseColor(const Magnum::Color4 &color)
Set diffuse color.
Phong & setLightColor(UnsignedInt id, const Magnum::Color3 &color)
Set position for given light.
Magnum::Shaders::Generic3D::Tangent4 Tangent4
Tangent direction with a bitangent sign.
Definition tfPhong.h:79
Phong & setAmbientColor(const Magnum::Color4 &color)
Set ambient color.
Phong & bindDiffuseTexture(GL::Texture2D &texture)
Bind a diffuse texture.
Phong & bindTextures(GL::Texture2D *ambient, GL::Texture2D *diffuse, GL::Texture2D *specular, GL::Texture2D *normal)
Bind textures.
Phong & bindAmbientTexture(GL::Texture2D &texture)
Bind an ambient texture.
Phong(Flags flags={}, unsigned lightCount=1, unsigned clipPlaneCount=0)
Constructor.
Phong & setNormalTextureScale(Float scale)
Set normal texture scale.
Magnum::Shaders::Generic3D::Bitangent Bitangent
Bitangent direction.
Definition tfPhong.h:84
Phong & setLightSpecularColors(Containers::ArrayView< const Magnum::Color3 > colors)
Set light specular colors.
Phong & bindNormalTexture(GL::Texture2D &texture)
Bind a normal texture.
@ ObjectIdOutput
Definition tfPhong.h:133
@ ColorOutput
Definition tfPhong.h:127
Flag
Flag.
Definition tfPhong.h:140
@ AmbientTexture
Definition tfPhong.h:144
@ InstancedTransformation
Definition tfPhong.h:196
@ TextureTransformation
Definition tfPhong.h:179
@ SpecularTexture
Definition tfPhong.h:154
@ InstancedObjectId
Definition tfPhong.h:190
@ NormalTexture
Definition tfPhong.h:159
@ AlphaMask
Definition tfPhong.h:164
@ VertexColor
Definition tfPhong.h:169
@ DiffuseTexture
Definition tfPhong.h:149
@ InstancedTextureOffset
Definition tfPhong.h:201
Phong & setLightColors(Containers::ArrayView< const Magnum::Color3 > colors)
Set light colors.
Phong & bindSpecularTexture(GL::Texture2D &texture)
Bind a specular texture.
Phong & setLightPosition(UnsignedInt id, const Vector4 &position)
Set position for given light.
Phong(const Phong &)=delete
Copying is not allowed.
Tissue Forge shaders.
Definition tfFlat3D.h:57