Commit 654b1cbb authored by Cory Quammen's avatar Cory Quammen

Add an example of a custom shader showing the outer ring of a fat point

parent d510acd4
......@@ -39,12 +39,25 @@ def sendEvent(eventId):
currentState = states[s]
currentStateTable = stateTables[s]
d = Show(s)
d.ShaderPreset = 'Sphere'
nextState = currentStateTable.GetValue(int(numEvents*currentState + eventId))
print('Point %d: %d - %d -> %d' % (i, eventId, currentState, nextState))
if nextState == 0:
d.DiffuseColor = [0.8, 0.8, 0.8]
elif nextState == 1:
d.DiffuseColor = [1.0, 0.0, 0.0]
d.ShaderPreset = 'Custom'
d.CustomShader = """
//VTK::Color::Impl
float dist = dot(offsetVCVSOutput.xy,offsetVCVSOutput.xy);
if (dist > 1.0 || dist < 0.8) {
discard;
} else {
float scale = (1.0 - dist);
ambientColor *= scale;
diffuseColor *= scale;
}
"""
elif nextState == 2:
d.DiffuseColor = [0.0, 1.0, 0.0]
elif nextState == 3:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment