VertexController speed

Started by cyberkilla, February 13, 2007, 04:08:28 PM

Previous topic - Next topic

cyberkilla

Egon, how costly is using a VertexController, in a case like skeletal animation,
when you need to have mesh access for almost every frame?
http://futurerp.net - Text Based MMORPG
http://beta.rpwar.com - 3D Isometric MMORPG

EgonOlsen

Not much! The critical parts are in your hands, i.e. in the implementation of the actual apply()-method.

cyberkilla

Oh, well that is no good!

Now I have nobody else to blame when I try it later, and it runs slow;)

Actually, I think it should do fine. Im going for proper skeletal animation
for now, instead of the mesh keyframes(cant explain why, it just happened that way);)

Im trying to keep everything neat, and documented, because I'd like to see if somebody would test it for me soon.

One more thing...Egon, your XML reader...I will use it:) At the moment, im using jdom, because I had it set up already, and knew how to use it.
Your xml parser looks nice and simple, and it seems to be DOM also, so no problems here:)
http://futurerp.net - Text Based MMORPG
http://beta.rpwar.com - 3D Isometric MMORPG

EgonOlsen

The XML-parser...yes, it's very simple. Maybe too simple. If it's missing something, please let me know. It's something that i had written just because i had nothing else to do. It's far from being perfect, i guess.

cyberkilla

The only things that come into common use when I use jdom, are...

node.getChild("name")
First child node found is returned.

node.getChildren("name")
Returns all child nodes in a List.

node.getAttributeValue("name")
Returns value of attribute if found.

node.getText()
Returns contents of the xml node.

node.getChildText("name")
Returns contents of a child node.

Everything here seems to be implemented in some way, in your parser,
so it should be okay for now:) I hope;).

As you can see, those methods are merely convieniences.
http://futurerp.net - Text Based MMORPG
http://beta.rpwar.com - 3D Isometric MMORPG

cyberkilla

Modifications to be like jdom....
What im using for skeletal api, because it is a million times faster then
changing lots of code:P


public class XMLParserFactory
{
private static XMLParserFactory defaultInstance = new XMLParserFactory();

public static XMLParserFactory getInstance()
{
return defaultInstance;
}
public XMLElement parseXML(String input)
{
return new XMLElement(XMLFactory.getInstance().parseXML(input));
}
}


public class XMLElement
{
XMLNode node;

public XMLElement(XMLNode node)
{
this.node = node;
}
public XMLElement getChild(String name)
{
Vector nodes = XMLFactory.getInstance().getMatchingNodes(node.getName()+"/"+name,node);
if(nodes.size() == 0)
return null;

XMLNode newNode = (XMLNode)nodes.get(0);
return new XMLElement(newNode);
}
public List<XMLElement> getChildren(String name)
{
List<XMLElement> elements = new ArrayList<XMLElement>(20);
Vector<?> nodes = XMLFactory.getInstance().getMatchingNodes(node.getName()+"/"+name,node);

for(Object o : nodes)
elements.add(new XMLElement((XMLNode)o));

return elements;
}
public String getAttributeValue(String name)
{
String value = node.getAttributeValue(name);
return (value.length() != 0) ? value : null;
}
public String getText()
{
return node.getData();
}
public String getChildText(String name)
{
XMLElement element = getChild(name);

if(element != null)
return element.getText();
else
return null;
}
}

I am just too used to the jdom conventions, i suppose:)
http://futurerp.net - Text Based MMORPG
http://beta.rpwar.com - 3D Isometric MMORPG