Class Shaders
java.lang.Object
org.openpatch.scratch.Shaders
The shaders of a sprite or of the stage. The first one added is used at once; more than one
can be active, applied in the order they were added.
Shader waves = this.getShaders().add("waves", "assets/waves.frag");
waves.set("strength", 0.02);
-
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a shader, or returns the one of that name added before.voiddeactivate(String name) intbooleanvoidnext()Uses the next shader alone.voidreset()Uses no shader.voidswitchTo(double index) void
-
Method Details
-
add
-
get
-
switchTo
- Parameters:
name- the shader to use, alone
-
switchTo
public void switchTo(double index) - Parameters:
index- the shader to use alone, counting from 0; wraps around
-
next
public void next()Uses the next shader alone. -
reset
public void reset()Uses no shader. -
activate
- Parameters:
name- a shader to use in addition to the active ones
-
deactivate
- Parameters:
name- a shader to stop using
-
isActive
- Parameters:
name- a shader's name- Returns:
- whether it is in use
-
getActive
-
getCurrent
- Returns:
- the first shader in use, or null
-
getCurrentIndex
public int getCurrentIndex()- Returns:
- the number of the first shader in use, or -1
-
getCurrentName
- Returns:
- the name of the first shader in use, or null
-