use of com.jme3.renderer.queue.GeometryList in project jmonkeyengine by jMonkeyEngine.
the class DirectionalLightShadowRenderer method getOccludersToRender.
@Override
protected GeometryList getOccludersToRender(int shadowMapIndex, GeometryList shadowMapOccluders) {
// update frustum points based on current camera and split
ShadowUtil.updateFrustumPoints(viewPort.getCamera(), splitsArray[shadowMapIndex], splitsArray[shadowMapIndex + 1], 1.0f, points);
//Updating shadow cam with curent split frustra
if (lightReceivers.size() == 0) {
for (Spatial scene : viewPort.getScenes()) {
ShadowUtil.getGeometriesInCamFrustum(scene, viewPort.getCamera(), RenderQueue.ShadowMode.Receive, lightReceivers);
}
}
ShadowUtil.updateShadowCamera(viewPort, lightReceivers, shadowCam, points, shadowMapOccluders, stabilize ? shadowMapSize : 0);
return shadowMapOccluders;
}
use of com.jme3.renderer.queue.GeometryList in project jmonkeyengine by jMonkeyEngine.
the class SpotLightShadowRenderer method getReceivers.
@Override
protected void getReceivers(GeometryList lightReceivers) {
lightReceivers.clear();
Camera[] cameras = new Camera[1];
cameras[0] = shadowCam;
for (Spatial scene : viewPort.getScenes()) {
ShadowUtil.getLitGeometriesInViewPort(scene, viewPort.getCamera(), cameras, RenderQueue.ShadowMode.Receive, lightReceivers);
}
}
use of com.jme3.renderer.queue.GeometryList in project jmonkeyengine by jMonkeyEngine.
the class RenderQueue method renderGeometryList.
private void renderGeometryList(GeometryList list, RenderManager rm, Camera cam, boolean clear) {
// select camera for sorting
list.setCamera(cam);
list.sort();
for (int i = 0; i < list.size(); i++) {
Geometry obj = list.get(i);
assert obj != null;
rm.renderGeometry(obj);
obj.queueDistance = Float.NEGATIVE_INFINITY;
}
if (clear) {
list.clear();
}
}
use of com.jme3.renderer.queue.GeometryList in project jmonkeyengine by jMonkeyEngine.
the class AbstractShadowRenderer method setMatParams.
private void setMatParams(GeometryList l) {
//iteration throught all the geometries of the list to gather the materials
buildMatCache(l);
//iterating through the mat cache and setting the parameters
for (Material mat : matCache) {
mat.setFloat("ShadowMapSize", shadowMapSize);
for (int j = 0; j < nbShadowMaps; j++) {
mat.setMatrix4(lightViewStringCache[j], lightViewProjectionsMatrices[j]);
}
for (int j = 0; j < nbShadowMaps; j++) {
mat.setTexture(shadowMapStringCache[j], shadowMaps[j]);
}
mat.setBoolean("HardwareShadows", shadowCompareMode == CompareMode.Hardware);
mat.setInt("FilterMode", edgeFilteringMode.getMaterialParamValue());
mat.setFloat("PCFEdge", edgesThickness);
mat.setFloat("ShadowIntensity", shadowIntensity);
if (fadeInfo != null) {
mat.setVector2("FadeInfo", fadeInfo);
}
if (renderBackFacesShadows != null) {
mat.setBoolean("BackfaceShadows", renderBackFacesShadows);
}
setMaterialParameters(mat);
}
//so we fall back to the forced material solution (transparent shadows won't be supported for these objects)
if (needsfallBackMaterial) {
setPostShadowParams();
}
}
use of com.jme3.renderer.queue.GeometryList in project jmonkeyengine by jMonkeyEngine.
the class PssmShadowUtil method computeZFar.
/**
* Compute the Zfar in the model vieuw to adjust the Zfar distance for the splits calculation
*/
public static float computeZFar(GeometryList occ, GeometryList recv, Camera cam) {
Matrix4f mat = cam.getViewMatrix();
BoundingBox bbOcc = ShadowUtil.computeUnionBound(occ, mat);
BoundingBox bbRecv = ShadowUtil.computeUnionBound(recv, mat);
return min(max(bbOcc.getZExtent() - bbOcc.getCenter().z, bbRecv.getZExtent() - bbRecv.getCenter().z), cam.getFrustumFar());
}
Aggregations