You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
(116) |
May
(220) |
Jun
(52) |
Jul
(30) |
Aug
(35) |
Sep
(24) |
Oct
(49) |
Nov
(44) |
Dec
(70) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(21) |
Feb
(30) |
Mar
(9) |
Apr
(44) |
May
(2) |
Jun
|
Jul
(10) |
Aug
(20) |
Sep
(25) |
Oct
(12) |
Nov
(16) |
Dec
(4) |
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(4) |
Jul
(25) |
Aug
|
Sep
|
Oct
|
Nov
(26) |
Dec
(10) |
2006 |
Jan
(5) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(33) |
2007 |
Jan
(4) |
Feb
(57) |
Mar
(17) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <ma...@us...> - 2004-02-02 19:32:11
|
Update of /cvsroot/jrman/drafts/src/org/jrman/parser/keywords In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25763/src/org/jrman/parser/keywords Modified Files: KeywordPointsPolygons.java AbstractKeywordParser.java Log Message: Many optimizations. Rewrote oclusion culling. Implemented smaller footprint PointsPolygons. Index: KeywordPointsPolygons.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/keywords/KeywordPointsPolygons.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** KeywordPointsPolygons.java 10 Dec 2003 09:05:07 -0000 1.5 --- KeywordPointsPolygons.java 2 Feb 2004 19:30:06 -0000 1.6 *************** *** 28,31 **** --- 28,49 ---- // Expect array nVertices + parseIntegerArray(st); + int[] nVertices = new int[arraySize]; + System.arraycopy(integers, 0, nVertices, 0, arraySize); + + // Expect array vertices + parseIntegerArray(st); + int[] vertices = new int[arraySize]; + System.arraycopy(integers, 0, vertices, 0, arraySize); + + // Expect parameter list + ParameterList parameterList = parseParameterList(st); + parser.addPointsPolygons(nVertices, vertices, parameterList); + } + + /* + public void parse(Tokenizer st) throws Exception { + + // Expect array nVertices float[] nVertices = readFloatArray(st); *************** *** 34,40 **** // Expect parameter list ! ParameterList parameterList = parseParameterList(st); parser.addPointsPolygon(nVertices, vertices, parameterList); } } --- 52,59 ---- // Expect parameter list ! ParameterList parameterList = parseParameterList(st); parser.addPointsPolygon(nVertices, vertices, parameterList); } + */ } Index: AbstractKeywordParser.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/keywords/AbstractKeywordParser.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** AbstractKeywordParser.java 28 Jan 2004 07:27:43 -0000 1.8 --- AbstractKeywordParser.java 2 Feb 2004 19:30:06 -0000 1.9 *************** *** 52,68 **** final static int TK_RBRACE = ']'; ! private static float[] numbers = new float[5000]; ! private static String[] strings = new String[10]; ! ! private static int arraySize; protected Parser parser; protected Set validStates = new HashSet(); ! public static void reset() { numbers = new float[5000]; strings = new String[10]; } --- 52,71 ---- final static int TK_RBRACE = ']'; ! private static float[] numbers = new float[5000]; ! ! protected static int[] integers = new int[5000]; ! private static String[] strings = new String[10]; ! ! protected static int arraySize; protected Parser parser; protected Set validStates = new HashSet(); ! public static void reset() { numbers = new float[5000]; + integers = new int[5000]; strings = new String[10]; } *************** *** 287,291 **** String[] tmp = new String[strings.length * 2]; System.arraycopy(strings, 0, tmp, 0, strings.length); ! strings = tmp; } strings[arraySize++] = st.sval; --- 290,294 ---- String[] tmp = new String[strings.length * 2]; System.arraycopy(strings, 0, tmp, 0, strings.length); ! strings = tmp; } strings[arraySize++] = st.sval; *************** *** 297,300 **** --- 300,321 ---- } + protected void parseIntegerArray(Tokenizer st) throws Exception { + arraySize = 0; + // Expect array start + match(st, TK_LBRACE); + // Expect a variable length sequence of integers + while (st.nextToken() == TK_NUMBER) { + if (arraySize == integers.length) { + int[] tmp = new int[integers.length * 2]; + System.arraycopy(integers, 0, tmp, 0, integers.length); + integers = tmp; + } + integers[arraySize++] = (int) st.nval; + } + st.pushBack(); + // Expect array end + match(st, TK_RBRACE); + } + private Declaration getDeclaration(String name) { Declaration declaration = Global.getDeclaration(name); |
From: <ma...@us...> - 2004-02-02 19:32:11
|
Update of /cvsroot/jrman/drafts/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25763/src Modified Files: SurfaceTurbulence.java Log Message: Many optimizations. Rewrote oclusion culling. Implemented smaller footprint PointsPolygons. Index: SurfaceTurbulence.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/SurfaceTurbulence.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SurfaceTurbulence.java 11 Dec 2003 15:25:24 -0000 1.1 --- SurfaceTurbulence.java 2 Feb 2004 19:30:06 -0000 1.2 *************** *** 1,77 **** ! /* ! * SurfaceTurbulence.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 SurfaceTurbulence 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.mul(sv.P, noisescale); ! fg2.set(0f); ! for (int j= 1; j <= noiseoctaves; j++) { ! fg1.snoise(vg1); ! fg1.abs(fg1); ! 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,78 ---- ! /* ! * SurfaceTurbulence.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 SurfaceTurbulence 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.mul(sv.P, noisescale); ! fg2.set(0f); ! for (int j= 1; j <= noiseoctaves; j++) { ! fg1.snoise(vg1); ! fg1.abs(fg1); ! fg1.mul(fg1, 0.5f / j); ! fg2.add(fg2, fg1); ! vg1.mul(vg1, 2.0123f); ! } ! cg3.set(fg2); ! cg1.mul(cg1, cg3); ! cg1.mul(sv.Cs, cg1); ! sv.Ci.mul(sv.Os, cg1); ! } ! ! } |
Update of /cvsroot/jrman/drafts/javacc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16408/javacc Modified Files: SLParser.jj Added Files: JavaCharStream.java ParseException.java SLParser.java SLParserConstants.java SLParserTokenManager.java Token.java TokenMgrError.java Log Message: Finished parsing SL grammar, now it parses the .sl examples in sampleData and sampleData/sl except MondoMetal.sl (I found a little bug). I will add the preprocessor soon. --- NEW FILE: JavaCharStream.java --- /* Generated By:JavaCC: Do not edit this line. JavaCharStream.java Version 3.0 */ /** * An implementation of interface CharStream, where the stream is assumed to * contain only ASCII characters (with java-like unicode escape processing). */ public class JavaCharStream { public static final boolean staticFlag = true; static final int hexval(char c) throws java.io.IOException { switch(c) { case '0' : return 0; case '1' : return 1; case '2' : return 2; case '3' : return 3; case '4' : return 4; case '5' : return 5; case '6' : return 6; case '7' : return 7; case '8' : return 8; case '9' : return 9; case 'a' : case 'A' : return 10; case 'b' : case 'B' : return 11; case 'c' : case 'C' : return 12; case 'd' : case 'D' : return 13; case 'e' : case 'E' : return 14; case 'f' : case 'F' : return 15; } throw new java.io.IOException(); // Should never come here } static public int bufpos = -1; static int bufsize; static int available; static int tokenBegin; static protected int bufline[]; static protected int bufcolumn[]; static protected int column = 0; static protected int line = 1; static protected boolean prevCharIsCR = false; static protected boolean prevCharIsLF = false; static protected java.io.Reader inputStream; static protected char[] nextCharBuf; static protected char[] buffer; static protected int maxNextCharInd = 0; static protected int nextCharInd = -1; static protected int inBuf = 0; static protected void ExpandBuff(boolean wrapAround) { char[] newbuffer = new char[bufsize + 2048]; int newbufline[] = new int[bufsize + 2048]; int newbufcolumn[] = new int[bufsize + 2048]; try { if (wrapAround) { System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); System.arraycopy(buffer, 0, newbuffer, bufsize - tokenBegin, bufpos); buffer = newbuffer; System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos); bufline = newbufline; System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos); bufcolumn = newbufcolumn; bufpos += (bufsize - tokenBegin); } else { System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); buffer = newbuffer; System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); bufline = newbufline; System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); bufcolumn = newbufcolumn; bufpos -= tokenBegin; } } catch (Throwable t) { throw new Error(t.getMessage()); } available = (bufsize += 2048); tokenBegin = 0; } static protected void FillBuff() throws java.io.IOException { int i; if (maxNextCharInd == 4096) maxNextCharInd = nextCharInd = 0; try { if ((i = inputStream.read(nextCharBuf, maxNextCharInd, 4096 - maxNextCharInd)) == -1) { inputStream.close(); throw new java.io.IOException(); } else maxNextCharInd += i; return; } catch(java.io.IOException e) { if (bufpos != 0) { --bufpos; backup(0); } else { bufline[bufpos] = line; bufcolumn[bufpos] = column; } throw e; } } static protected char ReadByte() throws java.io.IOException { if (++nextCharInd >= maxNextCharInd) FillBuff(); return nextCharBuf[nextCharInd]; } static public char BeginToken() throws java.io.IOException { if (inBuf > 0) { --inBuf; if (++bufpos == bufsize) bufpos = 0; tokenBegin = bufpos; return buffer[bufpos]; } tokenBegin = 0; bufpos = -1; return readChar(); } static protected void AdjustBuffSize() { if (available == bufsize) { if (tokenBegin > 2048) { bufpos = 0; available = tokenBegin; } else ExpandBuff(false); } else if (available > tokenBegin) available = bufsize; else if ((tokenBegin - available) < 2048) ExpandBuff(true); else available = tokenBegin; } static protected void UpdateLineColumn(char c) { column++; if (prevCharIsLF) { prevCharIsLF = false; line += (column = 1); } else if (prevCharIsCR) { prevCharIsCR = false; if (c == '\n') { prevCharIsLF = true; } else line += (column = 1); } switch (c) { case '\r' : prevCharIsCR = true; break; case '\n' : prevCharIsLF = true; break; case '\t' : column--; column += (8 - (column & 07)); break; default : break; } bufline[bufpos] = line; bufcolumn[bufpos] = column; } static public char readChar() throws java.io.IOException { if (inBuf > 0) { --inBuf; if (++bufpos == bufsize) bufpos = 0; return buffer[bufpos]; } char c; if (++bufpos == available) AdjustBuffSize(); if ((buffer[bufpos] = c = ReadByte()) == '\\') { UpdateLineColumn(c); int backSlashCnt = 1; for (;;) // Read all the backslashes { if (++bufpos == available) AdjustBuffSize(); try { if ((buffer[bufpos] = c = ReadByte()) != '\\') { UpdateLineColumn(c); // found a non-backslash char. if ((c == 'u') && ((backSlashCnt & 1) == 1)) { if (--bufpos < 0) bufpos = bufsize - 1; break; } backup(backSlashCnt); return '\\'; } } catch(java.io.IOException e) { if (backSlashCnt > 1) backup(backSlashCnt); return '\\'; } UpdateLineColumn(c); backSlashCnt++; } // Here, we have seen an odd number of backslash's followed by a 'u' try { while ((c = ReadByte()) == 'u') ++column; buffer[bufpos] = c = (char)(hexval(c) << 12 | hexval(ReadByte()) << 8 | hexval(ReadByte()) << 4 | hexval(ReadByte())); column += 4; } catch(java.io.IOException e) { throw new Error("Invalid escape character at line " + line + " column " + column + "."); } if (backSlashCnt == 1) return c; else { backup(backSlashCnt - 1); return '\\'; } } else { UpdateLineColumn(c); return (c); } } /** * @deprecated * @see #getEndColumn */ static public int getColumn() { return bufcolumn[bufpos]; } /** * @deprecated * @see #getEndLine */ static public int getLine() { return bufline[bufpos]; } static public int getEndColumn() { return bufcolumn[bufpos]; } static public int getEndLine() { return bufline[bufpos]; } static public int getBeginColumn() { return bufcolumn[tokenBegin]; } static public int getBeginLine() { return bufline[tokenBegin]; } static public void backup(int amount) { inBuf += amount; if ((bufpos -= amount) < 0) bufpos += bufsize; } public JavaCharStream(java.io.Reader dstream, int startline, int startcolumn, int buffersize) { if (inputStream != null) throw new Error("\n ERROR: Second call to the constructor of a static JavaCharStream. You must\n" + " either use ReInit() or set the JavaCC option STATIC to false\n" + " during the generation of this class."); inputStream = dstream; line = startline; column = startcolumn - 1; available = bufsize = buffersize; buffer = new char[buffersize]; bufline = new int[buffersize]; bufcolumn = new int[buffersize]; nextCharBuf = new char[4096]; } public JavaCharStream(java.io.Reader dstream, int startline, int startcolumn) { this(dstream, startline, startcolumn, 4096); } public JavaCharStream(java.io.Reader dstream) { this(dstream, 1, 1, 4096); } public void ReInit(java.io.Reader dstream, int startline, int startcolumn, int buffersize) { inputStream = dstream; line = startline; column = startcolumn - 1; if (buffer == null || buffersize != buffer.length) { available = bufsize = buffersize; buffer = new char[buffersize]; bufline = new int[buffersize]; bufcolumn = new int[buffersize]; nextCharBuf = new char[4096]; } prevCharIsLF = prevCharIsCR = false; tokenBegin = inBuf = maxNextCharInd = 0; nextCharInd = bufpos = -1; } public void ReInit(java.io.Reader dstream, int startline, int startcolumn) { ReInit(dstream, startline, startcolumn, 4096); } public void ReInit(java.io.Reader dstream) { ReInit(dstream, 1, 1, 4096); } public JavaCharStream(java.io.InputStream dstream, int startline, int startcolumn, int buffersize) { this(new java.io.InputStreamReader(dstream), startline, startcolumn, 4096); } public JavaCharStream(java.io.InputStream dstream, int startline, int startcolumn) { this(dstream, startline, startcolumn, 4096); } public JavaCharStream(java.io.InputStream dstream) { this(dstream, 1, 1, 4096); } public void ReInit(java.io.InputStream dstream, int startline, int startcolumn, int buffersize) { ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, 4096); } public void ReInit(java.io.InputStream dstream, int startline, int startcolumn) { ReInit(dstream, startline, startcolumn, 4096); } public void ReInit(java.io.InputStream dstream) { ReInit(dstream, 1, 1, 4096); } static public String GetImage() { if (bufpos >= tokenBegin) return new String(buffer, tokenBegin, bufpos - tokenBegin + 1); else return new String(buffer, tokenBegin, bufsize - tokenBegin) + new String(buffer, 0, bufpos + 1); } static public char[] GetSuffix(int len) { char[] ret = new char[len]; if ((bufpos + 1) >= len) System.arraycopy(buffer, bufpos - len + 1, ret, 0, len); else { System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0, len - bufpos - 1); System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1); } return ret; } static public void Done() { nextCharBuf = null; buffer = null; bufline = null; bufcolumn = null; } /** * Method to adjust line and column numbers for the start of a token. */ static public void adjustBeginLineColumn(int newLine, int newCol) { int start = tokenBegin; int len; if (bufpos >= tokenBegin) { len = bufpos - tokenBegin + inBuf + 1; } else { len = bufsize - tokenBegin + bufpos + 1 + inBuf; } int i = 0, j = 0, k = 0; int nextColDiff = 0, columnDiff = 0; while (i < len && bufline[j = start % bufsize] == bufline[k = ++start % bufsize]) { bufline[j] = newLine; nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j]; bufcolumn[j] = newCol + columnDiff; columnDiff = nextColDiff; i++; } if (i < len) { bufline[j] = newLine++; bufcolumn[j] = newCol + columnDiff; while (i++ < len) { if (bufline[j = start % bufsize] != bufline[++start % bufsize]) bufline[j] = newLine++; else bufline[j] = newLine; } } line = bufline[j]; column = bufcolumn[j]; } } --- NEW FILE: ParseException.java --- /* Generated By:JavaCC: Do not edit this line. ParseException.java Version 3.0 */ /** * This exception is thrown when parse errors are encountered. * You can explicitly create objects of this exception type by * calling the method generateParseException in the generated * parser. * * You can modify this class to customize your error reporting * mechanisms so long as you retain the public fields. */ public class ParseException extends Exception { /** * This constructor is used by the method "generateParseException" * in the generated parser. Calling this constructor generates * a new object of this type with the fields "currentToken", * "expectedTokenSequences", and "tokenImage" set. The boolean * flag "specialConstructor" is also set to true to indicate that * this constructor was used to create this object. * This constructor calls its super class with the empty string * to force the "toString" method of parent class "Throwable" to * print the error message in the form: * ParseException: <result of getMessage> */ public ParseException(Token currentTokenVal, int[][] expectedTokenSequencesVal, String[] tokenImageVal ) { super(""); specialConstructor = true; currentToken = currentTokenVal; expectedTokenSequences = expectedTokenSequencesVal; tokenImage = tokenImageVal; } /** * The following constructors are for use by you for whatever * purpose you can think of. Constructing the exception in this * manner makes the exception behave in the normal way - i.e., as * documented in the class "Throwable". The fields "errorToken", * "expectedTokenSequences", and "tokenImage" do not contain * relevant information. The JavaCC generated code does not use * these constructors. */ public ParseException() { super(); specialConstructor = false; } public ParseException(String message) { super(message); specialConstructor = false; } /** * This variable determines which constructor was used to create * this object and thereby affects the semantics of the * "getMessage" method (see below). */ protected boolean specialConstructor; /** * This is the last token that has been consumed successfully. If * this object has been created due to a parse error, the token * followng this token will (therefore) be the first error token. */ public Token currentToken; /** * Each entry in this array is an array of integers. Each array * of integers represents a sequence of tokens (by their ordinal * values) that is expected at this point of the parse. */ public int[][] expectedTokenSequences; /** * This is a reference to the "tokenImage" array of the generated * parser within which the parse error occurred. This array is * defined in the generated ...Constants interface. */ public String[] tokenImage; /** * This method has the standard behavior when this object has been * created using the standard constructors. Otherwise, it uses * "currentToken" and "expectedTokenSequences" to generate a parse * error message and returns it. If this object has been created * due to a parse error, and you do not catch it (it gets thrown * from the parser), then this method is called during the printing * of the final stack trace, and hence the correct error message * gets displayed. */ public String getMessage() { if (!specialConstructor) { return super.getMessage(); } String expected = ""; int maxSize = 0; for (int i = 0; i < expectedTokenSequences.length; i++) { if (maxSize < expectedTokenSequences[i].length) { maxSize = expectedTokenSequences[i].length; } for (int j = 0; j < expectedTokenSequences[i].length; j++) { expected += tokenImage[expectedTokenSequences[i][j]] + " "; } if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) { expected += "..."; } expected += eol + " "; } String retval = "Encountered \""; Token tok = currentToken.next; for (int i = 0; i < maxSize; i++) { if (i != 0) retval += " "; if (tok.kind == 0) { retval += tokenImage[0]; break; } retval += add_escapes(tok.image); tok = tok.next; } retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn; retval += "." + eol; if (expectedTokenSequences.length == 1) { retval += "Was expecting:" + eol + " "; } else { retval += "Was expecting one of:" + eol + " "; } retval += expected; return retval; } /** * The end of line string for this machine. */ protected String eol = System.getProperty("line.separator", "\n"); /** * Used to convert raw characters to their escaped version * when these raw version cannot be used as part of an ASCII * string literal. */ protected String add_escapes(String str) { StringBuffer retval = new StringBuffer(); char ch; for (int i = 0; i < str.length(); i++) { switch (str.charAt(i)) { case 0 : continue; case '\b': retval.append("\\b"); continue; case '\t': retval.append("\\t"); continue; case '\n': retval.append("\\n"); continue; case '\f': retval.append("\\f"); continue; case '\r': retval.append("\\r"); continue; case '\"': retval.append("\\\""); continue; case '\'': retval.append("\\\'"); continue; case '\\': retval.append("\\\\"); continue; default: if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) { String s = "0000" + Integer.toString(ch, 16); retval.append("\\u" + s.substring(s.length() - 4, s.length())); } else { retval.append(ch); } continue; } } return retval.toString(); } } --- NEW FILE: SLParser.java --- /* Generated By:JavaCC: Do not edit this line. SLParser.java */ import java.io.FileInputStream; import java.io.IOException; public class SLParser implements SLParserConstants { public static void main(String args[]) throws ParseException, IOException { if (args.length == 0) { SLParser parser = new SLParser(System.in); parser.compilationUnit(); } else if (args.length == 1) { String filename = args[0]; SLParser parser = new SLParser(new FileInputStream(filename)); parser.compilationUnit(); } [...2500 lines suppressed...] jj_rescan = false; } static final private void jj_save(int index, int xla) { JJCalls p = jj_2_rtns[index]; while (p.gen > jj_gen) { if (p.next == null) { p = p.next = new JJCalls(); break; } p = p.next; } p.gen = jj_gen + xla - jj_la; p.first = token; p.arg = xla; } static final class JJCalls { int gen; Token first; int arg; JJCalls next; } } --- NEW FILE: SLParserConstants.java --- /* Generated By:JavaCC: Do not edit this line. SLParserConstants.java */ public interface SLParserConstants { int EOF = 0; int SINGLE_LINE_COMMENT = 11; int MULTI_LINE_COMMENT = 12; int LIGHT = 14; int SURFACE = 15; int VOLUME = 16; int DISPLACEMENT = 17; int IMAGER = 18; int FLOAT = 19; int STRING = 20; int COLOR = 21; int POINT = 22; int VECTOR = 23; int NORMAL = 24; int MATRIX = 25; int VOID = 26; int OUTPUT = 27; int VARYING = 28; int UNIFORM = 29; int TEXTURE = 30; int ENVIRONMENT = 31; int SHADOW = 32; int RETURN = 33; int EXTERN = 34; int BREAK = 35; int CONTINUE = 36; int IF = 37; int ELSE = 38; int WHILE = 39; int FOR = 40; int SOLAR = 41; int ILLUMINATE = 42; int ILLUMINANCE = 43; int INTEGER_LITERAL = 44; int DECIMAL_LITERAL = 45; int HEX_LITERAL = 46; int OCTAL_LITERAL = 47; int FLOATING_POINT_LITERAL = 48; int EXPONENT = 49; int CHARACTER_LITERAL = 50; int STRING_LITERAL = 51; int IDENTIFIER = 52; int LETTER = 53; int DIGIT = 54; int LPAREN = 55; int RPAREN = 56; int LBRACE = 57; int RBRACE = 58; int LBRACKET = 59; int RBRACKET = 60; int SEMICOLON = 61; int COMMA = 62; int PLUS = 63; int MINUS = 64; int STAR = 65; int SLASH = 66; int EXP = 67; int BANG = 68; int ASSIGN = 69; int HOOK = 70; int PLUSASSIGN = 71; int MINUSASSIGN = 72; int STARASSIGN = 73; int SLASHASSIGN = 74; int COLON = 75; int DOT = 76; int DEFAULT = 0; int PREPROCESSOR_OUTPUT = 1; int IN_SINGLE_LINE_COMMENT = 2; int IN_MULTI_LINE_COMMENT = 3; String[] tokenImage = { "<EOF>", "\" \"", "\"\\t\"", "\"\\n\"", "\"\\r\"", "\"\\f\"", "\"#\"", "\"\\n\"", "<token of kind 8>", "\"//\"", "\"/*\"", "<SINGLE_LINE_COMMENT>", "\"*/\"", "<token of kind 13>", "\"light\"", "\"surface\"", "\"volume\"", "\"displacement\"", "\"imager\"", "\"float\"", "\"string\"", "\"color\"", "\"point\"", "\"vector\"", "\"normal\"", "\"matrix\"", "\"void\"", "\"output\"", "\"varying\"", "\"uniform\"", "\"texture\"", "\"environment\"", "\"shadow\"", "\"return\"", "\"extern\"", "\"break\"", "\"continue\"", "\"if\"", "\"else\"", "\"while\"", "\"for\"", "\"solar\"", "\"illuminate\"", "\"illuminance\"", "<INTEGER_LITERAL>", "<DECIMAL_LITERAL>", "<HEX_LITERAL>", "<OCTAL_LITERAL>", "<FLOATING_POINT_LITERAL>", "<EXPONENT>", "<CHARACTER_LITERAL>", "<STRING_LITERAL>", "<IDENTIFIER>", "<LETTER>", "<DIGIT>", "\"(\"", "\")\"", "\"{\"", "\"}\"", "\"[\"", "\"]\"", "\";\"", "\",\"", "\"+\"", "\"-\"", "\"*\"", "\"/\"", "\"^\"", "\"!\"", "\"=\"", "\"?\"", "\"+=\"", "\"-=\"", "\"*=\"", "\"/=\"", "\":\"", "\".\"", "\"||\"", "\"&&\"", "\"==\"", "\"!=\"", "\"<\"", "\">\"", "\"<=\"", "\">=\"", }; } --- NEW FILE: SLParserTokenManager.java --- /* Generated By:JavaCC: Do not edit this line. SLParserTokenManager.java */ import java.io.FileInputStream; import java.io.IOException; public class SLParserTokenManager implements SLParserConstants { public static java.io.PrintStream debugStream = System.out; public static void setDebugStream(java.io.PrintStream ds) { debugStream = ds; } private static final int jjStopStringLiteralDfa_0(int pos, long active0, long active1) { switch (pos) { case 0: if ((active1 & 0x1000L) != 0L) return 4; if ((active0 & 0xfffffffc000L) != 0L) { jjmatchedKind = 52; return 28; [...1455 lines suppressed...] error_column++; } if (!EOFSeen) { input_stream.backup(1); error_after = curPos <= 1 ? "" : input_stream.GetImage(); } throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR); } } } static void SkipLexicalActions(Token matchedToken) { switch(jjmatchedKind) { default : break; } } } --- NEW FILE: Token.java --- /* Generated By:JavaCC: Do not edit this line. Token.java Version 3.0 */ /** * Describes the input token stream. */ public class Token { /** * An integer that describes the kind of this token. This numbering * system is determined by JavaCCParser, and a table of these numbers is * stored in the file ...Constants.java. */ public int kind; /** * beginLine and beginColumn describe the position of the first character * of this token; endLine and endColumn describe the position of the * last character of this token. */ public int beginLine, beginColumn, endLine, endColumn; /** * The string image of the token. */ public String image; /** * A reference to the next regular (non-special) token from the input * stream. If this is the last token from the input stream, or if the * token manager has not read tokens beyond this one, this field is * set to null. This is true only if this token is also a regular * token. Otherwise, see below for a description of the contents of * this field. */ public Token next; /** * This field is used to access special tokens that occur prior to this * token, but after the immediately preceding regular (non-special) token. * If there are no such special tokens, this field is set to null. * When there are more than one such special token, this field refers * to the last of these special tokens, which in turn refers to the next * previous special token through its specialToken field, and so on * until the first special token (whose specialToken field is null). * The next fields of special tokens refer to other special tokens that * immediately follow it (without an intervening regular token). If there * is no such token, this field is null. */ public Token specialToken; /** * Returns the image. */ public String toString() { return image; } /** * Returns a new Token object, by default. However, if you want, you * can create and return subclass objects based on the value of ofKind. * Simply add the cases to the switch for all those special cases. * For example, if you have a subclass of Token called IDToken that * you want to create if ofKind is ID, simlpy add something like : * * case MyParserConstants.ID : return new IDToken(); * * to the following switch statement. Then you can cast matchedToken * variable to the appropriate type and use it in your lexical actions. */ public static final Token newToken(int ofKind) { switch(ofKind) { default : return new Token(); } } } --- NEW FILE: TokenMgrError.java --- /* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 3.0 */ public class TokenMgrError extends Error { /* * Ordinals for various reasons why an Error of this type can be thrown. */ /** * Lexical error occured. */ static final int LEXICAL_ERROR = 0; /** * An attempt wass made to create a second instance of a static token manager. */ static final int STATIC_LEXER_ERROR = 1; /** * Tried to change to an invalid lexical state. */ static final int INVALID_LEXICAL_STATE = 2; /** * Detected (and bailed out of) an infinite loop in the token manager. */ static final int LOOP_DETECTED = 3; /** * Indicates the reason why the exception is thrown. It will have * one of the above 4 values. */ int errorCode; /** * Replaces unprintable characters by their espaced (or unicode escaped) * equivalents in the given string */ protected static final String addEscapes(String str) { StringBuffer retval = new StringBuffer(); char ch; for (int i = 0; i < str.length(); i++) { switch (str.charAt(i)) { case 0 : continue; case '\b': retval.append("\\b"); continue; case '\t': retval.append("\\t"); continue; case '\n': retval.append("\\n"); continue; case '\f': retval.append("\\f"); continue; case '\r': retval.append("\\r"); continue; case '\"': retval.append("\\\""); continue; case '\'': retval.append("\\\'"); continue; case '\\': retval.append("\\\\"); continue; default: if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) { String s = "0000" + Integer.toString(ch, 16); retval.append("\\u" + s.substring(s.length() - 4, s.length())); } else { retval.append(ch); } continue; } } return retval.toString(); } /** * Returns a detailed message for the Error when it is thrown by the * token manager to indicate a lexical error. * Parameters : * EOFSeen : indicates if EOF caused the lexicl error * curLexState : lexical state in which this error occured * errorLine : line number when the error occured * errorColumn : column number when the error occured * errorAfter : prefix that was seen before this error occured * curchar : the offending character * Note: You can customize the lexical error message by modifying this method. */ protected static String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) { return("Lexical error at line " + errorLine + ", column " + errorColumn + ". Encountered: " + (EOFSeen ? "<EOF> " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int)curChar + "), ") + "after : \"" + addEscapes(errorAfter) + "\""); } /** * You can also modify the body of this method to customize your error messages. * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not * of end-users concern, so you can return something like : * * "Internal Error : Please file a bug report .... " * * from this method for such cases in the release version of your parser. */ public String getMessage() { return super.getMessage(); } /* * Constructors of various flavors follow. */ public TokenMgrError() { } public TokenMgrError(String message, int reason) { super(message); errorCode = reason; } public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) { this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason); } } Index: SLParser.jj =================================================================== RCS file: /cvsroot/jrman/drafts/javacc/SLParser.jj,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** SLParser.jj 29 Sep 2003 12:07:59 -0000 1.3 --- SLParser.jj 2 Feb 2004 05:45:30 -0000 1.4 *************** *** 1,5 **** /* SLParser.jj ! Copyright (C) 2003 Elmer Garduno Hernandez This program is free software; you can redistribute it and/or --- 1,5 ---- /* SLParser.jj ! Copyright (C) 2004 Elmer Garduno Hernandez This program is free software; you can redistribute it and/or *************** *** 58,61 **** --- 58,73 ---- | "\r" | "\f" + | "#" : PREPROCESSOR_OUTPUT + + } + + <PREPROCESSOR_OUTPUT> SKIP: + { + "\n" : DEFAULT + } + + <PREPROCESSOR_OUTPUT> MORE: + { + < ~[] > } *************** *** 111,114 **** --- 123,135 ---- | < RETURN: "return" > | < EXTERN: "extern" > + | < BREAK: "break" > + | < CONTINUE: "continue" > + | < IF: "if" > + | < ELSE: "else" > + | < WHILE: "while" > + | < FOR: "for" > + | < SOLAR: "solar" > + | < ILLUMINATE: "illuminate" > + | < ILLUMINANCE: "illuminance" > } *************** *** 261,265 **** {} { ! shaderType() identifier() "("[formals()]")" "{" statements() "}" } --- 282,286 ---- {} { ! shaderType() identifier() "("[formals()]")" block() } *************** *** 267,271 **** {} { ! [type()] identifier() "("[formals()]")" "{" statements() "}" } --- 288,292 ---- {} { ! [type()] identifier() "("[formals()]")" block() } *************** *** 291,295 **** {} { ! formalVariableDefinitions() (";" formalVariableDefinitions() )* } --- 312,316 ---- {} { ! formalVariableDefinitions() [";"] (LOOKAHEAD(2) formalVariableDefinitions() ";")* } *************** *** 339,354 **** {} { ! LOOKAHEAD(3) primary() ! /* | ! typecast() expression()*/ ! | ! conditionalExpression() ! /*| ! expression() binop() expression() ! | ! "-" expression() | ! relation() "?" expression() ":" expression() ! */ } --- 360,367 ---- {} { ! LOOKAHEAD(3) conditionalExpression() | ! primary() ! } *************** *** 363,372 **** | LOOKAHEAD(2) procedurecall() - | - LOOKAHEAD(2) identifier() | ! LOOKAHEAD(2) identifier() [LOOKAHEAD(2) arrayindex()] | ! assignexpression() | LOOKAHEAD(3) triple() --- 376,384 ---- | LOOKAHEAD(2) procedurecall() | ! LOOKAHEAD(2) identifier() [LOOKAHEAD(2) arrayindex()] [asgnop() expression()] ! //assignExpression(), identifier() | ! LOOKAHEAD(3) single() | LOOKAHEAD(3) triple() *************** *** 453,456 **** --- 465,474 ---- } + void single(): + {} + { + "("expression()")" + } + void triple(): {} *************** *** 548,573 **** "!" unaryExpression() | primary() } ! void statements(): {} { ! (statement())+ } - - void statement(): {} { ! variableDefinitions() ";" | LOOKAHEAD(2) assignexpression() ";" | procedurecall() ";" | <RETURN> expression() ";" ! } --- 566,684 ---- "!" unaryExpression() | + castExpression() + | primary() } ! void castExpression() : {} { ! typecast() unaryExpression() } void statement(): {} { ! block() | LOOKAHEAD(2) assignexpression() ";" | + variableDefinitions() ";" + | procedurecall() ";" | <RETURN> expression() ";" ! | ! loopModStmt() ! | ! ifStatement() ! | ! loopControl() ! } ! ! void loopModStmt(): ! {} ! { ! loopMod() [<INTEGER_LITERAL>] ! } ! ! void loopMod(): ! {} ! { ! <BREAK>|<CONTINUE> ! } ! ! void ifStatement(): ! {} ! { ! <IF> "(" booleanExpression() ")" statement() [ LOOKAHEAD(2) <ELSE> statement() ] ! } ! ! void booleanExpression(): ! {} ! { ! expression() ! } ! ! void loopControl(): ! {} ! { ! whileStatement() ! | ! forStatement() ! | ! solarStatement() ! | ! illuminateStatement() ! | ! illuminanceStatement() ! } ! ! void whileStatement(): ! {} ! { ! <WHILE> "(" booleanExpression() ")" statement() ! } ! ! void forStatement(): ! {} ! { ! <FOR> "(" forInit() ";" booleanExpression() ";" forUpdate() ")" statement() ! } ! ! void forInit(): ! {} ! { ! expression() ! } ! ! void forUpdate(): ! {} ! { ! expression() ! } ! ! void solarStatement(): ! {} ! { ! <SOLAR> "(" [expressionList()] ")" statement() ! } ! ! void illuminateStatement(): ! {} ! { ! <ILLUMINATE> "(" [expressionList()] ")" statement() ! } ! ! void illuminanceStatement(): ! {} ! { ! <ILLUMINANCE> "(" [expressionList()] ")" statement() ! } ! ! void expressionList(): ! {} ! { ! expression() ("," expression())* } *************** *** 575,579 **** {} { ! [externspec()] typespec() defExpressions() ";" } --- 686,690 ---- {} { ! [externspec()] typespec() defExpressions() } *************** *** 585,586 **** --- 696,712 ---- } + void block() : + {} + { + "{" ( blockStatement() )* "}" + } + + void blockStatement() : + {} + { + LOOKAHEAD(3) formals() + | + statement() + } + + |
From: <ma...@pr...> - 2004-01-28 07:28:55
|
Update of /cvsroot/jrman/drafts/src/org/jrman/render In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6214/src/org/jrman/render Modified Files: RendererHidden.java Log Message: More time and space optimizations. Index: RendererHidden.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/render/RendererHidden.java,v retrieving revision 1.60 retrieving revision 1.61 diff -C2 -d -r1.60 -r1.61 *** RendererHidden.java 27 Jan 2004 05:58:45 -0000 1.60 --- RendererHidden.java 28 Jan 2004 07:27:43 -0000 1.61 *************** *** 101,104 **** --- 101,108 ---- private int wExtra; + + private Transform oldObjectToWorld; + + private Transform oldObjectToCamera; public void init(Frame frame, World world) { *************** *** 130,134 **** if (objectToCamera == null) { Transform objectToWorld = primitive.getAttributes().getTransform(); ! objectToCamera = worldToCamera.concat(objectToWorld); primitive.setObjectToCamera(objectToCamera); } --- 134,144 ---- if (objectToCamera == null) { Transform objectToWorld = primitive.getAttributes().getTransform(); ! if (oldObjectToWorld != null && oldObjectToWorld == objectToWorld) ! objectToCamera = oldObjectToCamera; ! else { ! objectToCamera = worldToCamera.concat(objectToWorld); ! oldObjectToWorld = objectToWorld; ! oldObjectToCamera = objectToCamera; ! } primitive.setObjectToCamera(objectToCamera); } *************** *** 346,351 **** } else { Primitive[] sub = p.split(); ! for (int i = 0; i < sub.length; i++) internalAddPrimitive(sub[i], column, row, true); } } else { --- 356,363 ---- } else { Primitive[] sub = p.split(); ! for (int i = 0; i < sub.length; i++) { ! sub[i].setObjectToCamera(p.getObjectToCamera()); internalAddPrimitive(sub[i], column, row, true); + } } } else { *************** *** 635,640 **** bucketRows = (int) Math.ceil(height / bucketHeight); buckets = new Bucket[bucketColumns * bucketRows]; ! wExtra = bucketWidth - (int) width % bucketWidth; ! hExtra = bucketHeight - (int) height % bucketHeight; if (frame.fileBucketsEnabled()) for (int i = 0; i < buckets.length; i++) --- 647,658 ---- bucketRows = (int) Math.ceil(height / bucketHeight); buckets = new Bucket[bucketColumns * bucketRows]; ! if (width < frame.getHorizontalResolution()) ! wExtra = bucketWidth - (int) width % bucketWidth; ! else ! wExtra = 0; ! if (height < frame.getVerticalResolution()) ! hExtra = bucketHeight - (int) height % bucketHeight; ! else ! hExtra = 0; if (frame.fileBucketsEnabled()) for (int i = 0; i < buckets.length; i++) |
From: <ma...@pr...> - 2004-01-28 07:28:55
|
Update of /cvsroot/jrman/drafts/src/org/jrman/primitive In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6214/src/org/jrman/primitive Modified Files: BilinearPatch.java Log Message: More time and space optimizations. Index: BilinearPatch.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/primitive/BilinearPatch.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** BilinearPatch.java 30 Nov 2003 03:23:16 -0000 1.3 --- BilinearPatch.java 28 Jan 2004 07:27:43 -0000 1.4 *************** *** 25,29 **** import org.jrman.attributes.Attributes; import org.jrman.geom.BoundingVolume; ! import org.jrman.geom.MutableBounds3f; import org.jrman.parameters.ParameterList; import org.jrman.parameters.VaryingScalarTuple3f; --- 25,29 ---- import org.jrman.attributes.Attributes; import org.jrman.geom.BoundingVolume; ! import org.jrman.geom.ConvexHull3f; import org.jrman.parameters.ParameterList; import org.jrman.parameters.VaryingScalarTuple3f; *************** *** 55,59 **** public BoundingVolume getBoundingVolume() { ! MutableBounds3f mb = new MutableBounds3f(); extractPoints(); mb.addPoint(P00); --- 55,59 ---- public BoundingVolume getBoundingVolume() { ! ConvexHull3f mb = new ConvexHull3f(); extractPoints(); mb.addPoint(P00); |
From: <ma...@pr...> - 2004-01-28 07:28:55
|
Update of /cvsroot/jrman/drafts/src/org/jrman/parser In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6214/src/org/jrman/parser Modified Files: Parser.java Log Message: More time and space optimizations. Index: Parser.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/Parser.java,v retrieving revision 1.75 retrieving revision 1.76 diff -C2 -d -r1.75 -r1.76 *** Parser.java 26 Jan 2004 00:56:10 -0000 1.75 --- Parser.java 28 Jan 2004 07:27:43 -0000 1.76 *************** *** 68,71 **** --- 68,72 ---- import org.jrman.parameters.VaryingScalarFloat; import org.jrman.parameters.VaryingScalarTuple3f; + import org.jrman.parser.keywords.AbstractKeywordParser; import org.jrman.parser.keywords.KeywordParser; import org.jrman.primitive.BicubicPatch; *************** *** 468,471 **** --- 469,473 ---- public void worldEnd() { + AbstractKeywordParser.reset(); boolean doRender = true; if (firstFrame > -1 && frame.getFrameNumber() < firstFrame) |
From: <ma...@pr...> - 2004-01-28 07:28:54
|
Update of /cvsroot/jrman/drafts/src/org/jrman/geom In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6214/src/org/jrman/geom Modified Files: ConvexHull3f.java Log Message: More time and space optimizations. Index: ConvexHull3f.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/geom/ConvexHull3f.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** ConvexHull3f.java 16 Jul 2003 07:20:49 -0000 1.13 --- ConvexHull3f.java 28 Jan 2004 07:27:44 -0000 1.14 *************** *** 20,27 **** package org.jrman.geom; - import java.util.ArrayList; - import java.util.Iterator; - import java.util.List; - import javax.vecmath.Point3f; import javax.vecmath.Point4f; --- 20,23 ---- *************** *** 30,45 **** public class ConvexHull3f implements BoundingVolume { ! private List points = new ArrayList(); private float minZ = Constants.INFINITY; public void addPoint(Point3f point) { ! points.add(new Point3f(point)); minZ = Math.min(minZ, point.z); } public void addPoint(float x, float y, float z) { ! points.add(new Point3f(x, y, z)); minZ = Math.min(minZ, z); } --- 26,75 ---- public class ConvexHull3f implements BoundingVolume { + + private static Point3f tmpPoint = new Point3f(); ! private float[] pointsData = new float[4 * 3]; ! ! private int count = 0; private float minZ = Constants.INFINITY; + + private void add(Point3f point) { + if (count * 3 == pointsData.length) { + float[] tmp = new float[pointsData.length * 4]; + System.arraycopy(pointsData, 0, tmp, 0, pointsData.length); + pointsData = tmp; + } + pointsData[count * 3] = point.x; + pointsData[count * 3 + 1] = point.y; + pointsData[count * 3 + 2] = point.z; + count++; + } + + private void add(float x, float y, float z) { + if (count * 3 == pointsData.length) { + float[] tmp = new float[pointsData.length * 4]; + System.arraycopy(pointsData, 0, tmp, 0, pointsData.length); + pointsData = tmp; + } + pointsData[count * 3] = x; + pointsData[count * 3 + 1] = y; + pointsData[count * 3 + 2] = z; + count++; + } + + private void get(int index, Point3f point) { + point.x = pointsData[index * 3]; + point.y = pointsData[index * 3 + 1]; + point.z = pointsData[index * 3 + 2]; + } public void addPoint(Point3f point) { ! add(point); minZ = Math.min(minZ, point.z); } public void addPoint(float x, float y, float z) { ! add(x, y, z); minZ = Math.min(minZ, z); } *************** *** 48,52 **** Point3f p = new Point3f(); p.project(hpoint); ! points.add(p); minZ = Math.min(minZ, p.z); } --- 78,82 ---- Point3f p = new Point3f(); p.project(hpoint); ! add(p); minZ = Math.min(minZ, p.z); } *************** *** 58,66 **** public BoundingVolume transform(Transform transform) { ConvexHull3f result = new ConvexHull3f(); ! Point3f tmp = new Point3f(); ! for (Iterator iter = points.iterator(); iter.hasNext();) { ! Point3f p = (Point3f) iter.next(); ! transform.transformPoint(p, tmp); ! result.addPoint(tmp); } return result; --- 88,95 ---- public BoundingVolume transform(Transform transform) { ConvexHull3f result = new ConvexHull3f(); ! for (int i = 0; i < count; i++) { ! get(i, tmpPoint); ! transform.transformPoint(tmpPoint, tmpPoint); ! result.addPoint(tmpPoint); } return result; *************** *** 70,76 **** boolean inside = false; boolean outside = false; ! for (int i = 0; i < points.size(); i++) { ! Point3f p = (Point3f) points.get(i); ! if (plane.isInside(p)) { inside = true; if (outside) --- 99,105 ---- boolean inside = false; boolean outside = false; ! for (int i = 0; i < count; i++) { ! get(i, tmpPoint); ! if (plane.isInside(tmpPoint)) { inside = true; if (outside) *************** *** 87,92 **** public Bounds3f getBoundingBox() { MutableBounds3f result = new MutableBounds3f(); ! for (Iterator iter = points.iterator(); iter.hasNext();) ! result.addPoint((Point3f) iter.next()); return result; } --- 116,123 ---- public Bounds3f getBoundingBox() { MutableBounds3f result = new MutableBounds3f(); ! for (int i = 0; i < count; i++) { ! get(i, tmpPoint); ! result.addPoint(tmpPoint); ! } return result; } *************** *** 94,100 **** public Bounds2f toBounds2f() { MutableBounds2f result = new MutableBounds2f(); ! for (int i = 0; i < points.size(); i++) { ! Point3f p = (Point3f) points.get(i); ! result.addPoint(p.x, p.y); } return result; --- 125,131 ---- public Bounds2f toBounds2f() { MutableBounds2f result = new MutableBounds2f(); ! for (int i = 0; i < count; i++) { ! get(i, tmpPoint); ! result.addPoint(tmpPoint.x, tmpPoint.y); } return result; *************** *** 103,109 **** public Bounds2f toBounds2f(float margin) { MutableBounds2f result = new MutableBounds2f(); ! for (int i = 0; i < points.size(); i++) { ! Point3f p = (Point3f) points.get(i); ! result.addPoint(p.x, p.y); } result.enlarge(margin); --- 134,140 ---- public Bounds2f toBounds2f(float margin) { MutableBounds2f result = new MutableBounds2f(); ! for (int i = 0; i < count; i++) { ! get(i, tmpPoint); ! result.addPoint(tmpPoint.x, tmpPoint.y); } result.enlarge(margin); *************** *** 114,119 **** StringBuffer sb = new StringBuffer(); sb.append("ConvexHull:\n"); ! for (Iterator iter = points.iterator(); iter.hasNext();) ! sb.append(iter.next()).append('\n'); return sb.toString(); } --- 145,152 ---- StringBuffer sb = new StringBuffer(); sb.append("ConvexHull:\n"); ! for (int i = 0; i < count; i++) { ! get(i, tmpPoint); ! sb.append(tmpPoint).append('\n'); ! } return sb.toString(); } |
From: <ma...@pr...> - 2004-01-28 07:28:52
|
Update of /cvsroot/jrman/drafts/src/org/jrman/parser/keywords In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6214/src/org/jrman/parser/keywords Modified Files: AbstractKeywordParser.java Log Message: More time and space optimizations. Index: AbstractKeywordParser.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/keywords/AbstractKeywordParser.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** AbstractKeywordParser.java 25 Nov 2003 16:34:08 -0000 1.7 --- AbstractKeywordParser.java 28 Jan 2004 07:27:43 -0000 1.8 *************** *** 53,57 **** final static int TK_RBRACE = ']'; ! private static float[] numbers = new float[100]; private static String[] strings = new String[10]; --- 53,57 ---- final static int TK_RBRACE = ']'; ! private static float[] numbers = new float[5000]; private static String[] strings = new String[10]; *************** *** 62,65 **** --- 62,70 ---- protected Set validStates = new HashSet(); + + public static void reset() { + numbers = new float[5000]; + strings = new String[10]; + } public void setParser(Parser parser) { |
From: <ma...@pr...> - 2004-01-27 05:59:46
|
Update of /cvsroot/jrman/drafts/src/org/jrman/render In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8415/src/org/jrman/render Modified Files: RendererHidden.java Log Message: Fixed crop window bug. Fixed clipping volume bug. Index: RendererHidden.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/render/RendererHidden.java,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -d -r1.59 -r1.60 *** RendererHidden.java 14 Jan 2004 03:06:35 -0000 1.59 --- RendererHidden.java 27 Jan 2004 05:58:45 -0000 1.60 *************** *** 98,101 **** --- 98,105 ---- private SamplesFilter samplesFilter; + private int hExtra; + + private int wExtra; + public void init(Frame frame, World world) { super.init(frame, world); *************** *** 386,391 **** column * bucketWidth - (column == 0 ? 0 : hPixelLess) + (int) rmin.x, row * bucketHeight - (row == 0 ? 0 : vPixelLess) + (int) rmin.y, ! bucketWidth - (column == 0 ? hPixelLess : 0), ! bucketHeight - (row == 0 ? vPixelLess : 0), bucketWidth); if (fb != null) --- 390,399 ---- column * bucketWidth - (column == 0 ? 0 : hPixelLess) + (int) rmin.x, row * bucketHeight - (row == 0 ? 0 : vPixelLess) + (int) rmin.y, ! bucketWidth ! - (column == 0 ? hPixelLess : 0) ! - (column == bucketColumns - 1 ? wExtra : 0), ! bucketHeight ! - (row == 0 ? vPixelLess : 0) ! - (row == bucketRows - 1 ? hExtra : 0), bucketWidth); if (fb != null) *************** *** 548,556 **** clippingVolume = new ClippingVolume(); if (frame.getCameraProjection() == CameraProjection.PERSPECTIVE) { Point3f origin = new Point3f(); ! Point3f upperLeft = new Point3f(min.x, max.y, 1f); ! Point3f upperRight = new Point3f(max.x, max.y, 1f); ! Point3f lowerLeft = new Point3f(min.x, min.y, 1f); ! Point3f lowerRight = new Point3f(max.x, min.y, 1f); clippingVolume.addPlane( Plane.createWithThreePoints(origin, upperLeft, upperRight)); --- 556,565 ---- clippingVolume = new ClippingVolume(); if (frame.getCameraProjection() == CameraProjection.PERSPECTIVE) { + float focalLength = Calc.fovToFocalLength(frame.getFieldOfView()); Point3f origin = new Point3f(); ! Point3f upperLeft = new Point3f(min.x, max.y, focalLength); ! Point3f upperRight = new Point3f(max.x, max.y, focalLength); ! Point3f lowerLeft = new Point3f(min.x, min.y, focalLength); ! Point3f lowerRight = new Point3f(max.x, min.y, focalLength); clippingVolume.addPlane( Plane.createWithThreePoints(origin, upperLeft, upperRight)); *************** *** 626,629 **** --- 635,640 ---- bucketRows = (int) Math.ceil(height / bucketHeight); buckets = new Bucket[bucketColumns * bucketRows]; + wExtra = bucketWidth - (int) width % bucketWidth; + hExtra = bucketHeight - (int) height % bucketHeight; if (frame.fileBucketsEnabled()) for (int i = 0; i < buckets.length; i++) |
From: <ma...@pr...> - 2004-01-26 14:35:43
|
Update of /cvsroot/jrman/drafts/src/org/jrman/parser In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25499/src/org/jrman/parser Modified Files: Parser.java Log Message: Handle correctly polygon "N" parameter in rib. Index: Parser.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parser/Parser.java,v retrieving revision 1.74 retrieving revision 1.75 diff -C2 -d -r1.74 -r1.75 *** Parser.java 20 Dec 2003 18:13:33 -0000 1.74 --- Parser.java 26 Jan 2004 00:56:10 -0000 1.75 *************** *** 91,1313 **** public class Parser { ! private final static String KEYWORD_PREFIX = ! "org.jrman.parser.keywords.Keyword"; ! private static Color3f tmpColor = new Color3f(); ! private boolean inAreaLightSource; ! private String beginName; [...2337 lines suppressed...] ! String swrap, ! String twrap, ! String filter, ! int swidth, ! int twidth) { ! try { ! MipMap.makeMipMap( ! picturename, ! texturename, ! MipMap.Mode.getNamed(swrap), ! MipMap.Mode.getNamed(twrap), ! filter, ! swidth, ! twidth); ! } catch (IOException e) { ! throw new IllegalArgumentException("Can't create texture: " + picturename); ! } ! } } |
From: <ma...@us...> - 2004-01-17 01:10:17
|
Update of /cvsroot/jrman/drafts/src/org/jrman/grid In directory sc8-pr-cvs1:/tmp/cvs-serv26472/src/org/jrman/grid Modified Files: FloatGrid.java Log Message: Improved alphaplastic Index: FloatGrid.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/grid/FloatGrid.java,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** FloatGrid.java 13 Jan 2004 09:47:19 -0000 1.22 --- FloatGrid.java 17 Jan 2004 01:10:12 -0000 1.23 *************** *** 30,46 **** public class FloatGrid extends Grid { ! private static Point3fGrid pg1= new Point3fGrid(); ! private static Point3f p1= new Point3f(); ! private static Point3f p2= new Point3f(); ! private static float[] mmData= new float[4]; [...2676 lines suppressed...] ! shadowMap.get(p1, p2, bias, isamples, oneOverSamples, blur, halfBlur)); } } *************** *** 1468,1474 **** public void simulPow(FloatGrid f1, float n) { ! for (int i= 0; i < size; i++) { ! float t= f1.data[i]; ! data[i]= t / (n - n * t + t); } } --- 1584,1590 ---- public void simulPow(FloatGrid f1, float n) { ! for (int i = 0; i < size; i++) { ! float t = f1.data[i]; ! data[i] = t / (n - n * t + t); } } |
From: <ma...@us...> - 2004-01-17 01:10:17
|
Update of /cvsroot/jrman/drafts/src In directory sc8-pr-cvs1:/tmp/cvs-serv26472/src Modified Files: SurfaceAlphaplastic.java Log Message: Improved alphaplastic Index: SurfaceAlphaplastic.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/SurfaceAlphaplastic.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SurfaceAlphaplastic.java 20 Dec 2003 15:35:04 -0000 1.1 --- SurfaceAlphaplastic.java 17 Jan 2004 01:10:13 -0000 1.2 *************** *** 63,68 **** defaultParameters.addParameter( new UniformScalarString(new Declaration("texturename", "string"), "")); - defaultParameters.addParameter( - new UniformScalarString(new Declaration("alphatexturename", "string"), "")); } --- 63,66 ---- *************** *** 83,89 **** (UniformScalarString) getParameter(sv, "texturename"); final String texturename = paramTexturename.getValue(); - UniformScalarString paramAlphatexturename = - (UniformScalarString) getParameter(sv, "alphatexturename"); - final String alphatexturename = paramAlphatexturename.getValue(); vg1.normalize(sv.N); vg1.faceforward(vg1, sv.I); --- 81,84 ---- *************** *** 109,114 **** cg2.mul(cg2, cg3); cg1.add(cg1, cg2); ! if (!alphatexturename.equals("")) { ! fg.texture(alphatexturename, sv.s, sv.t); sv.Oi.set(fg); } --- 104,109 ---- cg2.mul(cg2, cg3); cg1.add(cg1, cg2); ! if (!texturename.equals("")) { ! fg.texture(texturename, sv.s, sv.t, 3); sv.Oi.set(fg); } |
From: <ma...@us...> - 2004-01-17 01:10:17
|
Update of /cvsroot/jrman/drafts/src/org/jrman/shaders In directory sc8-pr-cvs1:/tmp/cvs-serv26472/src/org/jrman/shaders Modified Files: DisplacementBumpy.java Log Message: Improved alphaplastic Index: DisplacementBumpy.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/shaders/DisplacementBumpy.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** DisplacementBumpy.java 25 Nov 2003 16:34:08 -0000 1.4 --- DisplacementBumpy.java 17 Jan 2004 01:10:13 -0000 1.5 *************** *** 49,53 **** final String texturename = paramTexturename.getValue(); if (!texturename.equals("")) ! fg1.texture(texturename, sv.s, sv.t); else fg1.set(0f); --- 49,53 ---- final String texturename = paramTexturename.getValue(); if (!texturename.equals("")) ! fg1.texture(texturename, sv.s, sv.t, 0); else fg1.set(0f); |
From: <ma...@us...> - 2004-01-17 01:10:16
|
Update of /cvsroot/jrman/drafts/src/org/jrman/render In directory sc8-pr-cvs1:/tmp/cvs-serv26472/src/org/jrman/render Modified Files: FastSimpleMicropolygon.java Log Message: Improved alphaplastic Index: FastSimpleMicropolygon.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/render/FastSimpleMicropolygon.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** FastSimpleMicropolygon.java 14 Jan 2004 03:06:35 -0000 1.1 --- FastSimpleMicropolygon.java 17 Jan 2004 01:10:12 -0000 1.2 *************** *** 208,212 **** return; float v = (oy * bx - ox * by) * oneOverDet; ! if (v < 0 || u + v > 1) return; float z = (1f - u - v) * az + u * bz + v * cz; --- 208,212 ---- return; float v = (oy * bx - ox * by) * oneOverDet; ! if (v < 0f || u + v > 1f) return; float z = (1f - u - v) * az + u * bz + v * cz; |
From: <ma...@us...> - 2004-01-14 03:06:38
|
Update of /cvsroot/jrman/drafts/src/org/jrman/render In directory sc8-pr-cvs1:/tmp/cvs-serv30338/src/org/jrman/render Modified Files: SimpleMicropolygon.java SamplePoint.java FileBucket.java RendererHidden.java ShaderVariables.java Sample.java Micropolygon.java Sampler.java Added Files: FastSimpleMicropolygon.java Log Message: Implemented barycentric coordinates for micropolygon sampling. Implemented alpha in output images. --- NEW FILE: FastSimpleMicropolygon.java --- /* FastSimpleMicropolygon.java Copyright (C) 2004 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. */ package org.jrman.render; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; import javax.vecmath.Point2f; import javax.vecmath.Point3f; import org.jrman.util.Calc; public class FastSimpleMicropolygon extends Micropolygon { private final static float EPSILON = 10E-5f; private float ax; private float ay; private float az; private float bx; private float by; private float bz; private float cx; private float cy; private float cz; private float oneOverDet; private float colorRed; private float colorGreen; private float colorBlue; private float opacityRed; private float opacityGreen; private float opacityBlue; public void write(DataOutputStream dos) throws IOException { dos.writeFloat(ax); dos.writeFloat(ay); dos.writeFloat(az); dos.writeFloat(bx); dos.writeFloat(by); dos.writeFloat(bz); dos.writeFloat(cx); dos.writeFloat(cy); dos.writeFloat(cz); dos.writeFloat(oneOverDet); dos.writeFloat(colorRed); dos.writeFloat(colorGreen); dos.writeFloat(colorBlue); dos.writeFloat(opacityRed); dos.writeFloat(opacityGreen); dos.writeFloat(opacityBlue); dos.writeFloat(minX); dos.writeFloat(maxX); dos.writeFloat(minY); dos.writeFloat(maxY); dos.writeFloat(minZ); } public void read(DataInputStream dis) throws IOException { ax = dis.readFloat(); ay = dis.readFloat(); az = dis.readFloat(); bx = dis.readFloat(); by = dis.readFloat(); bz = dis.readFloat(); cx = dis.readFloat(); cy = dis.readFloat(); cz = dis.readFloat(); oneOverDet = dis.readFloat(); colorRed = dis.readFloat(); colorGreen = dis.readFloat(); colorBlue = dis.readFloat(); opacityRed = dis.readFloat(); opacityGreen = dis.readFloat(); opacityBlue = dis.readFloat(); minX = dis.readFloat(); maxX = dis.readFloat(); minY = dis.readFloat(); maxY = dis.readFloat(); minZ = dis.readFloat(); } public boolean init( Point3f a, Point3f b, Point3f c, float cRed, float cGreen, float cBlue, float oRed, float oGreen, float oBlue) { if (oRed == 0f && oGreen == 0f && oBlue == 0f) return false; count++; // get bounds addPointToBounds(a.x, a.y, a.z); addPointToBounds(b.x, b.y, b.z); addPointToBounds(c.x, c.y, c.z); ax = a.x; ay = a.y; az = a.z; bx = b.x - ax; by = b.y - ay; bz = b.z; cx = c.x - ax; cy = c.y - ay; cz = c.z; float det = bx * cy - by * cx; if (det > -EPSILON && det < EPSILON) return false; oneOverDet = 1f / det; colorRed = cRed; colorGreen = cGreen; colorBlue = cBlue; opacityRed = oRed; opacityGreen = oGreen; opacityBlue = oBlue; return true; } private void addPointToBounds(float x, float y, float z) { minX = Calc.min(minX, x); maxX = Calc.max(maxX, x); minY = Calc.min(minY, y); maxY = Calc.max(maxY, y); minZ = Calc.min(minZ, z); } public void sample(Sampler sampler) { Point2f smin = sampler.getMin(); float mpMinX = minX - smin.x; float mpMaxX = maxX - smin.x; float mpMinY = minY - smin.y; float mpMaxY = maxY - smin.y; int minColumn = Calc.clamp( (int) (mpMinX * sampler.getOneOverSampleWidth()), 0, sampler.getWidth() - 1); int minRow = Calc.clamp( (int) (mpMinY * sampler.getOneOverSampleHeight()), 0, sampler.getHeight() - 1); int maxColumn = Calc.clamp( (int) (mpMaxX * sampler.getOneOverSampleWidth()), 0, sampler.getWidth() - 1); int maxRow = Calc.clamp( (int) (mpMaxY * sampler.getOneOverSampleHeight()), 0, sampler.getHeight() - 1); for (int row = minRow; row <= maxRow; row++) { for (int col = minColumn; col <= maxColumn; col++) { SamplePoint sp = sampler.getSamplePoint(col, row); sampleAtPoint(sp); } } } public void sampleAtPoint(SamplePoint sp) { Point2f point = sp.getPoint(); /* if (point.x < minX || point.x > maxX || point.y < minY || point.y > maxY) return; */ if (sp.isOpaque() && sp.getZ() < minZ) return; float ox = point.x - ax; float oy = point.y - ay; float u = (ox * cy - oy * cx) * oneOverDet; if (u < 0f || u > 1f) return; float v = (oy * bx - ox * by) * oneOverDet; if (v < 0 || u + v > 1) return; float z = (1f - u - v) * az + u * bz + v * cz; sp.addSample( colorRed, colorGreen, colorBlue, opacityRed, opacityGreen, opacityBlue, z); return; } } Index: SimpleMicropolygon.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/render/SimpleMicropolygon.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** SimpleMicropolygon.java 6 Jan 2004 12:10:53 -0000 1.17 --- SimpleMicropolygon.java 14 Jan 2004 03:06:35 -0000 1.18 *************** *** 1,4 **** /* ! Micropolygon.java Copyright (C) 2003 Gerardo Horvilleur Martinez --- 1,4 ---- /* ! SimpleMicropolygon.java Copyright (C) 2003 Gerardo Horvilleur Martinez Index: SamplePoint.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/render/SamplePoint.java,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** SamplePoint.java 6 Jan 2004 12:10:53 -0000 1.21 --- SamplePoint.java 14 Jan 2004 03:06:35 -0000 1.22 *************** *** 23,27 **** import java.util.List; ! import javax.vecmath.Color3f; import javax.vecmath.Point2f; --- 23,27 ---- import java.util.List; ! import javax.vecmath.Color4f; import javax.vecmath.Point2f; *************** *** 52,59 **** point.set(x, y); samples.clear(); - /* - for (int i = samples.size() - 1; i >= 0; i--) - samples.remove(i); - */ opaque = false; z = Constants.INFINITY; --- 52,55 ---- *************** *** 112,117 **** } ! public void getColor(Color3f ocolor) { ! ocolor.set(0f, 0f, 0f); int i = 0; int size = samples.size(); --- 108,113 ---- } ! public void getColor(Color4f ocolor) { ! ocolor.set(0f, 0f, 0f, 0f); int i = 0; int size = samples.size(); Index: FileBucket.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/render/FileBucket.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** FileBucket.java 5 Nov 2003 04:13:12 -0000 1.5 --- FileBucket.java 14 Jan 2004 03:06:35 -0000 1.6 *************** *** 140,144 **** DataInputStream dis = new DataInputStream(new BufferedInputStream(fis)); for (int i = 0; i < count; i++) { ! Micropolygon mp = new SimpleMicropolygon(); mp.read(dis); micropolygons.push(mp); --- 140,144 ---- DataInputStream dis = new DataInputStream(new BufferedInputStream(fis)); for (int i = 0; i < count; i++) { ! Micropolygon mp = new FastSimpleMicropolygon(); mp.read(dis); micropolygons.push(mp); Index: RendererHidden.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/render/RendererHidden.java,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -d -r1.58 -r1.59 *** RendererHidden.java 15 Dec 2003 06:21:33 -0000 1.58 --- RendererHidden.java 14 Jan 2004 03:06:35 -0000 1.59 *************** *** 233,237 **** } ! public void addToBuckets(SimpleMicropolygon mp) { if (mp.getMaxX() < rasterWindowMin.x || mp.getMaxY() < rasterWindowMin.y) return; --- 233,237 ---- } ! public void addToBuckets(Micropolygon mp) { if (mp.getMaxX() < rasterWindowMin.x || mp.getMaxY() < rasterWindowMin.y) return; *************** *** 294,299 **** * bucketColumns * (sampler.getHeight() + vFilterExtra + vPixelLess * sampler.getPixelHeight()) ! * 3]; ! float[] filteredSamples = new float[bucketWidth * bucketHeight * 3]; int[] pixels = new int[bucketWidth * bucketHeight]; float[] depths = new float[bucketWidth * bucketHeight]; --- 294,299 ---- * bucketColumns * (sampler.getHeight() + vFilterExtra + vPixelLess * sampler.getPixelHeight()) ! * 4]; ! float[] filteredSamples = new float[bucketWidth * bucketHeight * 4]; int[] pixels = new int[bucketWidth * bucketHeight]; float[] depths = new float[bucketWidth * bucketHeight]; *************** *** 361,367 **** * bucketColumns * sampler.getWidth()) ! * 3, bucketColumns * sampler.getWidth(), ! 3, 0); samplesFilter.doFilter( --- 361,367 ---- * bucketColumns * sampler.getWidth()) ! * 4, bucketColumns * sampler.getWidth(), ! 4, 0); samplesFilter.doFilter( *************** *** 371,375 **** ? 0 : (hFilterExtra + hPixelLess * sampler.getPixelWidth()))) ! * 3, bucketColumns * sampler.getWidth(), filteredSamples, --- 371,375 ---- ? 0 : (hFilterExtra + hPixelLess * sampler.getPixelWidth()))) ! * 4, bucketColumns * sampler.getWidth(), filteredSamples, *************** *** 380,384 **** sampler.getPixelWidth(), sampler.getPixelHeight(), ! 3); colorsToPixels(filteredSamples, pixels); imageStore.setPixels( --- 380,384 ---- sampler.getPixelWidth(), sampler.getPixelHeight(), ! 4); colorsToPixels(filteredSamples, pixels); imageStore.setPixels( *************** *** 429,433 **** * bucketColumns * sampler.getWidth() ! * 3, samples, 0, --- 429,433 ---- * bucketColumns * sampler.getWidth() ! * 4, samples, 0, *************** *** 435,439 **** * bucketColumns * sampler.getWidth() ! * 3); } if (frame.isShowProgressEnabled()) --- 435,439 ---- * bucketColumns * sampler.getWidth() ! * 4); } if (frame.isShowProgressEnabled()) *************** *** 523,530 **** for (int row = 0; row < bucketHeight; row++) for (int col = 0; col < bucketWidth; col++) { ! int offset = (row * bucketWidth + col) * 3; tmp.x = colors[offset++]; tmp.y = colors[offset++]; ! tmp.z = colors[offset]; frame.getExposure().expose(tmp, tmp); Quantizer qt = frame.getColorQuantizer(); --- 523,531 ---- for (int row = 0; row < bucketHeight; row++) for (int col = 0; col < bucketWidth; col++) { ! int offset = (row * bucketWidth + col) * 4; tmp.x = colors[offset++]; tmp.y = colors[offset++]; ! tmp.z = colors[offset++]; ! float alphaFloat = colors[offset]; frame.getExposure().expose(tmp, tmp); Quantizer qt = frame.getColorQuantizer(); *************** *** 532,537 **** int green = qt.quantize(tmp.y); int blue = qt.quantize(tmp.z); offset = row * bucketWidth + col; ! result[offset] = ((255 << 24) | (red << 16) | (green << 8) | blue); } } --- 533,539 ---- int green = qt.quantize(tmp.y); int blue = qt.quantize(tmp.z); + int alpha = qt.quantize(alphaFloat); offset = row * bucketWidth + col; ! result[offset] = ((alpha << 24) | (red << 16) | (green << 8) | blue); } } Index: ShaderVariables.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/render/ShaderVariables.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** ShaderVariables.java 25 Nov 2003 16:34:08 -0000 1.10 --- ShaderVariables.java 14 Jan 2004 03:06:35 -0000 1.11 *************** *** 114,118 **** for (int row = 0; row < rows - 1; row++) { int offset = row * columns + col; ! SimpleMicropolygon mp = new SimpleMicropolygon(); if (mp .init( --- 114,118 ---- for (int row = 0; row < rows - 1; row++) { int offset = row * columns + col; ! Micropolygon mp = new FastSimpleMicropolygon(); if (mp .init( *************** *** 127,131 **** o[offset].z)) rh.addToBuckets(mp); ! mp = new SimpleMicropolygon(); if (mp .init( --- 127,131 ---- o[offset].z)) rh.addToBuckets(mp); ! mp = new FastSimpleMicropolygon(); if (mp .init( Index: Sample.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/render/Sample.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Sample.java 6 Jan 2004 12:10:53 -0000 1.9 --- Sample.java 14 Jan 2004 03:06:35 -0000 1.10 *************** *** 20,24 **** package org.jrman.render; ! import javax.vecmath.Color3f; public class Sample { --- 20,26 ---- package org.jrman.render; ! import javax.vecmath.Color4f; ! ! import org.jrman.util.Calc; public class Sample { *************** *** 64,76 **** } ! public void overlayOver(Color3f ocolor) { if (opaque) { ocolor.x = colorRed; ocolor.y = colorGreen; ocolor.z = colorBlue; } else { ocolor.x = ocolor.x * (1f - opacityRed) + colorRed; ocolor.y = ocolor.y * (1f - opacityGreen) + colorGreen; ocolor.z = ocolor.z * (1f - opacityBlue) + colorBlue; } } --- 66,81 ---- } ! public void overlayOver(Color4f ocolor) { if (opaque) { ocolor.x = colorRed; ocolor.y = colorGreen; ocolor.z = colorBlue; + ocolor.w = 1f; } else { ocolor.x = ocolor.x * (1f - opacityRed) + colorRed; ocolor.y = ocolor.y * (1f - opacityGreen) + colorGreen; ocolor.z = ocolor.z * (1f - opacityBlue) + colorBlue; + float opacity = (opacityRed + opacityGreen + opacityBlue) / 3f; + ocolor.w = Calc.min(1f, opacity + ocolor.w); } } Index: Micropolygon.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/render/Micropolygon.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** Micropolygon.java 13 Nov 2003 14:57:42 -0000 1.16 --- Micropolygon.java 14 Jan 2004 03:06:35 -0000 1.17 *************** *** 24,27 **** --- 24,29 ---- import java.io.IOException; + import javax.vecmath.Point3f; + import org.jrman.util.Constants; *************** *** 32,36 **** /* public Micropolygon next; ! public int startCol; */ --- 34,38 ---- /* public Micropolygon next; ! public int startCol; */ *************** *** 46,53 **** protected float minZ = Constants.INFINITY; public abstract void sample(Sampler sampler); ! public abstract void write(DataOutputStream dos) throws IOException; ! public abstract void read(DataInputStream dis) throws IOException; --- 48,66 ---- protected float minZ = Constants.INFINITY; + public abstract boolean init( + Point3f a, + Point3f b, + Point3f c, + float cRed, + float cGreen, + float cBlue, + float oRed, + float oGreen, + float oBlue); + public abstract void sample(Sampler sampler); ! public abstract void write(DataOutputStream dos) throws IOException; ! public abstract void read(DataInputStream dis) throws IOException; Index: Sampler.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/render/Sampler.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** Sampler.java 6 Jan 2004 12:10:53 -0000 1.19 --- Sampler.java 14 Jan 2004 03:06:35 -0000 1.20 *************** *** 20,24 **** package org.jrman.render; ! import javax.vecmath.Color3f; import javax.vecmath.Point2f; --- 20,24 ---- package org.jrman.render; ! import javax.vecmath.Color4f; import javax.vecmath.Point2f; *************** *** 30,36 **** public class Sampler { ! private Point2f min = new Point2f(); ! private Color3f tmpColor = new Color3f(); private int width; --- 30,36 ---- public class Sampler { ! private static Color4f tmpColor = new Color4f(); ! private Point2f min = new Point2f(); private int width; *************** *** 112,119 **** public void init(float minX, float minY) { min.set(minX, minY); ! float y = min.y; int offset = 0; for (int row = 0; row < height; row++) { ! float x = min.x; for (int column = 0; column < width; column++) { float jx = x + Rand.uniform() * sampleWidth; --- 112,119 ---- public void init(float minX, float minY) { min.set(minX, minY); ! float y = minY; int offset = 0; for (int row = 0; row < height; row++) { ! float x = minX; for (int column = 0; column < width; column++) { float jx = x + Rand.uniform() * sampleWidth; *************** *** 227,231 **** dst[offset++] = tmpColor.x; dst[offset++] = tmpColor.y; ! dst[offset] = tmpColor.z; } destOffset += rowLength; --- 227,232 ---- dst[offset++] = tmpColor.x; dst[offset++] = tmpColor.y; ! dst[offset++] = tmpColor.z; ! dst[offset++] = tmpColor.w; } destOffset += rowLength; *************** *** 237,240 **** --- 238,242 ---- dst[offset++] = 0f; dst[offset++] = 0f; + dst[offset++] = 0f; dst[offset] = 0f; } |
From: <ma...@us...> - 2004-01-14 03:06:38
|
Update of /cvsroot/jrman/drafts/sampleData In directory sc8-pr-cvs1:/tmp/cvs-serv30338/sampleData Modified Files: vehicles.rib sphere.rib Log Message: Implemented barycentric coordinates for micropolygon sampling. Implemented alpha in output images. Index: vehicles.rib =================================================================== RCS file: /cvsroot/jrman/drafts/sampleData/vehicles.rib,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** vehicles.rib 25 Jun 2003 17:14:05 -0000 1.4 --- vehicles.rib 14 Jan 2004 03:06:35 -0000 1.5 *************** *** 3,7 **** #Option "statistics" "endofframe" 1 ! Display "vehicles" "framebuffer" "rgb" Format 800 450 1 PixelSamples 4 4 --- 3,7 ---- #Option "statistics" "endofframe" 1 ! Display "vehicles" "framebuffer" "rgba" Format 800 450 1 PixelSamples 4 4 Index: sphere.rib =================================================================== RCS file: /cvsroot/jrman/drafts/sampleData/sphere.rib,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** sphere.rib 26 May 2003 01:47:59 -0000 1.9 --- sphere.rib 14 Jan 2004 03:06:35 -0000 1.10 *************** *** 1,2 **** --- 1,3 ---- + Display "sphere" "framebuffer" "rgba" Format 480 360 1 PixelSamples 4 4 |
From: <afa...@us...> - 2004-01-13 09:53:26
|
Update of /cvsroot/jrman/drafts/src/org/jrman/grid In directory sc8-pr-cvs1:/tmp/cvs-serv24768/src/org/jrman/grid Modified Files: Tuple3fGrid.java Log Message: implemented pnoise, removed noise,cellnoise and snoise methods taking float arguments Index: Tuple3fGrid.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/grid/Tuple3fGrid.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Tuple3fGrid.java 11 Dec 2003 15:08:06 -0000 1.8 --- Tuple3fGrid.java 13 Jan 2004 09:53:23 -0000 1.9 *************** *** 53,91 **** public void set(float in) { ! for (int i = 0; i < size; i++) { ! data[i].x = in; ! data[i].y = in; ! data[i].z = in; } } public void set(float in, BooleanGrid cond) { [...1641 lines suppressed...] ! data[i].z= z; } public void setzcomp(float z, BooleanGrid cond) { ! for (int i= 0; i < size; i++) if (cond.data[i]) ! data[i].z= z; } public void setzcomp(FloatGrid z) { ! for (int i= 0; i < size; i++) ! data[i].z= z.data[i]; } public void setzcomp(FloatGrid z, BooleanGrid cond) { ! for (int i= 0; i < size; i++) if (cond.data[i]) ! data[i].z= z.data[i]; } |
From: <afa...@us...> - 2004-01-13 09:50:26
|
Update of /cvsroot/jrman/drafts/sampleData In directory sc8-pr-cvs1:/tmp/cvs-serv24049/sampleData Added Files: pnoiseTest.rib Log Message: implemented pnoise, removed noise,cellnoise and snoise methods taking float arguments --- NEW FILE: pnoiseTest.rib --- Format 800 600 1 Display "shaderTest" "framebuffer" "rgb" #PixelSamples 4 4 #PixelFilter "box" 4 4 Exposure 1 2.2 Projection "perspective" "fov" 7 Translate 0 0 40 #Rotate -20 1 0 0 WorldBegin LightSource "distantlight" 1 "from" [0 5 -2] "to" [0 0 0] "intensity" 1 LightSource "ambientlight" 2 "intensity" 0.01 #Surface "matte" Surface "pnoisetest" "uniform float noisescale" 40 "uniform float period" 5 AttributeBegin Translate -1.1 1 1 Rotate 45 1 0 0 Sphere 1 -1 1 360 AttributeEnd AttributeBegin Translate 1.1 1 1 Patch "bilinear" "P" [-1 -1 0 -1 1 0 1 -1 0 1 1 0] AttributeEnd AttributeBegin Translate -1.1 -1.1 1 Rotate -45 1 0 0 Cylinder 1 -1 1 360 AttributeEnd AttributeBegin Translate 1.1 -1.1 1 Rotate 15 1 0 0 Torus 0.8 0.2 0 360 360 AttributeEnd WorldEnd |
From: <afa...@us...> - 2004-01-13 09:49:19
|
Update of /cvsroot/jrman/drafts/src In directory sc8-pr-cvs1:/tmp/cvs-serv23868/src Added Files: SurfacePnoisetest.java SurfaceUvcheckers.java Log Message: implemented pnoise, removed noise,cellnoise and snoise methods taking float arguments --- NEW FILE: SurfacePnoisetest.java --- /* * SurfaceNoisetest.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.render.ShaderVariables; import org.jrman.shaders.SurfaceShader; public class SurfacePnoisetest 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 UniformScalarFloat(new Declaration("period", "uniform float"), 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(); UniformScalarFloat paramPeriod= (UniformScalarFloat)getParameter(sv, "period"); final float period= paramPeriod.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); // fg1.mul(sv.u, noisescale); // fg2.mul(sv.v, noisescale); // fg1.pnoise(fg1, fg2, period, period); vg1.mul(sv.P, noisescale); fg1.pnoise(vg1, period, period, period); cg3.set(fg1); cg1.mul(cg1, cg3); sv.Ci.mul(sv.Os, cg1); } } --- NEW FILE: SurfaceUvcheckers.java --- /* * 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); } } |
From: <afa...@us...> - 2004-01-13 09:47:23
|
Update of /cvsroot/jrman/drafts/src/org/jrman/grid In directory sc8-pr-cvs1:/tmp/cvs-serv23556/src/org/jrman/grid Modified Files: FloatGrid.java Log Message: implemented pnoise, removed noise,cellnoise and snoise methods taking float arguments Index: FloatGrid.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/grid/FloatGrid.java,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** FloatGrid.java 20 Dec 2003 15:35:05 -0000 1.21 --- FloatGrid.java 13 Jan 2004 09:47:19 -0000 1.22 *************** *** 1,24 **** /* ! FloatGrid.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, [...2657 lines suppressed...] * simulPow */ ! ! public void simulPow(FloatGrid f1, float n) ! { ! for (int i = 0; i < size; i++) { ! float t = f1.data[i]; ! data[i] = t / (n - n * t + t); } } --- 1466,1474 ---- * simulPow */ ! ! public void simulPow(FloatGrid f1, float n) { ! for (int i= 0; i < size; i++) { ! float t= f1.data[i]; ! data[i]= t / (n - n * t + t); } } |
From: <afa...@us...> - 2004-01-13 09:47:01
|
Update of /cvsroot/jrman/drafts/src/org/jrman/util In directory sc8-pr-cvs1:/tmp/cvs-serv23476/src/org/jrman/util Modified Files: PerlinNoise.java Log Message: implemented pnoise, removed noise,cellnoise and snoise methods taking float arguments Index: PerlinNoise.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/util/PerlinNoise.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PerlinNoise.java 14 Dec 2003 22:28:28 -0000 1.2 --- PerlinNoise.java 13 Jan 2004 09:46:56 -0000 1.3 *************** *** 1,74 **** ! /* ! PerlinNoise.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 [...1059 lines suppressed...] ! // //s=PerlinNoise.noise2d(x+s,y+s); ! // //s=PerlinNoise.noise1d(s); ! // //s=PerlinNoise.noise1d(x+s); ! // if (s < min) ! // min= s; ! // else if (s > max) ! // max= s; ! // int col= Color.getHSBColor(0.f, 0.f, 0.5f*s+0.5f).getRGB(); ! // image.setRGB(i, j, col); ! // } ! // System.out.println("millis " + (System.currentTimeMillis() - time)); ! // System.out.println("min=" + min + " max=" + max); ! // JFrame frame= new JFrame("noise"); ! // JLabel label= new JLabel(new ImageIcon(image)); ! // frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); ! // frame.getContentPane().add(label); ! // frame.pack(); ! // frame.setVisible(true); ! // } ! } |
From: <ma...@us...> - 2004-01-06 12:10:56
|
Update of /cvsroot/jrman/drafts/src/org/jrman/render In directory sc8-pr-cvs1:/tmp/cvs-serv8157/src/org/jrman/render Modified Files: Sample.java SamplePoint.java Sampler.java SimpleMicropolygon.java Log Message: Minor optimizations. Index: Sample.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/render/Sample.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Sample.java 31 Dec 2003 16:26:35 -0000 1.8 --- Sample.java 6 Jan 2004 12:10:53 -0000 1.9 *************** *** 65,71 **** public void overlayOver(Color3f ocolor) { ! ocolor.x = ocolor.x * (1f - opacityRed) + colorRed; ! ocolor.y = ocolor.y * (1f - opacityGreen) + colorGreen; ! ocolor.z = ocolor.z * (1f - opacityBlue) + colorBlue; } --- 65,77 ---- public void overlayOver(Color3f ocolor) { ! if (opaque) { ! ocolor.x = colorRed; ! ocolor.y = colorGreen; ! ocolor.z = colorBlue; ! } else { ! ocolor.x = ocolor.x * (1f - opacityRed) + colorRed; ! ocolor.y = ocolor.y * (1f - opacityGreen) + colorGreen; ! ocolor.z = ocolor.z * (1f - opacityBlue) + colorBlue; ! } } Index: SamplePoint.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/render/SamplePoint.java,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** SamplePoint.java 6 Jan 2004 10:59:39 -0000 1.20 --- SamplePoint.java 6 Jan 2004 12:10:53 -0000 1.21 *************** *** 52,55 **** --- 52,59 ---- point.set(x, y); samples.clear(); + /* + for (int i = samples.size() - 1; i >= 0; i--) + samples.remove(i); + */ opaque = false; z = Constants.INFINITY; Index: Sampler.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/render/Sampler.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** Sampler.java 31 Dec 2003 16:26:35 -0000 1.18 --- Sampler.java 6 Jan 2004 12:10:53 -0000 1.19 *************** *** 50,53 **** --- 50,57 ---- private float sampleHeight; + private float oneOverSampleWidth; + + private float oneOverSampleHeight; + private SamplePoint[] samplePoints; *************** *** 92,96 **** --- 96,102 ---- pixelHeight = height / bucketHeight; sampleWidth = 1f / hSamples; + oneOverSampleWidth = hSamples; sampleHeight = 1f / vSamples; + oneOverSampleHeight = vSamples; samplePoints = new SamplePoint[width * height]; for (int row = 0; row < height; row++) *************** *** 284,287 **** --- 290,301 ---- public float getSampleWidth() { return sampleWidth; + } + + public float getOneOverSampleHeight() { + return oneOverSampleHeight; + } + + public float getOneOverSampleWidth() { + return oneOverSampleWidth; } Index: SimpleMicropolygon.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/render/SimpleMicropolygon.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** SimpleMicropolygon.java 20 Dec 2003 18:56:56 -0000 1.16 --- SimpleMicropolygon.java 6 Jan 2004 12:10:53 -0000 1.17 *************** *** 214,224 **** float mpMaxY = maxY - smin.y; int minColumn = ! Calc.clamp((int) (mpMinX / sampler.getSampleWidth()), 0, sampler.getWidth() - 1); int minRow = ! Calc.clamp((int) (mpMinY / sampler.getSampleHeight()), 0, sampler.getHeight() - 1); int maxColumn = ! Calc.clamp((int) (mpMaxX / sampler.getSampleWidth()), 0, sampler.getWidth() - 1); int maxRow = ! Calc.clamp((int) (mpMaxY / sampler.getSampleHeight()), 0, sampler.getHeight() - 1); for (int row = minRow; row <= maxRow; row++) { for (int col = minColumn; col <= maxColumn; col++) { --- 214,224 ---- float mpMaxY = maxY - smin.y; int minColumn = ! Calc.clamp((int) (mpMinX * sampler.getOneOverSampleWidth()), 0, sampler.getWidth() - 1); int minRow = ! Calc.clamp((int) (mpMinY * sampler.getOneOverSampleHeight()), 0, sampler.getHeight() - 1); int maxColumn = ! Calc.clamp((int) (mpMaxX * sampler.getOneOverSampleWidth()), 0, sampler.getWidth() - 1); int maxRow = ! Calc.clamp((int) (mpMaxY * sampler.getOneOverSampleHeight()), 0, sampler.getHeight() - 1); for (int row = minRow; row <= maxRow; row++) { for (int col = minColumn; col <= maxColumn; col++) { |
From: <ma...@us...> - 2004-01-06 10:59:42
|
Update of /cvsroot/jrman/drafts/src/org/jrman/util In directory sc8-pr-cvs1:/tmp/cvs-serv27666/src/org/jrman/util Modified Files: SamplesFilter.java Log Message: Minor optimization Index: SamplesFilter.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/util/SamplesFilter.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SamplesFilter.java 3 Jul 2003 17:57:52 -0000 1.2 --- SamplesFilter.java 6 Jan 2004 10:59:39 -0000 1.3 *************** *** 33,36 **** --- 33,38 ---- protected float amplitudeSum; + protected float oneOverAmplitudeSum; + protected abstract float filterFunc(float x, float y, float xWidth, float yWidth); *************** *** 52,57 **** --- 54,61 ---- y += yInc; } + oneOverAmplitudeSum = 1f / amplitudeSum; } + /* public void doFilter( float[] src, *************** *** 70,73 **** --- 74,78 ---- for (int band = 0; band < bandCount; band++) { float sum = 0f; + int amplitudeOffset = 0; for (int sampleRow = 0; sampleRow < height; sampleRow++) for (int sampleCol = 0; sampleCol < width; sampleCol++) { *************** *** 79,84 **** * bandCount + band; ! int amplitudeOffset = sampleRow * width + sampleCol; ! sum += src[offset] * amplitude[amplitudeOffset]; } sum /= amplitudeSum; --- 84,89 ---- * bandCount + band; ! // int amplitudeOffset = sampleRow * width + sampleCol; ! sum += src[offset] * amplitude[amplitudeOffset++]; } sum /= amplitudeSum; *************** *** 86,90 **** --- 91,136 ---- } } + */ + public void doFilter( + float[] src, + int srcOffset, + int srcRowLength, + float[] dst, + int dstOffset, + int dstRowLength, + int colCount, + int rowCount, + int horizontalStep, + int verticalStep, + int bandCount) { + int rowStart = srcOffset; + int rowOffsetIncr = srcRowLength * bandCount; + int rowStartIncr = rowOffsetIncr * verticalStep; + int colStartIncr = horizontalStep * bandCount; + for (int row = 0; row < rowCount; row++) { + int colStart = 0; + for (int col = 0; col < colCount; col++) { + for (int band = 0; band < bandCount; band++) { + float sum = 0f; + int amplitudeOffset = 0; + int rowOffset = rowStart + colStart + band; + for (int sampleRow = 0; sampleRow < height; sampleRow++) { + int offset = rowOffset; + for (int sampleCol = 0; sampleCol < width; sampleCol++) { + sum += src[offset] * amplitude[amplitudeOffset++]; + offset += bandCount; + } + rowOffset += rowOffsetIncr; + } + sum *= oneOverAmplitudeSum; + dst[dstOffset + (dstRowLength * row + col) * bandCount + band] = sum; + } + colStart += colStartIncr; + } + rowStart += rowStartIncr; + } + } + private int getValue(byte[] src, int s, int t, int size, Mode sMode, Mode tMode, int band) { if (s < 0 || s >= size) { *************** *** 130,134 **** sum += value * amplitude[amplitudeOffset]; } ! sum /= amplitudeSum; dst[(dstRowLength * row + col) * 4 + band] = (byte) Calc.clamp(sum, 0f, 255f); --- 176,180 ---- sum += value * amplitude[amplitudeOffset]; } ! sum *= oneOverAmplitudeSum; dst[(dstRowLength * row + col) * 4 + band] = (byte) Calc.clamp(sum, 0f, 255f); |
From: <ma...@us...> - 2004-01-06 10:59:42
|
Update of /cvsroot/jrman/drafts/src/org/jrman/render In directory sc8-pr-cvs1:/tmp/cvs-serv27666/src/org/jrman/render Modified Files: SamplePoint.java Log Message: Minor optimization Index: SamplePoint.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/render/SamplePoint.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** SamplePoint.java 31 Dec 2003 16:26:35 -0000 1.19 --- SamplePoint.java 6 Jan 2004 10:59:39 -0000 1.20 *************** *** 66,70 **** float z) { int i = 0; ! while (i < samples.size()) { Sample s = (Sample) samples.get(i++); if (s.behind(z)) { --- 66,71 ---- float z) { int i = 0; ! int size = samples.size(); ! while (i < size) { Sample s = (Sample) samples.get(i++); if (s.behind(z)) { |
From: <ma...@us...> - 2003-12-31 16:26:39
|
Update of /cvsroot/jrman/drafts/src/org/jrman/render In directory sc8-pr-cvs1:/tmp/cvs-serv15502/src/org/jrman/render Modified Files: Sample.java SamplePoint.java Sampler.java Log Message: Minor optimization Index: Sample.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/render/Sample.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Sample.java 30 Dec 2003 23:42:00 -0000 1.7 --- Sample.java 31 Dec 2003 16:26:35 -0000 1.8 *************** *** 38,43 **** private float z; ! boolean opaque; ! public Sample(float cRed, float cGreen, float cBlue, float oRed, float oGreen, float oBlue, float z) { --- 38,43 ---- private float z; ! private boolean opaque; ! public Sample(float cRed, float cGreen, float cBlue, float oRed, float oGreen, float oBlue, float z) { Index: SamplePoint.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/render/SamplePoint.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** SamplePoint.java 30 Dec 2003 23:42:00 -0000 1.18 --- SamplePoint.java 31 Dec 2003 16:26:35 -0000 1.19 *************** *** 80,84 **** samples.add(--i, sample); if (sample.isOpaque()) ! update(sample.getZ()); return; } else if (s.isOpaque()) --- 80,84 ---- samples.add(--i, sample); if (sample.isOpaque()) ! update(z); return; } else if (s.isOpaque()) *************** *** 96,108 **** samples.add(sample); if (sample.isOpaque()) ! update(sample.getZ()); } private void update(float nz) { ! if (nz < z || !opaque) { z = nz; opaque = true; sampler.updateDepth(offset, z); ! } } --- 96,108 ---- samples.add(sample); if (sample.isOpaque()) ! update(z); } private void update(float nz) { ! // if (nz < z || !opaque) { z = nz; opaque = true; sampler.updateDepth(offset, z); ! // } } *************** *** 122,142 **** } - /* - public void getColor(float[] dst, int offset) { - dst[offset] = dst[offset + 1] = dst[offset + 2] = 0f; - int i = 0; - int size = samples.size(); - while (i < size) { - Sample sample = (Sample) samples.get(i++); - if (sample.isOpaque()) - break; - } - while (i > 0) { - Sample sample = (Sample) samples.get(--i); - sample.overlayOver(dst, offset); - } - } - */ - public float getDepth() { int i = 0; --- 122,125 ---- Index: Sampler.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/render/Sampler.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** Sampler.java 30 Dec 2003 23:42:00 -0000 1.17 --- Sampler.java 31 Dec 2003 16:26:35 -0000 1.18 *************** *** 308,315 **** boolean opaque = true; float z = -Constants.INFINITY; CheckOpacity : for (int r = 0; r < pixelHeight; r++) { for (int c = 0; c < pixelWidth; c++) { SamplePoint sp = ! getSamplePoint(column * pixelWidth + c, row * pixelHeight + r); if (!sp.isOpaque()) { opaque = false; --- 308,317 ---- boolean opaque = true; float z = -Constants.INFINITY; + int cOffset = column * pixelWidth; + int rOffset = row * pixelHeight; CheckOpacity : for (int r = 0; r < pixelHeight; r++) { for (int c = 0; c < pixelWidth; c++) { SamplePoint sp = ! getSamplePoint(cOffset + c, rOffset + r); if (!sp.isOpaque()) { opaque = false; *************** *** 333,336 **** --- 335,379 ---- } + /* + private void updatePyramid() { + int rowOffset = 0; + boolean rootOpaque = true; + float rootZ = -Constants.INFINITY; + for (int row = 0; row < bucketHeight; row++) { + for (int column = 0; column < bucketWidth; column++) { + MaskElement me = pixelsVisibility[rowOffset + column]; + if (!me.modified) + continue; + boolean opaque = true; + float z = -Constants.INFINITY; + int cOffset = column * pixelWidth; + int rOffset = row * pixelHeight; + CheckOpacity : for (int r = 0; r < pixelHeight; r++) { + for (int c = 0; c < pixelWidth; c++) { + SamplePoint sp = + getSamplePoint(cOffset + c, rOffset + r); + if (!sp.isOpaque()) { + opaque = false; + break CheckOpacity; + } else + z = Calc.max(z, sp.getZ()); + } + } + if (opaque) { + if (z < me.z) { + me.opaque = true; + me.z = z; + rootZ = Calc.max(rootZ, z); + } + } else + rootOpaque = false; + } + rowOffset += bucketWidth; + } + rootVisibility.opaque = rootOpaque; + rootVisibility.z = rootZ; + } + */ + private void updateRoot() { rootVisibility.opaque = true; *************** *** 359,364 **** int minCol = (int) Calc.clamp(minX, 0f, bucketWidth - 1); int minRow = (int) Calc.clamp(minY, 0f, bucketHeight - 1); ! int maxCol = (int) Calc.clamp((float) Math.ceil(maxX), 0f, bucketWidth - 1); ! int maxRow = (int) Calc.clamp((float) Math.ceil(maxY), 0f, bucketHeight - 1); PixelsLoop : for (int row = minRow; row <= maxRow; row++) for (int column = minCol; column <= maxCol; column++) { --- 402,407 ---- int minCol = (int) Calc.clamp(minX, 0f, bucketWidth - 1); int minRow = (int) Calc.clamp(minY, 0f, bucketHeight - 1); ! int maxCol = (int) Calc.clamp((float) Calc.ceil(maxX), 0f, bucketWidth - 1); ! int maxRow = (int) Calc.clamp((float) Calc.ceil(maxY), 0f, bucketHeight - 1); PixelsLoop : for (int row = minRow; row <= maxRow; row++) for (int column = minCol; column <= maxCol; column++) { |