コード例 #1
0
 /** for internal use only */
 protected void setPostShadowParams() {
   setMaterialParameters(postshadowMat);
   for (int j = 0; j < nbShadowMaps; j++) {
     postshadowMat.setMatrix4("LightViewProjectionMatrix" + j, lightViewProjectionsMatrices[j]);
     postshadowMat.setTexture("ShadowMap" + j, shadowMaps[j]);
   }
 }
コード例 #2
0
 public void postFrame(FrameBuffer out) {
   if (!noOccluders) {
     postshadowMat.setMatrix4("LightViewProjectionMatrix", shadowCam.getViewProjectionMatrix());
     renderManager.setForcedMaterial(postshadowMat);
     viewPort
         .getQueue()
         .renderShadowQueue(ShadowMode.Receive, renderManager, viewPort.getCamera(), true);
     renderManager.setForcedMaterial(null);
   }
 }
コード例 #3
0
  private void setMatParams() {

    GeometryList l = viewPort.getQueue().getShadowQueueContent(ShadowMode.Receive);

    // iteration throught all the geometries of the list to gather the materials

    matCache.clear();
    for (int i = 0; i < l.size(); i++) {
      Material mat = l.get(i).getMaterial();
      // checking if the material has the post technique and adding it to the material cache
      if (mat.getMaterialDef().getTechniqueDef(postTechniqueName) != null) {
        if (!matCache.contains(mat)) {
          matCache.add(mat);
        }
      } else {
        needsfallBackMaterial = true;
      }
    }

    // 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("LightViewProjectionMatrix" + j, lightViewProjectionsMatrices[j]);
      }
      for (int j = 0; j < nbShadowMaps; j++) {
        mat.setTexture("ShadowMap" + j, shadowMaps[j]);
      }
      mat.setBoolean("HardwareShadows", shadowCompareMode == CompareMode.Hardware);
      mat.setInt("FilterMode", edgeFilteringMode.getMaterialParamValue());
      mat.setFloat("PCFEdge", edgesThickness);
      mat.setFloat("ShadowIntensity", shadowIntensity);

      setMaterialParameters(mat);
    }

    // At least one material of the receiving geoms does not support the post shadow techniques
    // so we fall back to the forced material solution (transparent shadows won't be supported for
    // these objects)
    if (needsfallBackMaterial) {
      setPostShadowParams();
    }
  }