public class ASUtils
extends java.lang.Object
This class contains utility tools for all common or proprietary assembling classes.
This source is free; you can redistribute it and/or modify it under the terms of the GNU General Public License and by nameing of the originally author
| Modifier and Type | Class and Description |
|---|---|
(package private) static class |
ASUtils.Point2D
cloneable Wrapper
|
(package private) static class |
ASUtils.Point3D
cloneable Wrapper
|
| Constructor and Description |
|---|
ASUtils() |
| Modifier and Type | Method and Description |
|---|---|
static SaxParser.Record<ObjectLinker.CTXInfo,ObjectLinker.RecInfo> |
back(SaxParser.Record<ObjectLinker.CTXInfo,ObjectLinker.RecInfo> record,
int depth)
jump (n = depth) times to previous record
It uses the "Record.info.back" field for it.
|
static SaxParser.Record<ObjectLinker.CTXInfo,ObjectLinker.RecInfo> |
childBySearch(SaxParser.Record<ObjectLinker.CTXInfo,ObjectLinker.RecInfo> parent,
java.lang.String searchPtrn)
returns the first match of the children from current Record
that matches to search pattern.
|
static int[] |
demuxPArray(int[] pArray,
int offset,
int muxCnt)
extract from a multiplexed <p> array
the required indices for a Point2D or Point3D array
|
static SaxParser.Record<ObjectLinker.CTXInfo,ObjectLinker.RecInfo> |
execArgs(java.lang.String args,
SaxParser.Record<ObjectLinker.CTXInfo,ObjectLinker.RecInfo> r)
runs childBySearch() back() and next() in args order.
|
static <T> T |
getParam(java.util.ArrayList<DataAssembler.Param> p,
int index)
returns and casts the nth param value from param list
|
static PImage |
loadTexture(java.lang.String texName,
java.lang.String daeFile)
loads a PImage from file using Processing API
|
static SaxParser.Record<ObjectLinker.CTXInfo,ObjectLinker.RecInfo> |
next(SaxParser.Record<ObjectLinker.CTXInfo,ObjectLinker.RecInfo> record,
int depth)
jump (n = depth) times to next record (NOT into Children)
It uses the "Record.info.next" field for it.
|
static ASUtils.Point2D[] |
to2DPoints(float[] floatarray,
float width,
float height)
converts a collada <float_array> into 2D Texture Points.
|
static ASUtils.Point3D[] |
to3DPoints(float[] floatarray)
converts a collada <float_array> into 3D Points.
|
static float[] |
toFloats(java.lang.String floatArray)
converts float values from string separated by
" " (space) to an Array of floats
|
static int[] |
toInts(java.lang.String intArray)
converts int values from string separated by
" " (space) to an Array of integer
|
public static SaxParser.Record<ObjectLinker.CTXInfo,ObjectLinker.RecInfo> next(SaxParser.Record<ObjectLinker.CTXInfo,ObjectLinker.RecInfo> record, int depth)
current - recorddepth - public static SaxParser.Record<ObjectLinker.CTXInfo,ObjectLinker.RecInfo> childBySearch(SaxParser.Record<ObjectLinker.CTXInfo,ObjectLinker.RecInfo> parent, java.lang.String searchPtrn)
current - recordsearchPtrn - either "tagname" or "tagname#attribute=value"public static SaxParser.Record<ObjectLinker.CTXInfo,ObjectLinker.RecInfo> execArgs(java.lang.String args, SaxParser.Record<ObjectLinker.CTXInfo,ObjectLinker.RecInfo> r)
runs childBySearch() back() and next() in args order. The syntax format for each argument is "[[j][b] depth][c tagname]" separated by one space char
commands j = next, c = childBySearch, b = back
an Example can be: "j 2 c instance_effect j 1"
args - current - recordpublic static SaxParser.Record<ObjectLinker.CTXInfo,ObjectLinker.RecInfo> back(SaxParser.Record<ObjectLinker.CTXInfo,ObjectLinker.RecInfo> record, int depth)
current - recorddepth - public static float[] toFloats(java.lang.String floatArray)
floatArray - public static int[] toInts(java.lang.String intArray)
intArray - public static PImage loadTexture(java.lang.String texName,
java.lang.String daeFile)
image - file name, relative to collada file path (i.e untitled/texture0.jpg)collada - file path, relative to "data" path (i.e models/untitled.dae)public static ASUtils.Point3D[] to3DPoints(float[] floatarray)
converts a collada <float_array> into 3D Points. Its also doing a coordinate convert from Collada to processing. Creates cloneable Points
per definition is:
processing x = Collada x
processing y = Collada -z
processing z = Collada -y
floatarray - public static ASUtils.Point2D[] to2DPoints(float[] floatarray, float width, float height)
converts a collada <float_array> into 2D Texture Points. Its also doing a coordinate convert from collada to processing.Creates cloneable Points
per definition is:
textureProcessing x = textureSketchup x * picture.width
textureProcessing y = picture.height - textureSketchup y * picture.height
floatarray - imageWidth - imageHeight - public static int[] demuxPArray(int[] pArray,
int offset,
int muxCnt)
pArray - (=all indices values from <p> tag)offset - (= attribute value from collada <input> tag)muxCnt - (=how many float arrays is packed/multiplexed in <p> tag resp. in pArray)public static <T> T getParam(java.util.ArrayList<DataAssembler.Param> p, int index)
p - index -