|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.threerings.opengl.renderer.util.SnippetUtil
public class SnippetUtil
Contains methods to create snippets of GLSL shader code.
| Field Summary | |
|---|---|
protected static SoftCache<ArrayKey,String> |
_fogParams
Cached fog param snippets. |
protected static SoftCache<ArrayKey,String> |
_fragmentLighting
Cached fragment lighting snippets. |
protected static SoftCache<ArrayKey,String> |
_texCoords
Cached tex coord snippets. |
protected static SoftCache<ArrayKey,String> |
_vertexLighting
Cached vertex lighting snippets. |
| Constructor Summary | |
|---|---|
SnippetUtil()
|
|
| Method Summary | |
|---|---|
protected static void |
addDirectionalLight(int idx,
String dest,
String side,
String eyeNormal,
StringBuilder buf)
Adds the influence of a directional light. |
protected static void |
addPointLight(int idx,
String dest,
String side,
String eyeVertex,
String eyeNormal,
StringBuilder buf)
Adds the influence of a point light. |
protected static void |
addSpotLight(int idx,
String dest,
String side,
String eyeVertex,
String eyeNormal,
StringBuilder buf)
Adds the influence of a spot light. |
protected static boolean |
anySphereMapped(TextureUnit[] units)
Determines whether any of the specified texture units use sphere-map texture coordinate generation. |
protected static String |
createFogParamDef(String name,
String eyeVertex,
int mode)
Creates and returns the definition for the supplied fog parameters. |
protected static String |
createFragmentLightingDef(String name,
String eyeVertex,
String eyeNormal,
Light.Type[] lights)
Creates and returns the definition for the supplied fragment lighting parameters. |
protected static String |
createLightingSide(String dest,
String side,
String eyeVertex,
String eyeNormal,
Light.Type[] lights)
Creates and returns the expression for a single lit side. |
protected static String |
createTexCoordDef(String name,
String eyeVertex,
String eyeNormal,
TextureUnit[] units)
Creates and returns the definition for the supplied tex coord parameters. |
protected static String |
createTexCoordElement(int idx,
char element,
int mode,
String eyeVertex)
Returns the code for a single texture coordinate element. |
protected static ArrayKey |
createTexCoordKey(String name,
String eyeVertex,
String eyeNormal,
TextureUnit[] units)
Creates and returns a key for the supplied tex coord parameters. |
protected static void |
createTexCoordUnit(int idx,
TextureUnit unit,
String eyeVertex,
StringBuilder buf)
Appends the code for a single texture coordinate unit. |
protected static String |
createVertexLightingDef(String name,
String eyeVertex,
String eyeNormal,
int cullFace,
boolean vertexProgramTwoSide,
Light.Type[] lights)
Creates and returns the definition for the supplied vertex lighting parameters. |
static void |
getFogBlend(String name,
RenderState[] states,
List<String> defs)
Creates a fog blend snippet. |
static void |
getFogParam(String name,
String eyeVertex,
RenderState[] states,
List<String> defs)
Creates a fog parameter snippet. |
static void |
getFragmentLighting(String name,
String eyeVertex,
String eyeNormal,
RenderState[] states,
List<String> defs)
Creates a fragment lighting snippet. |
protected static Light.Type[] |
getLightTypes(Light[] lights)
Returns an array of types corresponding to each light. |
static void |
getTexCoord(String name,
String eyeVertex,
String eyeNormal,
RenderState[] states,
List<String> defs)
Retrieves a tex coord snippet. |
static void |
getVertexLighting(String name,
String eyeVertex,
String eyeNormal,
RenderState[] states,
boolean vertexProgramTwoSide,
List<String> defs)
Creates a vertex lighting snippet. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static SoftCache<ArrayKey,String> _fogParams
protected static SoftCache<ArrayKey,String> _texCoords
protected static SoftCache<ArrayKey,String> _vertexLighting
protected static SoftCache<ArrayKey,String> _fragmentLighting
| Constructor Detail |
|---|
public SnippetUtil()
| Method Detail |
|---|
public static void getFogParam(String name,
String eyeVertex,
RenderState[] states,
List<String> defs)
public static void getFogBlend(String name,
RenderState[] states,
List<String> defs)
public static void getTexCoord(String name,
String eyeVertex,
String eyeNormal,
RenderState[] states,
List<String> defs)
public static void getVertexLighting(String name,
String eyeVertex,
String eyeNormal,
RenderState[] states,
boolean vertexProgramTwoSide,
List<String> defs)
public static void getFragmentLighting(String name,
String eyeVertex,
String eyeNormal,
RenderState[] states,
List<String> defs)
protected static String createFogParamDef(String name,
String eyeVertex,
int mode)
protected static ArrayKey createTexCoordKey(String name,
String eyeVertex,
String eyeNormal,
TextureUnit[] units)
protected static String createTexCoordDef(String name,
String eyeVertex,
String eyeNormal,
TextureUnit[] units)
protected static boolean anySphereMapped(TextureUnit[] units)
protected static void createTexCoordUnit(int idx,
TextureUnit unit,
String eyeVertex,
StringBuilder buf)
protected static String createTexCoordElement(int idx,
char element,
int mode,
String eyeVertex)
protected static Light.Type[] getLightTypes(Light[] lights)
protected static String createVertexLightingDef(String name,
String eyeVertex,
String eyeNormal,
int cullFace,
boolean vertexProgramTwoSide,
Light.Type[] lights)
protected static String createFragmentLightingDef(String name,
String eyeVertex,
String eyeNormal,
Light.Type[] lights)
protected static String createLightingSide(String dest,
String side,
String eyeVertex,
String eyeNormal,
Light.Type[] lights)
protected static void addDirectionalLight(int idx,
String dest,
String side,
String eyeNormal,
StringBuilder buf)
protected static void addPointLight(int idx,
String dest,
String side,
String eyeVertex,
String eyeNormal,
StringBuilder buf)
protected static void addSpotLight(int idx,
String dest,
String side,
String eyeVertex,
String eyeNormal,
StringBuilder buf)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||