Package javax.vecmath

Examples of javax.vecmath.Vector2f


    /**
     * @return The equivalent Vector2f
     */
    public Vector2f toVector2f() {
        return new Vector2f(x, y);
    }
View Full Code Here


    }

    @Override
    public Rect2f deserialize(PersistedData data, DeserializationContext context) {
        PersistedDataMap map = data.getAsValueMap();
        Vector2f min = context.deserializeAs(map.get(MIN_FIELD), Vector2f.class);
        Vector2f size = context.deserializeAs(map.get(SIZE_FIELD), Vector2f.class);
        return Rect2f.createFromMinAndSize(min, size);
    }
View Full Code Here

    public Vector2f deserialize(PersistedData data, DeserializationContext context) {
        if (data.isArray()) {
            PersistedDataArray dataArray = data.getAsArray();
            if (dataArray.isNumberArray() && dataArray.size() > 1) {
                TFloatList floats = dataArray.getAsFloatArray();
                return new Vector2f(floats.get(0), floats.get(1));
            }
        }
        return null;
    }
View Full Code Here

    @Override
    public Vector2f decode(EntityBitStream stream, Prop prop) {
        FloatDecoder fd = (FloatDecoder) PropType.FLOAT.getDecoder();
        float x = fd.decode(stream, prop);
        float y = fd.decode(stream, prop);
        return new Vector2f(x, y);
    }
View Full Code Here

      }
      else{
        if(!buffTableEntry.getVStart().hasX() || !buffTableEntry.getVStart().hasY())
          System.out.println("Buff field vector is missing components?");
       
        Vector2f vec = new Vector2f();
        vec.x = buffTableEntry.getVStart().getX();
        vec.y = buffTableEntry.getVStart().getY();
        data.put(fields.get("v_start"), vec);     
      }
    }
   
    if(buffTableEntry.hasVEnd()){
      if(buffTableEntry.getVStart().hasZ()){
        Vector3f vec = new Vector3f();
        vec.x = buffTableEntry.getVStart().getX();
        vec.y = buffTableEntry.getVStart().getY();
        vec.z = buffTableEntry.getVStart().getZ();
        data.put(fields.get("v_end"), vec);
      }
      else{
        if(!buffTableEntry.getVStart().hasX() || !buffTableEntry.getVStart().hasY())
          System.out.println("Buff field vector is missing components?");
       
        Vector2f vec = new Vector2f();
        vec.x = buffTableEntry.getVStart().getX();
        vec.y = buffTableEntry.getVStart().getY();
        data.put(fields.get("v_end"), vec);     
      }
View Full Code Here

    private SubSampledNoise2D humidityNoise;

    @Override
    public void setSeed(long seed) {
        humidityNoise = new SubSampledNoise2D(new Noise3DTo2DAdapter(new BrownianNoise3D(new PerlinNoise(seed + 6), 8)), new Vector2f(0.0005f, 0.0005f), SAMPLE_RATE);
    }
View Full Code Here

        this(null);
    }

    public RenderableNode(BehaviorNodeComponent data) {
        this.data = data;
        position = new Vector2f();
        size = new Vector2f(10, 5);
        portList = new PortList(this);
        withoutModel = new ChainedTreeAccessor<>(this, portList);
        withModel = new ChainedTreeAccessor<>(this, portList, new NodeTreeAccessor());
    }
View Full Code Here

    public void setPosition(Vector2f position) {
        this.position = position;
    }

    public void setPosition(float x, float y) {
        position = new Vector2f(x, y);
    }
View Full Code Here

    public void setPosition(float x, float y) {
        position = new Vector2f(x, y);
    }

    public void move(Vector2f diff) {
        position = new Vector2f(position);
        position.add(diff);
        for (RenderableNode child : children) {
            child.move(diff);
        }
    }
View Full Code Here

        for (PositionalWidget widget : widgets) {
            if (!widget.isVisible()) {
                continue;
            }
            Vector2i screenStart = worldToScreen(widget.getPosition());
            Vector2f worldEnd = new Vector2f(widget.getPosition());
            worldEnd.add(widget.getSize());
            Vector2i screenEnd = worldToScreen(worldEnd);
            canvas.drawWidget(widget, Rect2i.createFromMinAndMax(screenStart, screenEnd));
        }
    }
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.