Update of /cvsroot/jrman/drafts/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv4501/src Modified Files: DisplacementBumptest.java DisplacementDented.java DisplacementDisp_textured.java DisplacementNoisetest.java DisplacementTurbulence.java GenCapsules.java GenCubes.java GenPoints.java GenSpheres.java SurfaceAlphaplastic.java SurfaceClouds.java SurfaceConfetti.java SurfaceGlow.java SurfaceNoisetest.java SurfacePnoisetest.java SurfaceRandomcheckers.java SurfaceRandomcolors.java SurfaceTurbulence.java SurfaceUvcheckers.java Log Message: Finished reformatting code :) Code is almost 100% clean (no more hideous Eclipse formatting, no tabs, no line longer than 80 columns, no CR/LF) Index: SurfaceUvcheckers.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/SurfaceUvcheckers.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SurfaceUvcheckers.java 13 Jan 2004 09:49:16 -0000 1.1 --- SurfaceUvcheckers.java 28 Feb 2007 00:02:40 -0000 1.2 *************** *** 1,69 **** ! /* ! * SurfaceRandomcheckers.java Copyright (C) 2003 Alessandro Falappa ! * ! * This program is free software; you can redistribute it and/or modify it ! * under the terms of the GNU General Public License as published by the Free ! * Software Foundation; either version 2 of the License, or (at your option) ! * any later version. ! * ! * This program is distributed in the hope that it will be useful, but WITHOUT ! * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ! * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for ! * more details. ! * ! * You should have received a copy of the GNU General Public License along with ! * this program; if not, write to the Free Software Foundation, Inc., 59 Temple ! * Place - Suite 330, Boston, MA 02111-1307, USA. ! */ ! ! import org.jrman.grid.Color3fGrid; ! import org.jrman.grid.Vector3fGrid; ! import org.jrman.parameters.Declaration; ! import org.jrman.parameters.UniformScalarFloat; ! import org.jrman.render.ShaderVariables; ! import org.jrman.shaders.SurfaceShader; ! ! public class SurfaceUvcheckers extends SurfaceShader { ! private static Vector3fGrid vg1= new Vector3fGrid(); ! private static Color3fGrid cg1= new Color3fGrid(); ! private static Color3fGrid cg2= new Color3fGrid(); ! private static Color3fGrid cg3= new Color3fGrid(); ! ! protected void initDefaults() { ! defaultParameters.addParameter(new UniformScalarFloat(new Declaration("Ka", "uniform float"), 1f)); ! defaultParameters.addParameter(new UniformScalarFloat(new Declaration("Kd", "uniform float"), 1f)); ! defaultParameters.addParameter(new UniformScalarFloat(new Declaration("usize", "uniform float"), 1f)); ! defaultParameters.addParameter(new UniformScalarFloat(new Declaration("vsize", "uniform float"), 1f)); ! } ! ! public void shade(ShaderVariables sv) { ! super.shade(sv); ! UniformScalarFloat paramKa= (UniformScalarFloat)getParameter(sv, "Ka"); ! final float Ka= paramKa.getValue(); ! UniformScalarFloat paramKd= (UniformScalarFloat)getParameter(sv, "Kd"); ! final float Kd= paramKd.getValue(); ! UniformScalarFloat paramUsize= (UniformScalarFloat)getParameter(sv, "usize"); ! final float usize= paramUsize.getValue(); ! UniformScalarFloat paramVsize= (UniformScalarFloat)getParameter(sv, "vsize"); ! final float vsize= paramVsize.getValue(); ! vg1.normalize(sv.N); ! vg1.faceforward(vg1, sv.I); ! sv.Oi.set(sv.Os); ! ambient(sv, cg1); ! cg3.set(Ka); ! cg1.mul(cg1, cg3); ! diffuse(sv, vg1, cg2); ! cg3.set(Kd); ! cg2.mul(cg2, cg3); ! cg1.add(cg1, cg2); ! ! // if(sv.u) ! // vg1.set(noisescale); ! // vg1.mul(vg1, sv.P); ! // cg3.cellnoise(vg1); ! ! cg1.mul(cg1, cg3); ! sv.Ci.mul(sv.Os, cg1); ! } ! ! } --- 1,81 ---- ! /* ! * SurfaceUvcheckers.java Copyright (C) 2003 Alessandro Falappa ! * ! * This program is free software; you can redistribute it and/or modify it ! * under the terms of the GNU General Public License as published by the Free ! * Software Foundation; either version 2 of the License, or (at your option) ! * any later version. ! * ! * This program is distributed in the hope that it will be useful, but WITHOUT ! * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ! * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for ! * more details. ! * ! * You should have received a copy of the GNU General Public License along with ! * this program; if not, write to the Free Software Foundation, Inc., 59 Temple ! * Place - Suite 330, Boston, MA 02111-1307, USA. ! */ ! ! import org.jrman.grid.Color3fGrid; ! import org.jrman.grid.Vector3fGrid; ! import org.jrman.parameters.Declaration; ! import org.jrman.parameters.UniformScalarFloat; ! import org.jrman.render.ShaderVariables; ! import org.jrman.shaders.SurfaceShader; ! ! public class SurfaceUvcheckers extends SurfaceShader { ! private static Vector3fGrid vg1= new Vector3fGrid(); ! private static Color3fGrid cg1= new Color3fGrid(); ! private static Color3fGrid cg2= new Color3fGrid(); ! private static Color3fGrid cg3= new Color3fGrid(); ! ! protected void initDefaults() { ! defaultParameters.addParameter( ! new UniformScalarFloat(new Declaration("Ka", "uniform float"), ! 1f)); ! defaultParameters.addParameter( ! new UniformScalarFloat(new Declaration("Kd", "uniform float"), ! 1f)); ! defaultParameters.addParameter( ! new UniformScalarFloat(new Declaration("usize", ! "uniform float"), ! 1f)); ! defaultParameters.addParameter( ! new UniformScalarFloat(new Declaration("vsize", ! "uniform float"), ! 1f)); ! } ! ! public void shade(ShaderVariables sv) { ! super.shade(sv); ! UniformScalarFloat paramKa= (UniformScalarFloat)getParameter(sv, "Ka"); ! final float Ka= paramKa.getValue(); ! UniformScalarFloat paramKd= (UniformScalarFloat)getParameter(sv, "Kd"); ! final float Kd= paramKd.getValue(); ! UniformScalarFloat paramUsize= ! (UniformScalarFloat)getParameter(sv, "usize"); ! final float usize= paramUsize.getValue(); ! UniformScalarFloat paramVsize= ! (UniformScalarFloat)getParameter(sv, "vsize"); ! final float vsize= paramVsize.getValue(); ! vg1.normalize(sv.N); ! vg1.faceforward(vg1, sv.I); ! sv.Oi.set(sv.Os); ! ambient(sv, cg1); ! cg3.set(Ka); ! cg1.mul(cg1, cg3); ! diffuse(sv, vg1, cg2); ! cg3.set(Kd); ! cg2.mul(cg2, cg3); ! cg1.add(cg1, cg2); ! ! // if(sv.u) ! // vg1.set(noisescale); ! // vg1.mul(vg1, sv.P); ! // cg3.cellnoise(vg1); ! ! cg1.mul(cg1, cg3); ! sv.Ci.mul(sv.Os, cg1); ! } ! ! } Index: GenCapsules.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/GenCapsules.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** GenCapsules.java 15 May 2003 03:15:32 -0000 1.1 --- GenCapsules.java 28 Feb 2007 00:02:40 -0000 1.2 *************** *** 1,19 **** /* ! GenCapsules.java ! Copyright (C) 2003 Gerardo Horvilleur Martinez ! ! This program is free software; you can redistribute it and/or ! modify it under the terms of the GNU General Public License ! as published by the Free Software Foundation; either version 2 ! of the License, or (at your option) any later version. ! ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software ! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ --- 1,19 ---- /* ! GenCapsules.java ! Copyright (C) 2003 Gerardo Horvilleur Martinez ! ! This program is free software; you can redistribute it and/or ! modify it under the terms of the GNU General Public License ! as published by the Free Software Foundation; either version 2 ! of the License, or (at your option) any later version. ! ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software ! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ Index: GenSpheres.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/GenSpheres.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** GenSpheres.java 5 May 2003 02:17:40 -0000 1.1 --- GenSpheres.java 28 Feb 2007 00:02:40 -0000 1.2 *************** *** 1,19 **** /* ! GenSpheres.java ! Copyright (C) 2003 Gerardo Horvilleur Martinez ! ! This program is free software; you can redistribute it and/or ! modify it under the terms of the GNU General Public License ! as published by the Free Software Foundation; either version 2 ! of the License, or (at your option) any later version. ! ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software ! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ --- 1,19 ---- /* ! GenSpheres.java ! Copyright (C) 2003 Gerardo Horvilleur Martinez ! ! This program is free software; you can redistribute it and/or ! modify it under the terms of the GNU General Public License ! as published by the Free Software Foundation; either version 2 ! of the License, or (at your option) any later version. ! ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software ! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ *************** *** 28,32 **** for (int j = 0; j < m; j++) { System.out.println("TransformBegin"); ! System.out.println("Color " + Math.random() + " " + Math.random() + " " + Math.random()); System.out.println("Translate " + x + " 0 " + z); System.out.println("Sphere .5 -5 .5 360"); --- 28,33 ---- for (int j = 0; j < m; j++) { System.out.println("TransformBegin"); ! System.out.println("Color " + Math.random() + " " + ! Math.random() + " " + Math.random()); System.out.println("Translate " + x + " 0 " + z); System.out.println("Sphere .5 -5 .5 360"); Index: SurfaceGlow.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/SurfaceGlow.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SurfaceGlow.java 1 Jun 2003 16:59:50 -0000 1.2 --- SurfaceGlow.java 28 Feb 2007 00:02:40 -0000 1.3 *************** *** 1,10 **** - import javax.vecmath.Color3f; - - import org.jrman.grid.BooleanGrid; - import org.jrman.grid.Color3fGrid; - import org.jrman.grid.FloatGrid; - import org.jrman.render.ShaderVariables; - import org.jrman.shaders.SurfaceShader; - /* SurfaceGlow.java --- 1,2 ---- *************** *** 26,29 **** --- 18,29 ---- */ + import javax.vecmath.Color3f; + + import org.jrman.grid.BooleanGrid; + import org.jrman.grid.Color3fGrid; + import org.jrman.grid.FloatGrid; + import org.jrman.render.ShaderVariables; + import org.jrman.shaders.SurfaceShader; + public class SurfaceGlow extends SurfaceShader { Index: SurfaceConfetti.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/SurfaceConfetti.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SurfaceConfetti.java 11 Dec 2003 15:25:24 -0000 1.1 --- SurfaceConfetti.java 28 Feb 2007 00:02:40 -0000 1.2 *************** *** 1,63 **** ! /* ! * SurfaceConfetti.java Copyright (C) 2003 Alessandro Falappa ! * ! * This program is free software; you can redistribute it and/or modify it ! * under the terms of the GNU General Public License as published by the Free ! * Software Foundation; either version 2 of the License, or (at your option) ! * any later version. ! * ! * This program is distributed in the hope that it will be useful, but WITHOUT ! * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ! * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for ! * more details. ! * ! * You should have received a copy of the GNU General Public License along with ! * this program; if not, write to the Free Software Foundation, Inc., 59 Temple ! * Place - Suite 330, Boston, MA 02111-1307, USA. ! */ ! ! import org.jrman.grid.Color3fGrid; ! import org.jrman.grid.Vector3fGrid; ! import org.jrman.parameters.Declaration; ! import org.jrman.parameters.UniformScalarFloat; ! import org.jrman.render.ShaderVariables; ! import org.jrman.shaders.SurfaceShader; ! ! public class SurfaceConfetti extends SurfaceShader { ! private static Vector3fGrid vg1= new Vector3fGrid(); ! private static Color3fGrid cg1= new Color3fGrid(); ! private static Color3fGrid cg2= new Color3fGrid(); ! private static Color3fGrid cg3= new Color3fGrid(); ! ! protected void initDefaults() { ! defaultParameters.addParameter(new UniformScalarFloat(new Declaration("Ka", "uniform float"), 1f)); ! defaultParameters.addParameter(new UniformScalarFloat(new Declaration("Kd", "uniform float"), 1f)); ! defaultParameters.addParameter(new UniformScalarFloat(new Declaration("noisescale", "uniform float"), 1f)); ! } ! ! public void shade(ShaderVariables sv) { ! super.shade(sv); ! UniformScalarFloat paramKa= (UniformScalarFloat)getParameter(sv, "Ka"); ! final float Ka= paramKa.getValue(); ! UniformScalarFloat paramKd= (UniformScalarFloat)getParameter(sv, "Kd"); ! final float Kd= paramKd.getValue(); ! UniformScalarFloat paramNoisescale= (UniformScalarFloat)getParameter(sv, "noisescale"); ! final float noisescale= paramNoisescale.getValue(); ! vg1.normalize(sv.N); ! vg1.faceforward(vg1, sv.I); ! sv.Oi.set(sv.Os); ! ambient(sv, cg1); ! cg3.set(Ka); ! cg1.mul(cg1, cg3); ! diffuse(sv, vg1, cg2); ! cg3.set(Kd); ! cg2.mul(cg2, cg3); ! cg1.add(cg1, cg2); ! vg1.set(noisescale); ! vg1.mul(vg1, sv.P); ! cg3.noise(vg1); ! cg1.mul(cg1, cg3); ! sv.Ci.mul(sv.Os, cg1); ! } ! ! } --- 1,71 ---- ! /* ! * SurfaceConfetti.java Copyright (C) 2003 Alessandro Falappa ! * ! * This program is free software; you can redistribute it and/or modify it ! * under the terms of the GNU General Public License as published by the Free ! * Software Foundation; either version 2 of the License, or (at your option) ! * any later version. ! * ! * This program is distributed in the hope that it will be useful, but WITHOUT ! * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ! * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for ! * more details. ! * ! * You should have received a copy of the GNU General Public License along with ! * this program; if not, write to the Free Software Foundation, Inc., 59 Temple ! * Place - Suite 330, Boston, MA 02111-1307, USA. ! */ ! ! import org.jrman.grid.Color3fGrid; ! import org.jrman.grid.Vector3fGrid; ! import org.jrman.parameters.Declaration; ! import org.jrman.parameters.UniformScalarFloat; ! import org.jrman.render.ShaderVariables; ! import org.jrman.shaders.SurfaceShader; ! ! public class SurfaceConfetti extends SurfaceShader { ! private static Vector3fGrid vg1= new Vector3fGrid(); ! private static Color3fGrid cg1= new Color3fGrid(); ! private static Color3fGrid cg2= new Color3fGrid(); ! private static Color3fGrid cg3= new Color3fGrid(); ! ! protected void initDefaults() { ! defaultParameters.addParameter( ! new UniformScalarFloat(new Declaration("Ka", "uniform float"), ! 1f)); ! defaultParameters.addParameter( ! new UniformScalarFloat(new Declaration("Kd", "uniform float"), ! 1f)); ! defaultParameters.addParameter( ! new UniformScalarFloat(new Declaration("noisescale", ! "uniform float"), ! 1f)); ! } ! ! public void shade(ShaderVariables sv) { ! super.shade(sv); ! UniformScalarFloat paramKa= (UniformScalarFloat)getParameter(sv, "Ka"); ! final float Ka= paramKa.getValue(); ! UniformScalarFloat paramKd= (UniformScalarFloat)getParameter(sv, "Kd"); ! final float Kd= paramKd.getValue(); ! UniformScalarFloat paramNoisescale= ! (UniformScalarFloat)getParameter(sv, "noisescale"); ! final float noisescale= paramNoisescale.getValue(); ! vg1.normalize(sv.N); ! vg1.faceforward(vg1, sv.I); ! sv.Oi.set(sv.Os); ! ambient(sv, cg1); ! cg3.set(Ka); ! cg1.mul(cg1, cg3); ! diffuse(sv, vg1, cg2); ! cg3.set(Kd); ! cg2.mul(cg2, cg3); ! cg1.add(cg1, cg2); ! vg1.set(noisescale); ! vg1.mul(vg1, sv.P); ! cg3.noise(vg1); ! cg1.mul(cg1, cg3); ! sv.Ci.mul(sv.Os, cg1); ! } ! ! } Index: DisplacementTurbulence.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/DisplacementTurbulence.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** DisplacementTurbulence.java 11 Dec 2003 15:25:24 -0000 1.1 --- DisplacementTurbulence.java 28 Feb 2007 00:02:40 -0000 1.2 *************** *** 1,73 **** ! /* ! * DisplacementNoisetest.java Copyright (C) 2003 Alessandro Falappa ! * ! * This program is free software; you can redistribute it and/or modify it ! * under the terms of the GNU General Public License as published by the Free ! * Software Foundation; either version 2 of the License, or (at your option) ! * any later version. ! * ! * This program is distributed in the hope that it will be useful, but WITHOUT ! * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ! * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for ! * more details. ! * ! * You should have received a copy of the GNU General Public License along with ! * this program; if not, write to the Free Software Foundation, Inc., 59 Temple ! * Place - Suite 330, Boston, MA 02111-1307, USA. ! */ ! ! import org.jrman.geom.Transform; ! import org.jrman.grid.FloatGrid; ! import org.jrman.grid.Point3fGrid; ! import org.jrman.grid.Vector3fGrid; ! import org.jrman.parameters.Declaration; ! import org.jrman.parameters.UniformScalarFloat; ! import org.jrman.parameters.UniformScalarInteger; ! import org.jrman.parser.Global; ! import org.jrman.render.ShaderVariables; ! import org.jrman.shaders.DisplacementShader; ! ! public class DisplacementTurbulence extends DisplacementShader { ! private static FloatGrid fg1= new FloatGrid(); ! private static FloatGrid fg2= new FloatGrid(); ! private static Point3fGrid pg1= new Point3fGrid(); ! private static Vector3fGrid Nn= new Vector3fGrid(); ! private static Point3fGrid P2= new Point3fGrid(); ! ! protected void initDefaults() { ! defaultParameters.addParameter(new UniformScalarFloat(new Declaration("Km", "uniform float"), 0.5f)); ! defaultParameters.addParameter(new UniformScalarFloat(new Declaration("noisescale", "uniform float"), 1f)); ! defaultParameters.addParameter(new UniformScalarInteger(new Declaration("noiseoctaves", "uniform integer"), 1)); ! } ! ! public void shade(ShaderVariables sv) { ! super.shade(sv); ! UniformScalarFloat paramKm= (UniformScalarFloat)getParameter(sv, "Km"); ! final float Km= paramKm.getValue(); ! UniformScalarFloat paramNoisescale= (UniformScalarFloat)getParameter(sv, "noisescale"); ! final float noisescale= paramNoisescale.getValue(); ! UniformScalarInteger paramNoiseoctaves= (UniformScalarInteger)getParameter(sv, "noiseoctaves"); ! final int noiseoctaves= paramNoiseoctaves.getValue(); ! P2.set(sv.P); ! Transform transform= Global.getTransform("camera"); ! transform= transform.concat(sv.attributes.getTransform()); ! transform= transform.getInverse(); ! P2.transform(P2, transform); ! Nn.vtransform(sv.N, transform); ! Nn.normalize(Nn); ! pg1.mul(P2, noisescale); ! fg2.set(0f); ! for (int j= 1; j <= noiseoctaves; j++) { ! fg1.snoise(pg1); ! fg1.abs(fg1); ! fg1.mul(fg1, 0.5f / j); ! fg2.add(fg2, fg1); ! pg1.mul(pg1, 2.0123f); ! } ! fg2.mul(fg2, Km); ! P2.set(fg2); ! P2.mul(P2, Nn); ! sv.P.add(P2, sv.P); ! calculatenormal(sv, sv.P, sv.N); ! } } \ No newline at end of file --- 1,83 ---- ! /* ! * DisplacementTurbulence.java Copyright (C) 2003 Alessandro Falappa ! * ! * This program is free software; you can redistribute it and/or modify it ! * under the terms of the GNU General Public License as published by the Free ! * Software Foundation; either version 2 of the License, or (at your option) ! * any later version. ! * ! * This program is distributed in the hope that it will be useful, but WITHOUT ! * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ! * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for ! * more details. ! * ! * You should have received a copy of the GNU General Public License along with ! * this program; if not, write to the Free Software Foundation, Inc., 59 Temple ! * Place - Suite 330, Boston, MA 02111-1307, USA. ! */ ! ! import org.jrman.geom.Transform; ! import org.jrman.grid.FloatGrid; ! import org.jrman.grid.Point3fGrid; ! import org.jrman.grid.Vector3fGrid; ! import org.jrman.parameters.Declaration; ! import org.jrman.parameters.UniformScalarFloat; ! import org.jrman.parameters.UniformScalarInteger; ! import org.jrman.parser.Global; ! import org.jrman.render.ShaderVariables; ! import org.jrman.shaders.DisplacementShader; ! ! public class DisplacementTurbulence extends DisplacementShader { ! private static FloatGrid fg1= new FloatGrid(); ! private static FloatGrid fg2= new FloatGrid(); ! private static Point3fGrid pg1= new Point3fGrid(); ! private static Vector3fGrid Nn= new Vector3fGrid(); ! private static Point3fGrid P2= new Point3fGrid(); ! ! protected void initDefaults() { ! defaultParameters.addParameter( ! new UniformScalarFloat(new Declaration("Km", "uniform float"), ! 0.5f)); ! defaultParameters.addParameter( ! new UniformScalarFloat(new Declaration("noisescale", ! "uniform float"), ! 1f)); ! defaultParameters.addParameter( ! new UniformScalarInteger(new Declaration("noiseoctaves", ! "uniform integer"), ! 1)); ! } ! ! public void shade(ShaderVariables sv) { ! super.shade(sv); ! UniformScalarFloat paramKm= (UniformScalarFloat)getParameter(sv, "Km"); ! final float Km= paramKm.getValue(); ! UniformScalarFloat paramNoisescale= ! (UniformScalarFloat)getParameter(sv, "noisescale"); ! final float noisescale= paramNoisescale.getValue(); ! UniformScalarInteger paramNoiseoctaves= ! (UniformScalarInteger)getParameter(sv, "noiseoctaves"); ! final int noiseoctaves= paramNoiseoctaves.getValue(); ! P2.set(sv.P); ! Transform transform= Global.getTransform("camera"); ! transform= transform.concat(sv.attributes.getTransform()); ! transform= transform.getInverse(); ! P2.transform(P2, transform); ! Nn.vtransform(sv.N, transform); ! Nn.normalize(Nn); ! pg1.mul(P2, noisescale); ! fg2.set(0f); ! for (int j= 1; j <= noiseoctaves; j++) { ! fg1.snoise(pg1); ! fg1.abs(fg1); ! fg1.mul(fg1, 0.5f / j); ! fg2.add(fg2, fg1); ! pg1.mul(pg1, 2.0123f); ! } ! fg2.mul(fg2, Km); ! P2.set(fg2); ! P2.mul(P2, Nn); ! sv.P.add(P2, sv.P); ! calculatenormal(sv, sv.P, sv.N); ! } } \ No newline at end of file Index: DisplacementDented.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/DisplacementDented.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** DisplacementDented.java 11 Dec 2003 15:25:24 -0000 1.1 --- DisplacementDented.java 28 Feb 2007 00:02:40 -0000 1.2 *************** *** 1,75 **** ! /* ! * DisplacementDented.java Copyright (C) 2003 Alessandro Falappa ! * ! * This program is free software; you can redistribute it and/or modify it ! * under the terms of the GNU General Public License as published by the Free ! * Software Foundation; either version 2 of the License, or (at your option) ! * any later version. ! * ! * This program is distributed in the hope that it will be useful, but WITHOUT ! * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ! * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for ! * more details. ! * ! * You should have received a copy of the GNU General Public License along with ! * this program; if not, write to the Free Software Foundation, Inc., 59 Temple ! * Place - Suite 330, Boston, MA 02111-1307, USA. ! */ ! ! import org.jrman.geom.Transform; ! import org.jrman.grid.FloatGrid; ! import org.jrman.grid.Point3fGrid; ! import org.jrman.grid.Vector3fGrid; ! import org.jrman.parameters.Declaration; ! import org.jrman.parameters.UniformScalarFloat; ! import org.jrman.parameters.UniformScalarInteger; ! import org.jrman.parser.Global; ! import org.jrman.render.ShaderVariables; ! import org.jrman.shaders.DisplacementShader; ! ! public class DisplacementDented extends DisplacementShader { ! private static FloatGrid fg1= new FloatGrid(); ! private static FloatGrid fg2= new FloatGrid(); ! private static Point3fGrid pg1= new Point3fGrid(); ! private static Vector3fGrid Nn= new Vector3fGrid(); ! private static Point3fGrid P2= new Point3fGrid(); ! ! protected void initDefaults() { ! defaultParameters.addParameter(new UniformScalarFloat(new Declaration("Km", "uniform float"), 0.5f)); ! defaultParameters.addParameter(new UniformScalarFloat(new Declaration("noisescale", "uniform float"), 1f)); ! defaultParameters.addParameter(new UniformScalarInteger(new Declaration("noiseoctaves", "uniform integer"), 1)); ! } ! ! public void shade(ShaderVariables sv) { ! super.shade(sv); ! UniformScalarFloat paramKm= (UniformScalarFloat)getParameter(sv, "Km"); ! final float Km= paramKm.getValue(); ! UniformScalarFloat paramNoisescale= (UniformScalarFloat)getParameter(sv, "noisescale"); ! final float noisescale= paramNoisescale.getValue(); ! UniformScalarInteger paramNoiseoctaves= (UniformScalarInteger)getParameter(sv, "noiseoctaves"); ! final int noiseoctaves= paramNoiseoctaves.getValue(); ! P2.set(sv.P); ! Transform transform= Global.getTransform("camera"); ! transform= transform.concat(sv.attributes.getTransform()); ! transform= transform.getInverse(); ! P2.transform(P2, transform); ! Nn.vtransform(sv.N, transform); ! Nn.normalize(Nn); ! pg1.mul(P2, noisescale); ! fg2.set(0f); ! for (int j= 1; j <= noiseoctaves; j++) { ! fg1.snoise(pg1); ! fg1.abs(fg1); ! fg1.mul(fg1, 0.5f / j); ! fg2.add(fg2, fg1); ! pg1.mul(pg1, 2.0123f); ! } ! fg2.mul(fg2, fg2); ! fg2.mul(fg2, fg2); ! fg2.mul(fg2, -Km); ! P2.set(fg2); ! P2.mul(P2, Nn); ! sv.P.add(P2, sv.P); ! calculatenormal(sv, sv.P, sv.N); ! } } \ No newline at end of file --- 1,85 ---- ! /* ! * DisplacementDented.java Copyright (C) 2003 Alessandro Falappa ! * ! * This program is free software; you can redistribute it and/or modify it ! * under the terms of the GNU General Public License as published by the Free ! * Software Foundation; either version 2 of the License, or (at your option) ! * any later version. ! * ! * This program is distributed in the hope that it will be useful, but WITHOUT ! * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ! * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for ! * more details. ! * ! * You should have received a copy of the GNU General Public License along with ! * this program; if not, write to the Free Software Foundation, Inc., 59 Temple ! * Place - Suite 330, Boston, MA 02111-1307, USA. ! */ ! ! import org.jrman.geom.Transform; ! import org.jrman.grid.FloatGrid; ! import org.jrman.grid.Point3fGrid; ! import org.jrman.grid.Vector3fGrid; ! import org.jrman.parameters.Declaration; ! import org.jrman.parameters.UniformScalarFloat; ! import org.jrman.parameters.UniformScalarInteger; ! import org.jrman.parser.Global; ! import org.jrman.render.ShaderVariables; ! import org.jrman.shaders.DisplacementShader; ! ! public class DisplacementDented extends DisplacementShader { ! private static FloatGrid fg1= new FloatGrid(); ! private static FloatGrid fg2= new FloatGrid(); ! private static Point3fGrid pg1= new Point3fGrid(); ! private static Vector3fGrid Nn= new Vector3fGrid(); ! private static Point3fGrid P2= new Point3fGrid(); ! ! protected void initDefaults() { ! defaultParameters.addParameter( ! new UniformScalarFloat(new Declaration("Km", "uniform float"), ! 0.5f)); ! defaultParameters.addParameter( ! new UniformScalarFloat(new Declaration("noisescale", ! "uniform float"), ! 1f)); ! defaultParameters.addParameter( ! new UniformScalarInteger(new Declaration("noiseoctaves", ! "uniform integer"), ! 1)); ! } ! ! public void shade(ShaderVariables sv) { ! super.shade(sv); ! UniformScalarFloat paramKm= (UniformScalarFloat)getParameter(sv, "Km"); ! final float Km= paramKm.getValue(); ! UniformScalarFloat paramNoisescale= ! (UniformScalarFloat)getParameter(sv, "noisescale"); ! final float noisescale= paramNoisescale.getValue(); ! UniformScalarInteger paramNoiseoctaves= ! (UniformScalarInteger)getParameter(sv, "noiseoctaves"); ! final int noiseoctaves= paramNoiseoctaves.getValue(); ! P2.set(sv.P); ! Transform transform= Global.getTransform("camera"); ! transform= transform.concat(sv.attributes.getTransform()); ! transform= transform.getInverse(); ! P2.transform(P2, transform); ! Nn.vtransform(sv.N, transform); ! Nn.normalize(Nn); ! pg1.mul(P2, noisescale); ! fg2.set(0f); ! for (int j= 1; j <= noiseoctaves; j++) { ! fg1.snoise(pg1); ! fg1.abs(fg1); ! fg1.mul(fg1, 0.5f / j); ! fg2.add(fg2, fg1); ! pg1.mul(pg1, 2.0123f); ! } ! fg2.mul(fg2, fg2); ! fg2.mul(fg2, fg2); ! fg2.mul(fg2, -Km); ! P2.set(fg2); ! P2.mul(P2, Nn); ! sv.P.add(P2, sv.P); ! calculatenormal(sv, sv.P, sv.N); ! } } \ No newline at end of file Index: DisplacementDisp_textured.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/DisplacementDisp_textured.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** DisplacementDisp_textured.java 11 Jan 2006 06:23:23 -0000 1.2 --- DisplacementDisp_textured.java 28 Feb 2007 00:02:40 -0000 1.3 *************** *** 1,19 **** /* ! DisplacementDisp_textured.java ! Copyright (C) 2003 Gerardo Horvilleur Martinez ! ! This program is free software; you can redistribute it and/or ! modify it under the terms of the GNU General Public License ! as published by the Free Software Foundation; either version 2 ! of the License, or (at your option) any later version. ! ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software ! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ --- 1,19 ---- /* ! DisplacementDisp_textured.java ! Copyright (C) 2003 Gerardo Horvilleur Martinez ! ! This program is free software; you can redistribute it and/or ! modify it under the terms of the GNU General Public License ! as published by the Free Software Foundation; either version 2 ! of the License, or (at your option) any later version. ! ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software ! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ Index: SurfaceAlphaplastic.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/SurfaceAlphaplastic.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** SurfaceAlphaplastic.java 29 Dec 2006 19:45:30 -0000 1.4 --- SurfaceAlphaplastic.java 28 Feb 2007 00:02:40 -0000 1.5 *************** *** 54,58 **** new UniformScalarFloat(new Declaration("Ks", "uniform float"), 1f)); defaultParameters.addParameter( ! new UniformScalarFloat(new Declaration("roughness", "uniform float"), .1f)); defaultParameters.addParameter( new UniformScalarTuple3f( --- 54,60 ---- new UniformScalarFloat(new Declaration("Ks", "uniform float"), 1f)); defaultParameters.addParameter( ! new UniformScalarFloat(new Declaration("roughness", ! "uniform float"), ! .1f)); defaultParameters.addParameter( new UniformScalarTuple3f( *************** *** 62,79 **** 1f)); defaultParameters.addParameter( ! new UniformScalarString(new Declaration("texturename", "string"), "")); defaultParameters.addParameter( ! new UniformScalarFloat(new Declaration("blur", "uniform float"), 0f)); } public void shade(ShaderVariables sv) { super.shade(sv); ! UniformScalarFloat paramKa = (UniformScalarFloat) getParameter(sv, "Ka"); final float Ka = paramKa.getValue(); ! UniformScalarFloat paramKd = (UniformScalarFloat) getParameter(sv, "Kd"); final float Kd = paramKd.getValue(); ! UniformScalarFloat paramKs = (UniformScalarFloat) getParameter(sv, "Ks"); final float Ks = paramKs.getValue(); ! UniformScalarFloat paramRoughness = (UniformScalarFloat) getParameter(sv, "roughness"); final float roughness = paramRoughness.getValue(); UniformScalarTuple3f paramSpecularcolor = --- 64,87 ---- 1f)); defaultParameters.addParameter( ! new UniformScalarString(new Declaration("texturename", "string"), ! "")); defaultParameters.addParameter( ! new UniformScalarFloat(new Declaration("blur", "uniform float"), ! 0f)); } public void shade(ShaderVariables sv) { super.shade(sv); ! UniformScalarFloat paramKa = ! (UniformScalarFloat) getParameter(sv, "Ka"); final float Ka = paramKa.getValue(); ! UniformScalarFloat paramKd = ! (UniformScalarFloat) getParameter(sv, "Kd"); final float Kd = paramKd.getValue(); ! UniformScalarFloat paramKs = ! (UniformScalarFloat) getParameter(sv, "Ks"); final float Ks = paramKs.getValue(); ! UniformScalarFloat paramRoughness = ! (UniformScalarFloat) getParameter(sv, "roughness"); final float roughness = paramRoughness.getValue(); UniformScalarTuple3f paramSpecularcolor = *************** *** 83,87 **** (UniformScalarString) getParameter(sv, "texturename"); final String texturename = paramTexturename.getValue(); ! UniformScalarFloat paramBlur = (UniformScalarFloat) getParameter(sv, "blur"); final float blur = paramBlur.getValue(); vg1.normalize(sv.N); --- 91,96 ---- (UniformScalarString) getParameter(sv, "texturename"); final String texturename = paramTexturename.getValue(); ! UniformScalarFloat paramBlur = ! (UniformScalarFloat) getParameter(sv, "blur"); final float blur = paramBlur.getValue(); vg1.normalize(sv.N); Index: SurfaceTurbulence.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/SurfaceTurbulence.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SurfaceTurbulence.java 2 Feb 2004 19:30:06 -0000 1.2 --- SurfaceTurbulence.java 28 Feb 2007 00:02:40 -0000 1.3 *************** *** 35,42 **** protected void initDefaults() { ! defaultParameters.addParameter(new UniformScalarFloat(new Declaration("Ka", "uniform float"), 1f)); ! defaultParameters.addParameter(new UniformScalarFloat(new Declaration("Kd", "uniform float"), 1f)); ! defaultParameters.addParameter(new UniformScalarFloat(new Declaration("noisescale", "uniform float"), 1f)); ! defaultParameters.addParameter(new UniformScalarInteger(new Declaration("noiseoctaves", "uniform integer"), 1)); } --- 35,52 ---- protected void initDefaults() { ! defaultParameters.addParameter( ! new UniformScalarFloat(new Declaration("Ka", "uniform float"), ! 1f)); ! defaultParameters.addParameter( ! new UniformScalarFloat(new Declaration("Kd", "uniform float"), ! 1f)); ! defaultParameters.addParameter( ! new UniformScalarFloat(new Declaration("noisescale", ! "uniform float"), ! 1f)); ! defaultParameters.addParameter( ! new UniformScalarInteger(new Declaration("noiseoctaves", ! "uniform integer"), ! 1)); } *************** *** 47,53 **** UniformScalarFloat paramKd= (UniformScalarFloat)getParameter(sv, "Kd"); final float Kd= paramKd.getValue(); ! UniformScalarFloat paramNoisescale= (UniformScalarFloat)getParameter(sv, "noisescale"); final float noisescale= paramNoisescale.getValue(); ! UniformScalarInteger paramNoiseoctaves= (UniformScalarInteger)getParameter(sv, "noiseoctaves"); final int noiseoctaves= paramNoiseoctaves.getValue(); vg1.normalize(sv.N); --- 57,65 ---- UniformScalarFloat paramKd= (UniformScalarFloat)getParameter(sv, "Kd"); final float Kd= paramKd.getValue(); ! UniformScalarFloat paramNoisescale= ! (UniformScalarFloat)getParameter(sv, "noisescale"); final float noisescale= paramNoisescale.getValue(); ! UniformScalarInteger paramNoiseoctaves= ! (UniformScalarInteger)getParameter(sv, "noiseoctaves"); final int noiseoctaves= paramNoiseoctaves.getValue(); vg1.normalize(sv.N); Index: SurfaceRandomcheckers.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/SurfaceRandomcheckers.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SurfaceRandomcheckers.java 11 Dec 2003 15:25:24 -0000 1.1 --- SurfaceRandomcheckers.java 28 Feb 2007 00:02:40 -0000 1.2 *************** *** 1,63 **** ! /* ! * SurfaceRandomcheckers.java Copyright (C) 2003 Alessandro Falappa ! * ! * This program is free software; you can redistribute it and/or modify it ! * under the terms of the GNU General Public License as published by the Free ! * Software Foundation; either version 2 of the License, or (at your option) ! * any later version. ! * ! * This program is distributed in the hope that it will be useful, but WITHOUT ! * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ! * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for ! * more details. ! * ! * You should have received a copy of the GNU General Public License along with ! * this program; if not, write to the Free Software Foundation, Inc., 59 Temple ! * Place - Suite 330, Boston, MA 02111-1307, USA. ! */ ! ! import org.jrman.grid.Color3fGrid; ! import org.jrman.grid.Vector3fGrid; ! import org.jrman.parameters.Declaration; ! import org.jrman.parameters.UniformScalarFloat; ! import org.jrman.render.ShaderVariables; ! import org.jrman.shaders.SurfaceShader; ! ! public class SurfaceRandomcheckers extends SurfaceShader { ! private static Vector3fGrid vg1= new Vector3fGrid(); ! private static Color3fGrid cg1= new Color3fGrid(); ! private static Color3fGrid cg2= new Color3fGrid(); ! private static Color3fGrid cg3= new Color3fGrid(); ! ! protected void initDefaults() { ! defaultParameters.addParameter(new UniformScalarFloat(new Declaration("Ka", "uniform float"), 1f)); ! defaultParameters.addParameter(new UniformScalarFloat(new Declaration("Kd", "uniform float"), 1f)); ! defaultParameters.addParameter(new UniformScalarFloat(new Declaration("noisescale", "uniform float"), 1f)); ! } ! ! public void shade(ShaderVariables sv) { ! super.shade(sv); ! UniformScalarFloat paramKa= (UniformScalarFloat)getParameter(sv, "Ka"); ! final float Ka= paramKa.getValue(); ! UniformScalarFloat paramKd= (UniformScalarFloat)getParameter(sv, "Kd"); ! final float Kd= paramKd.getValue(); ! UniformScalarFloat paramNoisescale= (UniformScalarFloat)getParameter(sv, "noisescale"); ! final float noisescale= paramNoisescale.getValue(); ! vg1.normalize(sv.N); ! vg1.faceforward(vg1, sv.I); ! sv.Oi.set(sv.Os); ! ambient(sv, cg1); ! cg3.set(Ka); ! cg1.mul(cg1, cg3); ! diffuse(sv, vg1, cg2); ! cg3.set(Kd); ! cg2.mul(cg2, cg3); ! cg1.add(cg1, cg2); ! vg1.set(noisescale); ! vg1.mul(vg1, sv.P); ! cg3.cellnoise(vg1); ! cg1.mul(cg1, cg3); ! sv.Ci.mul(sv.Os, cg1); ! } ! ! } --- 1,71 ---- ! /* ! * SurfaceRandomcheckers.java Copyright (C) 2003 Alessandro Falappa ! * ! * This program is free software; you can redistribute it and/or modify it ! * under the terms of the GNU General Public License as published by the Free ! * Software Foundation; either version 2 of the License, or (at your option) ! * any later version. ! * ! * This program is distributed in the hope that it will be useful, but WITHOUT ! * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ! * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for ! * more details. ! * ! * You should have received a copy of the GNU General Public License along with ! * this program; if not, write to the Free Software Foundation, Inc., 59 Temple ! * Place - Suite 330, Boston, MA 02111-1307, USA. ! */ ! ! import org.jrman.grid.Color3fGrid; ! import org.jrman.grid.Vector3fGrid; ! import org.jrman.parameters.Declaration; ! import org.jrman.parameters.UniformScalarFloat; ! import org.jrman.render.ShaderVariables; ! import org.jrman.shaders.SurfaceShader; ! ! public class SurfaceRandomcheckers extends SurfaceShader { ! private static Vector3fGrid vg1= new Vector3fGrid(); ! private static Color3fGrid cg1= new Color3fGrid(); ! private static Color3fGrid cg2= new Color3fGrid(); ! private static Color3fGrid cg3= new Color3fGrid(); ! ! protected void initDefaults() { ! defaultParameters.addParameter( ! new UniformScalarFloat(new Declaration("Ka", "uniform float"), ! 1f)); ! defaultParameters.addParameter( ! new UniformScalarFloat(new Declaration("Kd", "uniform float"), ! 1f)); ! defaultParameters.addParameter( ! new UniformScalarFloat(new Declaration("noisescale", ! "uniform float"), ! 1f)); ! } ! ! public void shade(ShaderVariables sv) { ! super.shade(sv); ! UniformScalarFloat paramKa= (UniformScalarFloat)getParameter(sv, "Ka"); ! final float Ka= paramKa.getValue(); ! UniformScalarFloat paramKd= (UniformScalarFloat)getParameter(sv, "Kd"); ! final float Kd= paramKd.getValue(); ! UniformScalarFloat paramNoisescale= ! (UniformScalarFloat)getParameter(sv, "noisescale"); ! final float noisescale= paramNoisescale.getValue(); ! vg1.normalize(sv.N); ! vg1.faceforward(vg1, sv.I); ! sv.Oi.set(sv.Os); ! ambient(sv, cg1); ! cg3.set(Ka); ! cg1.mul(cg1, cg3); ! diffuse(sv, vg1, cg2); ! cg3.set(Kd); ! cg2.mul(cg2, cg3); ! cg1.add(cg1, cg2); ! vg1.set(noisescale); ! vg1.mul(vg1, sv.P); ! cg3.cellnoise(vg1); ! cg1.mul(cg1, cg3); ! sv.Ci.mul(sv.Os, cg1); ! } ! ! } Index: SurfaceClouds.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/SurfaceClouds.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SurfaceClouds.java 11 Dec 2003 15:25:24 -0000 1.1 --- SurfaceClouds.java 28 Feb 2007 00:02:40 -0000 1.2 *************** *** 1,77 **** ! /* ! * DisplacementDented.java Copyright (C) 2003 Alessandro Falappa ! * ! * This program is free software; you can redistribute it and/or modify it ! * under the terms of the GNU General Public License as published by the Free ! * Software Foundation; either version 2 of the License, or (at your option) ! * any later version. ! * ! * This program is distributed in the hope that it will be useful, but WITHOUT ! * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ! * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for ! * more details. ! * ! * You should have received a copy of the GNU General Public License along with ! * this program; if not, write to the Free Software Foundation, Inc., 59 Temple ! * Place - Suite 330, Boston, MA 02111-1307, USA. ! */ ! ! import org.jrman.grid.Color3fGrid; ! import org.jrman.grid.FloatGrid; ! import org.jrman.grid.Vector3fGrid; ! import org.jrman.parameters.Declaration; ! import org.jrman.parameters.UniformScalarFloat; ! import org.jrman.parameters.UniformScalarInteger; ! import org.jrman.render.ShaderVariables; ! import org.jrman.shaders.SurfaceShader; ! ! public class SurfaceClouds extends SurfaceShader { ! private static Vector3fGrid vg1= new Vector3fGrid(); ! private static Color3fGrid cg1= new Color3fGrid(); ! private static Color3fGrid cg2= new Color3fGrid(); ! private static Color3fGrid cg3= new Color3fGrid(); ! private static FloatGrid fg1= new FloatGrid(); ! private static FloatGrid fg2= new FloatGrid(); ! ! protected void initDefaults() { ! defaultParameters.addParameter(new UniformScalarFloat(new Declaration("Ka", "uniform float"), 1f)); ! defaultParameters.addParameter(new UniformScalarFloat(new Declaration("Kd", "uniform float"), 1f)); ! defaultParameters.addParameter(new UniformScalarFloat(new Declaration("noisescale", "uniform float"), 1f)); ! defaultParameters.addParameter(new UniformScalarInteger(new Declaration("noiseoctaves", "uniform integer"), 1)); ! } ! ! public void shade(ShaderVariables sv) { ! super.shade(sv); ! UniformScalarFloat paramKa= (UniformScalarFloat)getParameter(sv, "Ka"); ! final float Ka= paramKa.getValue(); ! UniformScalarFloat paramKd= (UniformScalarFloat)getParameter(sv, "Kd"); ! final float Kd= paramKd.getValue(); ! UniformScalarFloat paramNoisescale= (UniformScalarFloat)getParameter(sv, "noisescale"); ! final float noisescale= paramNoisescale.getValue(); ! UniformScalarInteger paramNoiseoctaves= (UniformScalarInteger)getParameter(sv, "noiseoctaves"); ! final int noiseoctaves= paramNoiseoctaves.getValue(); ! vg1.normalize(sv.N); ! vg1.faceforward(vg1, sv.I); ! sv.Oi.set(sv.Os); ! ambient(sv, cg1); ! cg3.set(Ka); ! cg1.mul(cg1, cg3); ! diffuse(sv, vg1, cg2); ! cg3.set(Kd); ! cg2.mul(cg2, cg3); ! cg1.add(cg1, cg2); ! vg1.set(noisescale); ! vg1.mul(vg1, sv.P); ! fg2.set(0f); ! for (int j= 1; j <= noiseoctaves; j++) { ! fg1.noise(vg1); ! fg1.mul(fg1, 0.5f / j); ! fg2.add(fg2, fg1); ! vg1.mul(vg1, 2.0123f); ! } ! cg3.set(fg2); ! cg1.mul(cg1, cg3); ! sv.Ci.mul(sv.Os, cg1); ! } ! ! } --- 1,89 ---- ! /* ! * SurfaceClouds.java Copyright (C) 2003 Alessandro Falappa ! * ! * This program is free software; you can redistribute it and/or modify it ! * under the terms of the GNU General Public License as published by the Free ! * Software Foundation; either version 2 of the License, or (at your option) ! * any later version. ! * ! * This program is distributed in the hope that it will be useful, but WITHOUT ! * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ! * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for ! * more details. ! * ! * You should have received a copy of the GNU General Public License along with ! * this program; if not, write to the Free Software Foundation, Inc., 59 Temple ! * Place - Suite 330, Boston, MA 02111-1307, USA. ! */ ! ! import org.jrman.grid.Color3fGrid; ! import org.jrman.grid.FloatGrid; ! import org.jrman.grid.Vector3fGrid; ! import org.jrman.parameters.Declaration; ! import org.jrman.parameters.UniformScalarFloat; ! import org.jrman.parameters.UniformScalarInteger; ! import org.jrman.render.ShaderVariables; ! import org.jrman.shaders.SurfaceShader; ! ! public class SurfaceClouds extends SurfaceShader { ! private static Vector3fGrid vg1= new Vector3fGrid(); ! private static Color3fGrid cg1= new Color3fGrid(); ! private static Color3fGrid cg2= new Color3fGrid(); ! private static Color3fGrid cg3= new Color3fGrid(); ! private static FloatGrid fg1= new FloatGrid(); ! private static FloatGrid fg2= new FloatGrid(); ! ! protected void initDefaults() { ! defaultParameters.addParameter( ! new UniformScalarFloat(new Declaration("Ka", "uniform float"), ! 1f)); ! defaultParameters.addParameter( ! new UniformScalarFloat(new Declaration("Kd", "uniform float"), ! 1f)); ! defaultParameters.addParameter( ! new UniformScalarFloat(new Declaration("noisescale", ! "uniform float"), ! 1f)); ! defaultParameters.addParameter( ! new UniformScalarInteger(new Declaration("noiseoctaves", ! "uniform integer"), ! 1)); ! } ! ! public void shade(ShaderVariables sv) { ! super.shade(sv); ! UniformScalarFloat paramKa= (UniformScalarFloat)getParameter(sv, "Ka"); ! final float Ka= paramKa.getValue(); ! UniformScalarFloat paramKd= (UniformScalarFloat)getParameter(sv, "Kd"); ! final float Kd= paramKd.getValue(); ! UniformScalarFloat paramNoisescale= ! (UniformScalarFloat)getParameter(sv, "noisescale"); ! final float noisescale= paramNoisescale.getValue(); ! UniformScalarInteger paramNoiseoctaves= ! (UniformScalarInteger)getParameter(sv, "noiseoctaves"); ! final int noiseoctaves= paramNoiseoctaves.getValue(); ! vg1.normalize(sv.N); ! vg1.faceforward(vg1, sv.I); ! sv.Oi.set(sv.Os); ! ambient(sv, cg1); ! cg3.set(Ka); ! cg1.mul(cg1, cg3); ! diffuse(sv, vg1, cg2); ! cg3.set(Kd); ! cg2.mul(cg2, cg3); ! cg1.add(cg1, cg2); ! vg1.set(noisescale); ! vg1.mul(vg1, sv.P); ! fg2.set(0f); ! for (int j= 1; j <= noiseoctaves; j++) { ! fg1.noise(vg1); ! fg1.mul(fg1, 0.5f / j); ! fg2.add(fg2, fg1); ! vg1.mul(vg1, 2.0123f); ! } ! cg3.set(fg2); ! cg1.mul(cg1, cg3); ! sv.Ci.mul(sv.Os, cg1); ! } ! ! } Index: SurfaceRandomcolors.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/SurfaceRandomcolors.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** SurfaceRandomcolors.java 4 Jul 2005 06:32:02 -0000 1.6 --- SurfaceRandomcolors.java 28 Feb 2007 00:02:40 -0000 1.7 *************** *** 1,19 **** /* ! SurfaceRandomcolors.java ! Copyright (C) 2003 Gerardo Horvilleur Martinez ! ! This program is free software; you can redistribute it and/or ! modify it under the terms of the GNU General Public License ! as published by the Free Software Foundation; either version 2 ! of the License, or (at your option) any later version. ! ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software ! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ --- 1,19 ---- /* ! SurfaceRandomcolors.java ! Copyright (C) 2003 Gerardo Horvilleur Martinez ! ! This program is free software; you can redistribute it and/or ! modify it under the terms of the GNU General Public License ! as published by the Free Software Foundation; either version 2 ! of the License, or (at your option) any later version. ! ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software ! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ *************** *** 48,54 **** public void shade(ShaderVariables sv) { super.shade(sv); ! UniformScalarFloat paramKa = (UniformScalarFloat) getParameter(sv, "Ka"); final float Ka = paramKa.getValue(); ! UniformScalarFloat paramKd = (UniformScalarFloat) getParameter(sv, "Kd"); final float Kd = paramKd.getValue(); vg1.normalize(sv.N); --- 48,56 ---- public void shade(ShaderVariables sv) { super.shade(sv); ! UniformScalarFloat paramKa = ! (UniformScalarFloat) getParameter(sv, "Ka"); final float Ka = paramKa.getValue(); ! UniformScalarFloat paramKd = ! (UniformScalarFloat) getParameter(sv, "Kd"); final float Kd = paramKd.getValue(); vg1.normalize(sv.N); Index: GenCubes.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/GenCubes.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** GenCubes.java 17 May 2003 21:47:57 -0000 1.1 --- GenCubes.java 28 Feb 2007 00:02:40 -0000 1.2 *************** *** 1,19 **** /* ! GenCubes.java ! Copyright (C) 2003 Gerardo Horvilleur Martinez ! ! This program is free software; you can redistribute it and/or ! modify it under the terms of the GNU General Public License ! as published by the Free Software Foundation; either version 2 ! of the License, or (at your option) any later version. ! ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software ! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ --- 1,19 ---- /* ! GenCubes.java ! Copyright (C) 2003 Gerardo Horvilleur Martinez ! ! This program is free software; you can redistribute it and/or ... [truncated message content] |