OGLSurfaceTextureShader.kl¶
Types¶
OGLSurfaceTextureShader (object)¶
バージョン 1.12.0 で追加.
The OGLSurfaceTextureShader inherits the OGLInlineShader. It extends the OGLInlineShader for shading with a simple phong model using a texture for the diffuse.
Uniforms¶
| Name | Type | Description | Default |
|---|---|---|---|
| u_light0Position | Vec3 | Position of the first light | Position of the camera |
| u_light0Color | Color | Color of the first light | Color(1.0, 1.0, 1.0) |
| u_ambientColor | Color | Ambient color component | Color(0.05, 0.05, 0.05) |
| u_diffuseColor | Color | Diffuse color component | Color(1.0, 1.0, 1.0) |
| u_specularColor | Color | Specular color component | Color(0.2, 0.2, 0.2) |
| u_specularFactor | Color | Specular distribution factor | 16.0 |
| u_normalIsTangent | Integer | Flag defining normal type | 0 |
| u_doubleSided | Integer | Flag defining backface shading model | 0 |
| u_diffuseTexture | Texture | Texture used for the diffuse | null |
| u_mirrorU | Integer | Flag toggle a flip of the U component | 0 |
| u_mirrorV | Integer | Flag toggle a flip of the V component | 1 |
| u_discardAlpha | Integer | Flag to discard 0.0 alpha pixels | 0 |
Attributes¶
| Name | Type | Description |
|---|---|---|
| positions | Vec3 | Geometry positions |
| normals | Vec3 | Geometry normals |
| uvs0 | Vec2 | UV set |
/*
** Example: OGLSurfaceTextureShader
*/
require InlineDrawing;
operator entry() {
InlineDrawing draw = OGLInlineDrawing();
InlineShader shader = draw.registerShader(OGLSurfaceTextureShader);
InlineMaterial mat = shader.getOrCreateMaterial('texturedWithBlueSpecular');
InlineTexture texture = draw.registerTexture(InlineFileBasedTexture('texture.png'));
mat.setUniform('u_diffuseTexture', texture);
mat.setUniform('u_specularColor', Color(0.0, 0.0, 1.0));
}
/*
** Output:
*/
Methods¶
| OGLSurfaceTextureShader ( in OGLSurfaceTextureShader other ) | |
| OGLSurfaceTextureShader ( in String name ) | |
| OGLSurfaceTextureShader () | |
| OGLSurfaceTextureShader | clone ? () |