Iterator it = theShapes.iterator();
while (it.hasNext())
{
it.next().transform(worldMat);
}
(theObjects.get(0)).transform(worldMat);
Iterator it = theShapes.iterator();
while (it.hasNext())
{
it.next().transform(worldMat);
}
(theObjects.get(0)).transform(worldMat);
Iterator it = theShaped.iterator();while (it.hasNext()) { ((MyClass)(it.next())).transform(worldMat);}ArrayList<MyClass> theShaped = new ArrayList<MyClass>...add elements to the ArrayList...for (MyClass element : theShaped) { element.transform(worldMat);}((SceneElement)theObjects.get(it.next())).transform(worldMat)((SceneElement)(it.next())).transform(deviceMat);List < GameObject > gObjs = new LinkedList < GameObject >();ListIterator < GameObject > it = gObjs.listIterator();while ( it.hasNext() ) { it.next().doSomething();} public void worldToDevice() { Iterator it = theObjects.iterator(); while (it.hasNext()) { //perform relevant transformations ((SceneElement)(it.next())).transform(deviceMat); } }for (SceneElement e : gObjs) { e.doSomething();}public void worldToDevice() { Iterator it = theObjects.iterator(); while (it.hasNext()) { ((SceneElement)(it.next())).myFirstMethod(); ((SceneElement)(it.next())).mySecondMethod(); // could give error }}public void worldToDevice() { Iterator it = theObjects.iterator(); while (it.hasNext()) { SceneElement e = (SceneElement)it.next(); e.myFirstMethod(); e.mySecondMethod(); }}List theObjects = new ArrayList();// non-generic version// -> not typesafe// -> casting requiredList<SceneElement> theObjects = new ArrayList<SceneElement>();// generic version// -> typesafe// -> no casting requiredfor (SceneElement e : theObjects){ e.transform(deviceMat);}Quote:
Original post by edd1986
i have just added an oversized normal array with a counter of how many elements are filled. Not perfect but at least it works.
This topic has been locked by a moderator. New replies are not allowed.
With your permission, GameDev.net uses analytics cookies to understand how people use the platform. You can accept analytics or continue with necessary cookies only. Learn more