|
31 | 31 | */ |
32 | 32 | package com.jme3.renderer; |
33 | 33 |
|
34 | | -import com.jme3.renderer.pipeline.ForwardPipeline; |
35 | | -import com.jme3.renderer.pipeline.DefaultPipelineContext; |
36 | | -import com.jme3.renderer.pipeline.RenderPipeline; |
37 | | -import com.jme3.renderer.pipeline.PipelineContext; |
38 | | -import com.jme3.light.DefaultLightFilter; |
39 | | -import com.jme3.light.LightFilter; |
40 | | -import com.jme3.light.LightList; |
| 34 | +import com.jme3.light.DefaultLightFilter; |
| 35 | +import com.jme3.light.LightFilter; |
| 36 | +import com.jme3.light.LightList; |
41 | 37 | import com.jme3.material.MatParamOverride; |
42 | 38 | import com.jme3.material.Material; |
43 | 39 | import com.jme3.material.MaterialDef; |
|
46 | 42 | import com.jme3.material.TechniqueDef; |
47 | 43 | import com.jme3.math.FastMath; |
48 | 44 | import com.jme3.math.Matrix4f; |
49 | | -import com.jme3.post.SceneProcessor; |
50 | | -import com.jme3.profile.AppProfiler; |
51 | | -import com.jme3.profile.AppStep; |
52 | | -import com.jme3.profile.VpStep; |
53 | | -import com.jme3.renderer.queue.GeometryList; |
| 45 | +import com.jme3.post.SceneProcessor; |
| 46 | +import com.jme3.profile.AppProfiler; |
| 47 | +import com.jme3.profile.AppStep; |
| 48 | +import com.jme3.profile.VpStep; |
| 49 | +import com.jme3.renderer.pipeline.DefaultPipelineContext; |
| 50 | +import com.jme3.renderer.pipeline.ForwardPipeline; |
| 51 | +import com.jme3.renderer.pipeline.PipelineContext; |
| 52 | +import com.jme3.renderer.pipeline.RenderPipeline; |
| 53 | +import com.jme3.renderer.queue.GeometryList; |
54 | 54 | import com.jme3.renderer.queue.RenderQueue; |
55 | 55 | import com.jme3.renderer.queue.RenderQueue.Bucket; |
56 | 56 | import com.jme3.renderer.queue.RenderQueue.ShadowMode; |
@@ -111,7 +111,7 @@ public class RenderManager { |
111 | 111 | private final HashMap<Class<? extends PipelineContext>, PipelineContext> contexts = new HashMap<>(); |
112 | 112 | private final LinkedList<PipelineContext> usedContexts = new LinkedList<>(); |
113 | 113 | private final LinkedList<RenderPipeline<? extends PipelineContext>> usedPipelines = new LinkedList<>(); |
114 | | - private RenderPipeline<? extends PipelineContext> defaultPipeline = new ForwardPipeline(); |
| 114 | + private RenderPipeline<? extends PipelineContext> defaultPipeline = new ForwardPipeline(); |
115 | 115 | private Camera prevCam = null; |
116 | 116 | private Material forcedMaterial = null; |
117 | 117 | private String forcedTechnique = null; |
@@ -1382,19 +1382,22 @@ public void applyViewPort(ViewPort vp) { |
1382 | 1382 | * @param vp View port to render |
1383 | 1383 | * @param tpf Time per frame value |
1384 | 1384 | */ |
1385 | | - public void renderViewPort(ViewPort vp, float tpf) { |
1386 | | - if (!vp.isEnabled()) { |
1387 | | - return; |
1388 | | - } |
1389 | | - RenderPipeline pipeline = vp.getPipeline(); |
1390 | | - if (pipeline == null) { |
1391 | | - pipeline = defaultPipeline; |
1392 | | - } |
1393 | | - |
1394 | | - PipelineContext context = pipeline.fetchPipelineContext(this); |
1395 | | - if (context == null) { |
1396 | | - throw new NullPointerException("Failed to fetch pipeline context."); |
1397 | | - } |
| 1385 | + public void renderViewPort(ViewPort vp, float tpf) { |
| 1386 | + if (!vp.isEnabled()) { |
| 1387 | + return; |
| 1388 | + } |
| 1389 | + RenderPipeline<? extends PipelineContext> pipeline = vp.getPipeline(); |
| 1390 | + if (pipeline == null) { |
| 1391 | + pipeline = defaultPipeline; |
| 1392 | + } |
| 1393 | + renderViewPort(vp, tpf, pipeline); |
| 1394 | + } |
| 1395 | + |
| 1396 | + private <T extends PipelineContext> void renderViewPort(ViewPort vp, float tpf, RenderPipeline<T> pipeline) { |
| 1397 | + T context = pipeline.fetchPipelineContext(this); |
| 1398 | + if (context == null) { |
| 1399 | + throw new NullPointerException("Failed to fetch pipeline context."); |
| 1400 | + } |
1398 | 1401 | if (!context.startViewPortRender(this, vp)) { |
1399 | 1402 | usedContexts.add(context); |
1400 | 1403 | } |
|
0 commit comments