本文整理汇总了Java中org.joml.Vector2i.set方法的典型用法代码示例。如果您正苦于以下问题:Java Vector2i.set方法的具体用法?Java Vector2i.set怎么用?Java Vector2i.set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.joml.Vector2i
的用法示例。
在下文中一共展示了Vector2i.set方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: polari
import org.joml.Vector2i; //导入方法依赖的package包/类
/**Gets the polar {@link Vector2i} representation of direction in only integers*/
public Vector2i polari(Vector2i dst)
{
switch(this)
{
case EAST: return dst.set(1, 0);
case NORTHEAST: return dst.set(1, 1);
case NORTH: return dst.set(0, 1);
case NORTHWEST: return dst.set(-1, 1);
case WEST: return dst.set(-1, 0);
case SOUTHWEST: return dst.set(-1, -1);
case SOUTH: return dst.set(0, -1);
case SOUTHEAST: return dst.set(1, -1);
default: return dst.set(0, 0);
}
}
示例2: find
import org.joml.Vector2i; //导入方法依赖的package包/类
public Vector2ic find(int x, int y, int w, int h, BiFunction<Vector2ic, T, Boolean> test)
{
Vector2i key = new Vector2i();
for(int i = 0; i < w; ++i)
{
for(int j = 0; j < h; ++j)
{
key.set(x + i, y + j);
Boolean flag = test.apply(key, this.get(key));
if (flag != null && flag)
{
return key;
}
}
}
return null;
}
示例3: forEach
import org.joml.Vector2i; //导入方法依赖的package包/类
public void forEach(int x, int y, int w, int h, BiConsumer<Vector2ic, T> action)
{
Vector2i key = new Vector2i();
for(int i = 0; i < w; ++i)
{
for(int j = 0; j < h; ++j)
{
key.set(x + i, y + j);
action.accept(key, this.get(key));
}
}
}
示例4: toString
import org.joml.Vector2i; //导入方法依赖的package包/类
@Override
public String toString()
{
final StringBuilder sb = new StringBuilder();
sb.append('[');
final Vector2i key = new Vector2i();
for(int y = 0; y < this.height; ++y)
{
if (y > 0) sb.append('\n');
for(int x = 0; x < this.width; ++x)
{
key.set(x, y);
sb.append(this.get(key));
if (!(x == this.width - 1 && y == this.height - 1))
{
sb.append(',');
sb.append(' ');
}
}
}
sb.append(']');
return sb.toString();
}
示例5: getTileCoord
import org.joml.Vector2i; //导入方法依赖的package包/类
public static Vector2i getTileCoord(float posX, float posY, Vector2i dst)
{
float x = posX % DungeonChunk.CHUNK_SIZE;
float y = posY % DungeonChunk.CHUNK_SIZE;
if (x < 0) x += DungeonChunk.CHUNK_SIZE;
if (y < 0) y += DungeonChunk.CHUNK_SIZE;
return dst.set((int) Math.floor(x), (int) Math.floor(y));
}
示例6: getChunkCoord
import org.joml.Vector2i; //导入方法依赖的package包/类
public static Vector2i getChunkCoord(float posX, float posY, Vector2i dst)
{
float x = posX / DungeonChunk.CHUNK_SIZE;
float y = posY / DungeonChunk.CHUNK_SIZE;
return dst.set((int) Math.floor(x), (int) Math.floor(y));
}
示例7: forEach
import org.joml.Vector2i; //导入方法依赖的package包/类
public void forEach(TriConsumer<Vector2ic, Character, Integer> action)
{
Vector2i vec = new Vector2i();
for(int i = 0; i < this.width; ++i)
{
for(int j = 0; j < this.height; ++j)
{
vec.set(i, j);
char c = (char) this.glyphs.get(i, j);
int k = this.colors.get(i, j);
action.accept(vec, c, k);
}
}
}
示例8: getChunkCoord
import org.joml.Vector2i; //导入方法依赖的package包/类
public final Vector2i getChunkCoord(Vector2i dst)
{
return dst.set(this.chunkX, this.chunkY);
}