本文整理汇总了Java中org.joml.Vector2f.set方法的典型用法代码示例。如果您正苦于以下问题:Java Vector2f.set方法的具体用法?Java Vector2f.set怎么用?Java Vector2f.set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.joml.Vector2f
的用法示例。
在下文中一共展示了Vector2f.set方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getNormalizedAnchorOffset
import org.joml.Vector2f; //导入方法依赖的package包/类
public static Vector2f getNormalizedAnchorOffset(Direction anchor, Vector2f dst)
{
switch (anchor)
{
case EAST:
return dst.set(1, 0.5F);
case NORTHEAST:
return dst.set(1, 0);
case NORTH:
return dst.set(0.5F, 0);
case NORTHWEST:
return dst.set(0, 0);
case WEST:
return dst.set(0, 0.5F);
case SOUTHWEST:
return dst.set(0, 1);
case SOUTH:
return dst.set(0.5F, 1);
case SOUTHEAST:
return dst.set(1, 1);
case CENTER:
return dst.set(0.5F, 0.5F);
}
return dst.set(0, 0);
}
示例2: getPoint2DFromScreen
import org.joml.Vector2f; //导入方法依赖的package包/类
public Vector2f getPoint2DFromScreen(float screenX, float screenY, Vector2f dst)
{
Matrix4fc invertedViewProjection = this.getInvertedViewProjectionMatrix(MAT4);
Vector2fc screen = this.getScreenOffset(screenX, screenY, VEC2);
Vector3f near = unproject(invertedViewProjection, this.viewport, screen.x(), screen.y(), 0, VEC3A);
Vector3f far = unproject(invertedViewProjection, this.viewport, screen.x(), screen.y(), 1, VEC3B);
float f = (0 - near.z) / (far.z - near.z);
screenX = (near.x + f * (far.x - near.x));
screenY = (near.y + f * (far.y - near.y));
return dst.set(screenX, screenY);
}
示例3: getUV
import org.joml.Vector2f; //导入方法依赖的package包/类
@Override
public Vector2f getUV(Vector2f dst)
{
SubTexture subtexture = this.atlas.get().getSubTexture(this.atlasIndex);
dst.set(subtexture.getU(), subtexture.getV());
return dst;
}
示例4: getSize
import org.joml.Vector2f; //导入方法依赖的package包/类
@Override
public Vector2f getSize(Vector2f dst)
{
SubTexture subtexture = this.atlas.get().getSubTexture(this.atlasIndex);
dst.set(subtexture.getWidth(), subtexture.getHeight());
return dst;
}
示例5: getRow
import org.joml.Vector2f; //导入方法依赖的package包/类
@Override
public Vector2f getRow(int row, Vector2f dest) throws IndexOutOfBoundsException
{
switch(row)
{
case 0:
return dest.set(m00, m01);
case 1:
return dest.set(m10, m11);
default:
throw new IndexOutOfBoundsException();
}
}
示例6: getColumn
import org.joml.Vector2f; //导入方法依赖的package包/类
@Override
public Vector2f getColumn(int column, Vector2f dest) throws IndexOutOfBoundsException
{
switch (column)
{
case 0:
return dest.set(m00, m10);
case 1:
return dest.set(m01, m11);
default:
throw new IndexOutOfBoundsException();
}
}
示例7: polarf
import org.joml.Vector2f; //导入方法依赖的package包/类
/**Gets the polar {@link Vector2f} representation of direction*/
public Vector2f polarf(Vector2f dst)
{
double dist = 1D;
double rad = this.radians();
return dst.set((float)(dist * Math.cos(rad)), (float)(dist * Math.sin(rad)));
}
示例8: cross
import org.joml.Vector2f; //导入方法依赖的package包/类
public static Vector2f cross(Vector2fc a, float b, Vector2f dst)
{
return dst.set(a.y() * b, a.x() * -b);
}
示例9: getUp
import org.joml.Vector2f; //导入方法依赖的package包/类
@Override
default Vector2f getUp(Vector2f dst)
{
float rad = this.radians();
return dst.set((float) Math.cos(rad), (float) Math.sin(rad));
}
示例10: getRight
import org.joml.Vector2f; //导入方法依赖的package包/类
@Override
default Vector2f getRight(Vector2f dst)
{
float rad = this.radians() + HALF_PI;
return dst.set((float) Math.cos(rad), (float) Math.sin(rad));
}
示例11: getScreenOffset
import org.joml.Vector2f; //导入方法依赖的package包/类
protected Vector2f getScreenOffset(float screenX, float screenY, Vector2f dst)
{
final float w = this.viewport.getWidth();
final float h = this.viewport.getHeight();
final float w2 = w / 2F;
final float h2 = h / 2F;
switch (this.centerPoint)
{
case EAST:
screenX += -w2;
screenY += 0;
break;
case NORTHEAST:
screenX += -w2;
screenY += h2;
break;
case NORTH:
screenX += 0;
screenY += h2;
break;
case NORTHWEST:
screenX += w2;
screenY += h2;
break;
case WEST:
screenX += w2;
screenY += 0;
break;
case SOUTHWEST:
screenX += w2;
screenY += -h2;
break;
case SOUTH:
screenX += 0;
screenY += -h2;
break;
case SOUTHEAST:
screenX += -w2;
screenY += -h2;
break;
case CENTER:
default:
break;
}
if (!this.leftToRight) screenX = w - screenX;
if (!this.topToBottom) screenY = h - screenY;
return dst.set(screenX, screenY);
}
示例12: getUV
import org.joml.Vector2f; //导入方法依赖的package包/类
@Override
public Vector2f getUV(Vector2f dst)
{
return dst.set(0, 0);
}
示例13: getWorldPos
import org.joml.Vector2f; //导入方法依赖的package包/类
public static Vector2f getWorldPos(ViewPort view, double x, double y, Vector2f dst)
{
return dst.set((float) ((x - view.x) / view.unitScale),
(float) ((y - view.y) / view.unitScale));
}
示例14: transform
import org.joml.Vector2f; //导入方法依赖的package包/类
@Override
public Vector2f transform(Vector2f v)
{
return v.set(m00 * v.x + m01 * v.y, m10 * v.x + m11 * v.y);
}
示例15: getChunkPos
import org.joml.Vector2f; //导入方法依赖的package包/类
public final Vector2f getChunkPos(Vector2f dst)
{
return dst.set(this.chunkX * this.chunkSize,
this.chunkY * this.chunkSize);
}