Java3d shape with Antlr
Posted
by
Eldeus
on Stack Overflow
See other posts from Stack Overflow
or by Eldeus
Published on 2010-12-27T04:51:03Z
Indexed on
2010/12/27
4:53 UTC
Read the original article
Hit count: 254
Well how to evaluate a very simple antlr grammar that does only this.
Box(1,2,4) Cylinder(1,2) and builds java3d shapes,
(given I have already built a canvas for java3d and have the code for creating each element in java,
protected static BranchGroup addBox1(Float a, Float b, Float C){
// create branch for display
TransformGroup bodyTransform = new TransformGroup();
BranchGroup bg = new BranchGroup();
bg.setCapability(BranchGroup.ALLOW_DETACH);
bg.setUserData(shapeId);
// set transformation
bodyTransform = setTransformShape(0,0,0,0,0,0,0);
// create box
Box tmpBox = new Box(a,b,c, Primitive.GENERATE_NORMALS |
Primitive.GENERATE_TEXTURE_COORDS,setAppearance(color));
getCoords(tmpBox);
bodyTransform.addChild(tmpBox);
trFormList.add(bodyTransform);
shapeId++;
//add box to branch
bg.addChild(bodyTransform);
return bg;
} ) thanks
© Stack Overflow or respective owner