コード例 #1
0
ファイル: ShadowPass.java プロジェクト: yvhk2900/Rajawali
 public ShadowPass(
     ShadowPassType shadowPassType,
     Scene scene,
     Camera camera,
     DirectionalLight light,
     RenderTarget renderTarget) {
   super(scene, camera, 0);
   mShadowPassType = shadowPassType;
   mShadowRenderTarget = renderTarget;
   mShadowMapSize = renderTarget.getWidth();
   if (shadowPassType == ShadowPassType.CREATE_SHADOW_MAP) {
     mShadowMapMaterial = new ShadowMapMaterial();
     mShadowMapMaterial.setLight(light);
     mShadowMapMaterial.setCamera(camera);
     mShadowMapMaterial.setScene(scene);
     setMaterial(mShadowMapMaterial);
   }
 }
コード例 #2
0
ファイル: Scene.java プロジェクト: Cysion1989/Rajawali
  private void addShadowMapMaterialPlugin(Object3D o, ShadowMapMaterialPlugin materialPlugin) {
    Material m = o.getMaterial();

    if (m != null && m.lightingEnabled()) {
      if (materialPlugin != null) {
        m.addPlugin(materialPlugin);
      } else if (mShadowMapMaterial != null) {
        m.removePlugin(mShadowMapMaterial.getMaterialPlugin());
      }
    }

    for (int i = 0; i < o.getNumChildren(); i++)
      addShadowMapMaterialPlugin(o.getChildAt(i), materialPlugin);
  }
コード例 #3
0
ファイル: ShadowPass.java プロジェクト: yvhk2900/Rajawali
 @Override
 public void render(
     Scene scene,
     Renderer renderer,
     ScreenQuad screenQuad,
     RenderTarget writeBuffer,
     RenderTarget readBuffer,
     long ellapsedTime,
     double deltaTime) {
   if (mShadowPassType == ShadowPassType.APPLY_SHADOW_MAP) {
     mShadowMapMaterial.setShadowMapTexture(mShadowRenderTarget.getTexture());
     super.render(scene, renderer, screenQuad, writeBuffer, readBuffer, ellapsedTime, deltaTime);
   } else {
     renderer.setOverrideViewportDimensions(mShadowMapSize, mShadowMapSize);
     super.render(
         scene, renderer, screenQuad, mShadowRenderTarget, readBuffer, ellapsedTime, deltaTime);
     renderer.clearOverrideViewportDimensions();
   }
 }