From: Gerardo H. <ma...@us...> - 2007-03-06 18:43:00
|
Update of /cvsroot/jrman/drafts/src/org/jrman/parameters In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv28800/src/org/jrman/parameters Modified Files: Declaration.java ParameterList.java Added Files: ParamInfo.java Parameters.java Log Message: Started working on new internal representation for primitive parameters (to handle dicing and splitting for all vertex parameters). --- NEW FILE: ParamInfo.java --- /* ParamInfo.java Copyright (C) 2007 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.parameters; public class ParamInfo { private Declaration declaration; private int offset; private int count; public ParamInfo(Declaration declaration, int offset, int count) { this.declaration = declaration; this.offset = offset; this.count = count; } public void adjust(int offset) { this.offset = offset; } public void adjust(int offset, int count) { this.offset = offset; this.count = count; } public Declaration getDeclaration() { return declaration; } public int getOffset() { return offset; } public int getCount() { return count; } } Index: Declaration.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parameters/Declaration.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Declaration.java 1 Mar 2007 00:50:28 -0000 1.10 --- Declaration.java 6 Mar 2007 18:42:45 -0000 1.11 *************** *** 84,104 **** public static class Type { ! public static final Type FLOAT = new Type("float"); ! public static final Type INTEGER = new Type("integer"); ! public static final Type STRING = new Type("string"); ! public static final Type COLOR = new Type("color"); ! public static final Type POINT = new Type("point"); ! public static final Type VECTOR = new Type("vector"); ! public static final Type NORMAL = new Type("normal"); ! public static final Type MATRIX = new Type("matrix"); ! public static final Type HPOINT = new Type("hpoint"); private final static Map<String, Type> map = --- 84,104 ---- public static class Type { ! public static final Type FLOAT = new Type("float", 1); ! public static final Type INTEGER = new Type("integer", 1); ! public static final Type STRING = new Type("string", 1); ! public static final Type COLOR = new Type("color", 3); ! public static final Type POINT = new Type("point", 3); ! public static final Type VECTOR = new Type("vector", 3); ! public static final Type NORMAL = new Type("normal", 3); ! public static final Type MATRIX = new Type("matrix", 16); ! public static final Type HPOINT = new Type("hpoint", 4); private final static Map<String, Type> map = *************** *** 119,124 **** private String name; ! private Type(String name) { this.name = name; } --- 119,127 ---- private String name; ! private int elementCount; ! ! private Type(String name, int elementCount) { this.name = name; + this.elementCount = elementCount; } *************** *** 131,134 **** --- 134,141 ---- } + public int getElementCount() { + return elementCount; + } + public String toString() { return name; *************** *** 190,197 **** --- 197,216 ---- } + public Type getElementType() { + if (type == Type.INTEGER) + return Type.INTEGER; + if (type == Type.STRING) + return Type.STRING; + return Type.FLOAT; + } + public int getCount() { return count; } + public int getElementCount() { + return type.getElementCount() * count; + } + public boolean equals(Object other) { if (other == null) Index: ParameterList.java =================================================================== RCS file: /cvsroot/jrman/drafts/src/org/jrman/parameters/ParameterList.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** ParameterList.java 24 Dec 2006 05:25:56 -0000 1.10 --- ParameterList.java 6 Mar 2007 18:42:45 -0000 1.11 *************** *** 20,24 **** package org.jrman.parameters; - public class ParameterList { --- 20,23 ---- --- NEW FILE: Parameters.java --- /* Parameters.java Copyright (C) 2007 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.parameters; public class Parameters { private ParamInfo[] constantParamsInfo; private float[] constantFloats; private int[] constantIntegers; private String[] constantStrings; private ParamInfo[] uniformParamsInfo; private float[] uniformFloats; private int[] uniformIntegers; private String[] uniformStrings; private ParamInfo[] varyingParamsInfo; private float[][] varyingFloats; private ParamInfo[] vertexParamsInfo; private float[][] vertexFloats; public Parameters(ParamInfo[] constantParamsInfo, float[] constantFloats, int[] constantIntegers, String[] constantStrings, ParamInfo[] uniformParamsInfo, float[] uniformFloats, int[] uniformIntegers, String[] uniformStrings, ParamInfo[] varyingParamsInfo, float[][] varyingFloats, ParamInfo[] vertexParamsInfo, float[][] vertexFloats) { this.constantParamsInfo = constantParamsInfo; this.constantFloats = constantFloats; this.constantIntegers = constantIntegers; this.constantStrings = constantStrings; this.uniformParamsInfo = uniformParamsInfo; this.uniformFloats = uniformFloats; this.uniformIntegers = uniformIntegers; this.uniformStrings = uniformStrings; this.varyingParamsInfo = varyingParamsInfo; this.varyingFloats = varyingFloats; this.vertexParamsInfo = vertexParamsInfo; this.vertexFloats = vertexFloats; } } |