kine
March 5, 2009, 12:39pm
1
Switching the camera associated to a pass (sketch, depht of field, bloom, motion blur) after it has been initialized:
(it's a revision of the 4059 jme version ( I don't have the internet at home, so it's not easy) hope it's ok )
Index: src/com/jmex/effects/glsl/MotionBlurRenderPass.java
===================================================================
--- src/com/jmex/effects/glsl/MotionBlurRenderPass.java (revision 4059)
+++ src/com/jmex/effects/glsl/MotionBlurRenderPass.java (working copy)
@@ -308,6 +308,14 @@
}
}
}
+
+ public void setCamera( Camera cam ) {
+ this.tRenderer.setCamera(cam);
+ }
+
+ public void getCamera( Camera cam ) {
+ this.tRenderer.getCamera();
+ }
public Texture getMainTexture() {
return mainTexture;
Index: src/com/jmex/effects/glsl/DepthOfFieldRenderPass.java
===================================================================
--- src/com/jmex/effects/glsl/DepthOfFieldRenderPass.java (revision 4059)
+++ src/com/jmex/effects/glsl/DepthOfFieldRenderPass.java (working copy)
@@ -335,6 +335,14 @@
r.draw(fullScreenQuad);
}
+ public void setCamera( Camera cam ) {
+ this.tRenderer.setCamera(cam);
+ }
+
+ public void getCamera( Camera cam ) {
+ this.tRenderer.getCamera();
+ }
+
/**
* @return The throttle amount - or in other words, how much time in seconds
* must pass before the bloom effect is updated.
Index: src/com/jmex/effects/glsl/BloomRenderPass.java
===================================================================
--- src/com/jmex/effects/glsl/BloomRenderPass.java (revision 4059)
+++ src/com/jmex/effects/glsl/BloomRenderPass.java (working copy)
@@ -327,6 +327,14 @@
r.draw(fullScreenQuad);
}
+ public void setCamera( Camera cam ) {
+ this.tRenderer.setCamera(cam);
+ }
+
+ public void getCamera( Camera cam ) {
+ this.tRenderer.getCamera();
+ }
+
/**
* @return The throttle amount - or in other words, how much time in
* seconds must pass before the bloom effect is updated.
Index: src/com/jmex/effects/glsl/SketchRenderPass.java
===================================================================
--- src/com/jmex/effects/glsl/SketchRenderPass.java (revision 4059)
+++ src/com/jmex/effects/glsl/SketchRenderPass.java (working copy)
@@ -194,6 +194,14 @@
r.draw(fullScreenQuad);
}
+ public void setCamera( Camera cam ) {
+ this.tRendererDepth.setCamera(cam);
+ }
+
+ public void getCamera( Camera cam ) {
+ this.tRendererDepth.getCamera();
+ }
+
/**
* saves any states enforced by the user for replacement at the end of the
* pass.
:)
basixs
March 5, 2009, 6:57pm
2
What testing have you done with switching the camera after init?
(as always, your cat avatars makes me smile :))
Is it possible to combine them and turn on/off afterwards?
kine
March 6, 2009, 3:33pm
4
@basixs It's all tested, works in Bolidz for three months
(as always, your cat avatars makes me smile smiley)
8)
@DarkPhoenixX You mean to combine the passes ? of course, disable them also :)
basixs
March 6, 2009, 3:39pm
5
Robbing the KITTY?? What are you gonna get, his catnip stash?? :-o :-o
Unless anyone has any issues then, I think the patch(s) has been verified :).
Wanna submit it or shall I?
kine
March 6, 2009, 3:50pm
6
Can you do it, I can't for the moment …
Hi there,
Can you please review your getters?
Yours:
+ public void getCamera( Camera cam ) {
+ this.tRendererDepth.getCamera();
+ }
Shouldnt it be
+ public Camera getCamera( ) {
+ return this.tRendererDepth.getCamera();
+ }
?
Greetz
dhdd
March 7, 2009, 9:10am
8
nice one, didn't see that
basixs
March 8, 2009, 5:46pm
9
yeah, nice catch alright…
kine, wanna remake your patches or should I just edit them?
kine
March 12, 2009, 10:54am
11
Hope they are correct this time
Index: src/com/jmex/effects/glsl/BloomRenderPass.java
===================================================================
--- src/com/jmex/effects/glsl/BloomRenderPass.java (revision 4059)
+++ src/com/jmex/effects/glsl/BloomRenderPass.java (working copy)
@@ -399,4 +399,12 @@
public boolean isUseSeparateConvolution() {
return useSeparateConvolution;
}
+
+ public void setCamera(Camera camera) {
+ this.tRenderer.setCamera(camera);
+ }
+
+ public Camera getCamera(Camera camera) {
+ return this.tRenderer.getCamera();
+ }
}
Index: src/com/jmex/effects/glsl/DepthOfFieldRenderPass.java
===================================================================
--- src/com/jmex/effects/glsl/DepthOfFieldRenderPass.java (revision 4059)
+++ src/com/jmex/effects/glsl/DepthOfFieldRenderPass.java (working copy)
@@ -471,4 +471,12 @@
draw(r);
}
}
+
+ public void setCamera(Camera camera) {
+ this.tRenderer.setCamera(camera);
+ }
+
+ public Camera getCamera(Camera camera) {
+ return this.tRenderer.getCamera();
+ }
}
Index: src/com/jmex/effects/glsl/MotionBlurRenderPass.java
===================================================================
--- src/com/jmex/effects/glsl/MotionBlurRenderPass.java (revision 4059)
+++ src/com/jmex/effects/glsl/MotionBlurRenderPass.java (working copy)
@@ -336,4 +336,13 @@
public void setBlurStrength( float blurStrength ) {
this.blurStrength = blurStrength;
}
+
+ public void setCamera(Camera camera) {
+ this.cam = camera;
+ this.tRenderer.setCamera(camera);
+ }
+
+ public Camera getCamera(Camera camera) {
+ return this.cam;
+ }
}
Index: src/com/jmex/effects/glsl/SketchRenderPass.java
===================================================================
--- src/com/jmex/effects/glsl/SketchRenderPass.java (revision 4059)
+++ src/com/jmex/effects/glsl/SketchRenderPass.java (working copy)
@@ -236,4 +236,16 @@
public void setOff(float off) {
this.off = off;
}
+
+ public void setCamera(Camera camera) {
+ this.tRendererDepth.setCamera(camera);
+ normShader.clearUniforms();
+ normShader.setUniform("nearClip", camera.getFrustumNear());
+ normShader.setUniform("diffClip", camera.getFrustumFar() - camera.getFrustumNear());
+
+ }
+
+ public Camera getCamera(Camera camera) {
+ return this.tRendererDepth.getCamera();
+ }
}
:)
but but but
+ public Camera getCamera(Camera camera) {
+ return this.tRendererDepth.getCamera();
+ }
why pass a reference to a getter ? :)
dhdd
March 12, 2009, 11:45am
13
hehe,
thank god for ECLIPSE and "Generate Getters and Setters"