OGLWireFrameShader (object)¶
バージョン 1.12.0 で追加.
The OGLWireFrameShader inherits the OGLInlineShader. It encapsulates any other InlineShader (interface), while setting the polygon mode to lines.
/*
** Example: OGLWireFrameShader
*/
require InlineDrawing;
operator entry() {
InlineDrawing draw = OGLInlineDrawing();
OGLWireFrameShader shader = draw.registerShader(OGLWireFrameShader('wireframe', OGLSurfaceShader()));
shader.setPolygonOffset(-1.0); // draw as overlay
InlineMaterial mat = shader.getOrCreateMaterial('blue');
mat.setUniform('u_diffuseColor', Color(0.0, 0.0, 1.0));
}
/*
** Output:
*/
Methods¶
Methods in detail¶
OGLWireFrameShader ( in OGLInlineShader shader )
default constructor
OGLWireFrameShader ( in OGLWireFrameShader other )
copy constructor
OGLWireFrameShader ( in String name, in OGLInlineShader shader )
default constructor taking a name
default constructor
Boolean OGLWireFrameShader.bindUniformToLocation! ( io DrawContext context, in InlineUniform uniform, in Integer location )
draws a uniform for the shader, applies the value essentially. this particular method avoid the lookup of the location by name and draws the uniform directly
OGLWireFrameShader OGLWireFrameShader.clone? ()
clone method
OGLWireFrameShader.defineAttribute! ( in String name, in String attributeType )
define a surface attribute with a given name and type
OGLWireFrameShader.defineUniform! ( in InlineUniform uniform )
define a new uniform on the shader. the uniformType is auxiliary and can be used within the shader later if required.
Size OGLWireFrameShader.getAttributeCount? ()
returns the number of attributes
Integer OGLWireFrameShader.getAttributeID? ( in String name )
returns true if this shader has an attribute with a given name
String OGLWireFrameShader.getAttributeName? ( in Index index )
returns the name of an attribute
String OGLWireFrameShader.getAttributeType? ( in Index index )
returns the type of an attribute
InlineMaterial OGLWireFrameShader.getMaterial? ( in Index index )
returns an existing material by index
Size OGLWireFrameShader.getMaterialCount? ()
returns the number of materials in this shader
String OGLWireFrameShader.getName? ()
returns the name of this shader
InlineMaterial OGLWireFrameShader.getOrCreateMaterial! ( in String name )
returns (and eventually creates) a new matching material with a given name
Boolean OGLWireFrameShader.hasAttribute? ( in String name )
returns the ID / location of a given attribute inside the shader.
Boolean OGLWireFrameShader.hasMaterial? ( in String name )
returns true if this shader has a material with a given name
Boolean OGLWireFrameShader.hasUniform? ( in String name )
returns true if this shader has a uniform with a given name
OGLWireFrameShader.init! ( in String name, in OGLInlineShader shader )
OGLWireFrameShader.setPolygonOffset! ( in Scalar offset )
sets the polygonoffset (0.0 disables)
OGLWireFrameShader.setUniform! ( in InlineUniform uniform )
sets the global value of a uniform this can be changed per material, per instance or even per transform
OGLWireFrameShader.setWireFrame! ( in Boolean enabled )
sets the wireframe option on the shader