cee::geo::EffectTexture

class EffectTexture : public Effect

Effect describing the texture to be used when drawing the associated part data.

May be overridden by the following effects if found further up the stack:

Supported by the following part data:

See also

Part, Effect, and PartSettings

Public Types

enum SamplerWrapMode

Specifies what should happen to texture coordinates that are outside the 0 to 1 range.

Values:

enumerator REPEAT

The integer part of the coordinate will be ignored and a repeating pattern is formed.

enumerator CLAMP_TO_EDGE

The texture coordinates will be clamped into the range 0 to 1.

enumerator CLAMP_TO_BORDER

The coordinates that fall outside the 0 to 1 range will be given the borderColor().

enumerator MIRRORED_REPEAT

The texture will also be repeated, but it will be mirrored when the integer part of the coordinate is odd.

enum SamplerFilter

Specifies the minifying and magnification filtering used when doing the texture mapping.

Values:

enumerator NEAREST

Nearest neighbor filtering on the base MipMap level. Texture will look blocky when zoom into.

enumerator LINEAR

Linear filtering on the base MipMap level. (Default magnification filter in OpenGL). Texture will look blurry when zoomed into.

enumerator NEAREST_MIPMAP_NEAREST

Selects nearest MipMap level and performs nearest neighbor filtering.

enumerator LINEAR_MIPMAP_NEAREST

Selects nearest MipMap level and performs linear filtering.

enumerator NEAREST_MIPMAP_LINEAR

Perform linear interpolation between MipMap levels and perform nearest neighbor filtering. (Default minifying filter in OpenGL).

enumerator LINEAR_MIPMAP_LINEAR

Perform linear interpolation between MipMap levels and perform linear filtering (trilinear mipmapping).

Public Functions

EffectTexture()

Constructs an empty effect.

EffectTexture(const Image *textureImage)

Constructs a texture effect with the given image.

virtual Type type() const

Returns Effect::TEXTURE.

virtual PtrRef<Effect> clone()

Clones the effect.

const Image *image() const

Returns the image used to texture the part.

void setImage(const Image *textureImage)

Specifies the image used to texture the part.

SamplerWrapMode samplerWrapMode() const

Returns the wrapping mode to use for textures when the texture coordinate is outside the 0 to 1 range.

void setSamplerWrapMode(SamplerWrapMode wrapMode)

Specifies what should happen to texture coordinates that are outside the 0 to 1 range.

The SamplerWrapMode defines how to handle texture coordinates that are outside the 0 to 1 range.

The default value is EffectTexture::REPEAT.

SamplerFilter samplerMinifyingFilter() const

Returns the minifying filter function used for the texture mapping.

void setSamplerMinifyingFilter(SamplerFilter filterType)

Specifies the minifying filter function to use in the texture sampler when doing texture mapping.

The texture coordinates are independent of the texture resolution. This method specifies what do when the texture is minified, i.e. getting a smaller resolution in pixels on the screen than the original image.

The default value is EffectTexture::LINEAR_MIPMAP_LINEAR

SamplerFilter samplerMagnificationFilter() const

Returns the magnification filter function used for the texture mapping.

void setSamplerMagnificationFilter(SamplerFilter filterType)

Specifies the magnify filter function to use in the texture sampler when doing texture mapping.

The texture coordinates are independent of the texture resolution. This method specifies what do when the texture is magnified, i.e. getting a bigger resolution in pixels on the screen than the original image. There are two options: LINEAR will do a weighted average of the 4 pixels surrounding the given coordinates. NEAREST will just pick the pixel closest to the coordinates.

The default value is EffectTexture::LINEAR.

Note! Legal values: EffectTexture::LINEAR or EffectTexture::NEAREST.

Color4f borderColor() const

Returns the border color to use when wrapping is set to CLAMP_TO_BORDER.

See also

setBorderColor

void setBorderColor(const Color4f &color)

Sets the border color to use when wrapping is set to CLAMP_TO_BORDER.

Any pixel with a texture coordinate outside the 0 to 1 range will get this color.

float ambientIntensity() const

Returns the ambient intensity of the color.

1.0f is max intensity 0.0f is min intensity

Note! Ignored for OpenGL Fixed Function pipeline

void setAmbientIntensity(float intensity)

Specifies the ambient intensity of the color.

1.0f is max intensity 0.0f is min intensity

Note! Ignored for OpenGL Fixed Function pipeline

See also

ambientIntensity

float specularIntensity() const

Returns the specular intensity of the color.

1.0f is max intensity 0.0f is min intensity

Note! Ignored for OpenGL Fixed Function pipeline

void setSpecularIntensity(float intensity)

Specifies the specular intensity of the color.

1.0f is max intensity 0.0f is min intensity

Note! Ignored for OpenGL Fixed Function pipeline

Public Static Functions

static PtrRef<EffectTexture> createResultMapping(const Image *textureImage)

Creates a texture effect that is suitable to use with a ScalarMapper.

The method creates an EffectTexture and then configures the following settings:

  • setSamplerMinifyingFilter(cee::geo::EffectTexture::NEAREST)

  • setSamplerMagnificationFilter(cee::geo::EffectTexture::NEAREST)

  • setSamplerWrapMode(cee::geo::EffectTexture::CLAMP_TO_EDGE)

  • setSpecularIntensity(0.1f)

See also

ScalarMapper and ScalarMapperContinuousDomain