Package javax.vecmath

Examples of javax.vecmath.Vector2f


    final Shape rectangle = ShapeFactory.createRectangle(75, 25);

    final Shape bscircle = ShapeFactory.createCircle(30, 25);

    List<Vector2f> rectOut = new ArrayList<Vector2f>();
    rectOut.add(new Vector2f(40, 10));
    rectOut.add(new Vector2f(-40, 10));
    rectOut.add(new Vector2f(-40, -10));
    rectOut.add(new Vector2f(40, -10));
    List<Vector2f> rectIn = new ArrayList<Vector2f>();
    rectIn.add(new Vector2f(20, 5));
    rectIn.add(new Vector2f(-20, 5));
    rectIn.add(new Vector2f(-20, -5));
    rectIn.add(new Vector2f(20, -5));
    List<List<Vector2f>> rectIns = new ArrayList<List<Vector2f>>();
    rectIns.add(rectIn);
    final Shape emptyRectangle = ShapeCreator.create(rectOut, rectIns);
   
    List<Vector2f> special1Outline = ShapeOutlineFactory.createRoundedRectangle(50, 40, 10, 3);
View Full Code Here


//    final Shape ellipse = ShapeFactory.createEllipse(75, 25, 25);
    final Shape ellipse = ShapeFactory.createRoundedRectangle(120, 70, 25);
    final Shape ellipsoidalArc = ShapeFactory.createEllipsoidalArc(75, 25, 45, 315, 25);
//    final Shape rectangle = ShapeFactory.createRectangle(75, 25, false, false);
    List<Vector2f> rectOut = new ArrayList<Vector2f>();
    rectOut.add(new Vector2f(40, 10));
    rectOut.add(new Vector2f(-40, 10));
    rectOut.add(new Vector2f(-40, -10));
    rectOut.add(new Vector2f(40, -10));
    List<Vector2f> rectIn = new ArrayList<Vector2f>();
    rectIn.add(new Vector2f(20, 5));
    rectIn.add(new Vector2f(-20, 5));
    rectIn.add(new Vector2f(-20, -5));
    rectIn.add(new Vector2f(20, -5));
    List<List<Vector2f>> rectIns = new ArrayList<List<Vector2f>>();
    rectIns.add(rectIn);
    final Shape rectangle = ShapeCreator.create(rectOut, rectIns);
   
    final Image dark = canvas.getImageFactory().createImage(128, 128, true);
    final Image darktest = canvas.getImageFactory().createImage(128, 128, true);
//    final Image dark = canvas.getImageFactory().createBufferedImage(128, 128, BufferTypes.RGBA_4Byte);
    final Image gradient = canvas.getImageFactory().createBufferedImage(256, 256, BufferTypes.RGBA_4Byte);
    final Image light = canvas.getImageFactory().createBufferedImage(128, 128, BufferTypes.RGBA_4Byte);
   
    ResourceManager rm = canvas.getResourceManager();
    rm.cacheImage(dark);
    rm.cacheImage(campfire);
    rm.cacheImage(animLeftImage);
    rm.cacheImage(animFrontImage);
    rm.cacheImage(animBackImage);
    rm.cacheImage(leftImage);
    rm.cacheImage(frontImage);
    rm.cacheImage(backImage);
    rm.cacheImage(grass)
    final Animation<Frame> animLeft = new AnimationImpl<Frame>();
    animLeft.addFrame(new FrameImpl(animLeftImage, 160000000, 0, 0, 44, 68));
    animLeft.addFrame(new FrameImpl(animLeftImage, 160000000, 45, 0, 44, 68));
    animLeft.addFrame(new FrameImpl(animLeftImage, 160000000, 90, 0, 44, 68));
    animLeft.addFrame(new FrameImpl(animLeftImage, 160000000,135, 0, 44, 68));
    animLeft.addFrame(new FrameImpl(animLeftImage, 160000000,180, 0, 44, 68));
    animLeft.addFrame(new FrameImpl(animLeftImage, 160000000,225, 0, 44, 68));
    animLeft.setRepeated(true);

    final Animation<Frame> animFront = new AnimationImpl<Frame>();
    animFront.addFrame(new FrameImpl(animFrontImage, 160000000, 0, 0, 40, 70));
    animFront.addFrame(new FrameImpl(animFrontImage, 160000000, 41, 0, 40, 70));
    animFront.addFrame(new FrameImpl(animFrontImage, 160000000, 82, 0, 40, 70));
    animFront.addFrame(new FrameImpl(animFrontImage, 160000000,123, 0, 40, 70));
    animFront.addFrame(new FrameImpl(animFrontImage, 160000000,164, 0, 40, 70));
    animFront.addFrame(new FrameImpl(animFrontImage, 160000000,205, 0, 40, 70));
    animFront.setRepeated(true);


    final Animation<Frame> animLeftStill = new AnimationImpl<Frame>();
    animLeftStill.addFrame(new FrameImpl(leftImage, 160000000, 0, 0, 28, 68));
    animLeftStill.setRepeated(true);
   
    final Animation<Frame> animFrontStill = new AnimationImpl<Frame>();
    animFrontStill.addFrame(new FrameImpl(frontImage, 160000000, 0, 0, 32, 70));
    animFrontStill.setRepeated(true);
   
    final Animation<Frame> animBackStill = new AnimationImpl<Frame>();
    animBackStill.addFrame(new FrameImpl(backImage, 160000000, 0, 0, 32, 66));
    animBackStill.setRepeated(true);

    final Animation<Frame> animBack = new AnimationImpl<Frame>();
    animBack.addFrame(new FrameImpl(animBackImage, 160000000, 0, 0, 36, 70));
    animBack.addFrame(new FrameImpl(animBackImage, 160000000, 37, 0, 36, 70));
    animBack.addFrame(new FrameImpl(animBackImage, 160000000, 74, 0, 36, 70));
    animBack.addFrame(new FrameImpl(animBackImage, 160000000,111, 0, 36, 70));
    animBack.addFrame(new FrameImpl(animBackImage, 160000000,148, 0, 36, 70));
    animBack.addFrame(new FrameImpl(animBackImage, 160000000,185, 0, 36, 70));
    animBack.setRepeated(true);

    final Animation<Frame> animFire = new AnimationImpl<Frame>();
    animFire.addFrame(new FrameImpl(campfire, 120000000,1, 1, 64, 80));
    animFire.addFrame(new FrameImpl(campfire, 120000000, 66, 1, 64, 80));
    animFire.addFrame(new FrameImpl(campfire, 120000000, 131, 1, 64, 80));
    animFire.addFrame(new FrameImpl(campfire, 120000000,196, 1, 64, 80));
    animFire.setRepeated(true);

//    final Color4f red = new Color4f(1,0,0,1);
    final Color4f white = new Color4f(1,1,1,1);
       
    ColorGradientFactory gradientFactory = new ColorGradientFactory();
    gradientFactory.addSourceSegment(50, 0, 50, 255, 150, new Color4f(1, 0, 0, 1));
    gradientFactory.addSourceSegment(205, 0, 205, 255,150, new Color4f(0, 0, 1, 1));
//    gradientFactory.addSourceSegment(0, 0, 0, 255, 256, new Color4f(0, 0, 0, 1));
//    gradientFactory.addSourceSegment(255, 0, 255, 255, 256, new Color4f(1, 1, 1, 1));
    gradientFactory.drawGradient(gradient);
//    gradient.setDirty();

    gradientFactory.clearSources();
    gradientFactory.addSourcePoint(light.getWidth() / 2, light.getHeight() / 2, light.getWidth() / 2f * .9f, new Color4f(0,0,0,0));
    gradientFactory.setBaseColor(new Color4f(1,1,1,1));
    gradientFactory.drawGradient(light);
//    gradientFactory.addSourceSegment(0, 0, 255, 255, new Color4f(1, 1, 1, 1));

//    rm.cacheImage(gradient);
//    rm.cacheImage(light);

    final Line[] line1 = new Line[2];
    line1[0] = new ch.blackspirit.graphics.shape.Line(new Vector2f(100, 500), new Vector2f(200, 500));
    line1[1] = new ch.blackspirit.graphics.shape.Line(new Vector2f(200, 500), new Vector2f(300, 520));

    final Line[] line2 = new Line[2];
    line2[0] = new ch.blackspirit.graphics.shape.Line(new Vector2f(100, 550), new Vector2f(200, 550));
    line2[1] = new ch.blackspirit.graphics.shape.Line(new Vector2f(200, 550), new Vector2f(300, 570));
    line2[0].setColor(0, new Color4f(1,1,1,1));
    line2[0].setColor(1, new Color4f(0,1,0,1));
    line2[1].setColor(0, new Color4f(0,1,0,1));
    line2[1].setColor(1, new Color4f(1,0,0,1));
 
View Full Code Here

TOP

Related Classes of javax.vecmath.Vector2f

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.