public final class SinglePassLightingLogic extends DefaultTechniqueDefLogic
techniqueDef
Constructor and Description |
---|
SinglePassLightingLogic(TechniqueDef techniqueDef) |
Modifier and Type | Method and Description |
---|---|
Shader |
makeCurrent(AssetManager assetManager,
RenderManager renderManager,
java.util.EnumSet<Caps> rendererCaps,
LightList lights,
DefineList defines)
Determine the shader to use for the given geometry / material combination.
|
void |
render(RenderManager renderManager,
Shader shader,
Geometry geometry,
LightList lights,
int lastTexUnit)
Requests that the
TechniqueDefLogic renders the given geometry. |
protected int |
updateLightListUniforms(Shader shader,
Geometry g,
LightList lightList,
int numLights,
RenderManager rm,
int startIndex)
Uploads the lights in the light list as two uniform arrays.
* |
getAmbientColor, renderMeshFromGeometry
public SinglePassLightingLogic(TechniqueDef techniqueDef)
public Shader makeCurrent(AssetManager assetManager, RenderManager renderManager, java.util.EnumSet<Caps> rendererCaps, LightList lights, DefineList defines)
TechniqueDefLogic
makeCurrent
in interface TechniqueDefLogic
makeCurrent
in class DefaultTechniqueDefLogic
assetManager
- The asset manager to use for loading shader source code,
shader nodes, and and lookup textures.renderManager
- The render manager for which rendering is to be performed.rendererCaps
- Renderer capabilities. The returned shader must
support these capabilities.lights
- The lights with which the geometry shall be rendered. This
list must not include culled lights.defines
- The define list used by the technique, any
unmapped defines
should be set here to change shader behavior.protected int updateLightListUniforms(Shader shader, Geometry g, LightList lightList, int numLights, RenderManager rm, int startIndex)
uniform vec4 g_LightColor[numLights];
//
g_LightColor.rgb is the diffuse/specular color of the light.
//
g_Lightcolor.a is the type of light, 0 = Directional, 1 = Point,
//
2 = Spot.
uniform vec4 g_LightPosition[numLights];
//
g_LightPosition.xyz is the position of the light (for point lights)
// or the direction of the light (for directional lights).
//
g_LightPosition.w is the inverse radius (1/r) of the light (for
attenuation)
public void render(RenderManager renderManager, Shader shader, Geometry geometry, LightList lights, int lastTexUnit)
TechniqueDefLogic
TechniqueDefLogic
renders the given geometry.
Fixed material functionality such as RenderState
,
material parameters
, and
uniform bindings
have already been applied by the material, however,
RenderState
, uniforms
, textures
,
can still be overridden.render
in interface TechniqueDefLogic
render
in class DefaultTechniqueDefLogic
renderManager
- The render manager to perform the rendering against.shader
- The shader that was selected by this logic in
TechniqueDefLogic.makeCurrent(com.jme3.asset.AssetManager, com.jme3.renderer.RenderManager, java.util.EnumSet, com.jme3.light.LightList, com.jme3.shader.DefineList)
.geometry
- The geometry to renderlights
- Lights which influence the geometry.