本文整理汇总了Java中ethanjones.cubes.graphics.world.AreaRenderer.free方法的典型用法代码示例。如果您正苦于以下问题:Java AreaRenderer.free方法的具体用法?Java AreaRenderer.free怎么用?Java AreaRenderer.free使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ethanjones.cubes.graphics.world.AreaRenderer
的用法示例。
在下文中一共展示了AreaRenderer.free方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: removeArrays
import ethanjones.cubes.graphics.world.AreaRenderer; //导入方法依赖的package包/类
private void removeArrays() {
lock.writeLock();
if (unloaded) {
lock.writeUnlock();
throw new CubesException("Area has been unloaded");
}
blocks = null;
light = null;
blockDataList.clear();
AreaRenderer.free(areaRenderer);
areaRenderer = null;
if (renderStatus.length > 0)
renderStatus = new int[0];
maxY = 0;
height = 0;
Arrays.fill(heightmap, 0);
Arrays.fill(neighboursClient, null);
Arrays.fill(neighboursServer, null);
unloaded = true;
lock.writeUnlock();
}
示例2: setupArrays
import ethanjones.cubes.graphics.world.AreaRenderer; //导入方法依赖的package包/类
public void setupArrays(int y) {
lock.writeLock();
if (unloaded) {
lock.writeUnlock();
throw new CubesException("Area has been unloaded");
}
if (isBlank()) {
int h = (int) Math.ceil((y + 1) / (float) SIZE_BLOCKS);
blocks = new int[SIZE_BLOCKS_CUBED * h];
light = new byte[SIZE_BLOCKS_CUBED * h];
AreaRenderer.free(areaRenderer);
if (Side.isClient() || isShared()) {
areaRenderer = new AreaRenderer[h];
renderStatus = AreaRenderStatus.create(h);
}
height = h;
maxY = (h * SIZE_BLOCKS) - 1;
} else if (y > maxY) {
expand(y);
}
lock.writeUnlock();
}
示例3: removeArrays
import ethanjones.cubes.graphics.world.AreaRenderer; //导入方法依赖的package包/类
private void removeArrays() {
lock.writeLock();
if (unloaded) {
lock.writeUnlock();
throw new CubesException("Area has been unloaded");
}
blocks = null;
light = null;
blockDataList.clear();
AreaRenderer.free(areaRenderer);
areaRenderer = null;
if (renderStatus.length > 0) renderStatus = new int[0];
maxY = 0;
height = 0;
Arrays.fill(heightmap, 0);
Arrays.fill(neighboursClient, null);
Arrays.fill(neighboursServer, null);
unloaded = true;
lock.writeUnlock();
}
示例4: setupArrays
import ethanjones.cubes.graphics.world.AreaRenderer; //导入方法依赖的package包/类
public void setupArrays(int y) {
lock.writeLock();
if (unloaded) {
lock.writeUnlock();
throw new CubesException("Area has been unloaded");
}
if (isBlank()) {
int h = (int) Math.ceil((y + 1) / (float) SIZE_BLOCKS);
blocks = new int[SIZE_BLOCKS_CUBED * h];
light = new byte[SIZE_BLOCKS_CUBED * h];
AreaRenderer.free(areaRenderer);
if (Side.isClient() || isShared()) {
areaRenderer = new AreaRenderer[h];
renderStatus = AreaRenderStatus.create(h);
}
height = h;
maxY = (h * SIZE_BLOCKS) - 1;
} else if (y > maxY) {
expand(y);
}
lock.writeUnlock();
}
示例5: expand
import ethanjones.cubes.graphics.world.AreaRenderer; //导入方法依赖的package包/类
private void expand(int h) {
lock.writeLock();
expandIf1(h);
int oldMaxY = maxY;
int[] oldBlocks = blocks;
byte[] oldLight = light;
AreaRenderer[] oldAreaRenderer = areaRenderer;
// Round up to multiple of SIZE_BLOCKS
int newHeight = (int) Math.ceil((h + 1) / (float) SIZE_BLOCKS);
int[] newBlocks = new int[SIZE_BLOCKS_CUBED * newHeight];
System.arraycopy(oldBlocks, 0, newBlocks, 0, oldBlocks.length);
byte[] newLight = new byte[SIZE_BLOCKS_CUBED * newHeight];
System.arraycopy(oldLight, 0, newLight, 0, oldLight.length);
if (featuresGenerated())
Arrays.fill(newLight, oldLight.length, newLight.length, (byte) SunLight.MAX_SUNLIGHT);
expandIf2(newHeight);
this.blocks = newBlocks;
this.light = newLight;
this.height = newHeight;
this.maxY = (newHeight * SIZE_BLOCKS) - 1;
int i = oldMaxY * SIZE_BLOCKS_SQUARED;
for (int z = 0; z < SIZE_BLOCKS; z++) { // update previous top
for (int x = 0; x < SIZE_BLOCKS; x++, i++) {
updateSurrounding(x, oldMaxY, z, i);
}
}
lock.writeUnlock();
AreaRenderer.free(oldAreaRenderer);
}
示例6: shrink
import ethanjones.cubes.graphics.world.AreaRenderer; //导入方法依赖的package包/类
public void shrink() {
lock.writeLock();
shrinkIf1();
int usedHeight = usedHeight();
shrinkIf2(usedHeight);
int[] oldBlocks = blocks;
blocks = new int[SIZE_BLOCKS_CUBED * usedHeight];
System.arraycopy(oldBlocks, 0, blocks, 0, blocks.length);
byte[] oldLight = light;
light = new byte[SIZE_BLOCKS_CUBED * usedHeight];
System.arraycopy(oldLight, 0, light, 0, light.length);
AreaRenderer.free(areaRenderer);
if (Side.isClient() || isShared()) {
areaRenderer = new AreaRenderer[usedHeight];
renderStatus = AreaRenderStatus.create(usedHeight);
} else {
areaRenderer = null;
}
maxY = (usedHeight * SIZE_BLOCKS) - 1;
int i = maxY * SIZE_BLOCKS_SQUARED;
for (int z = 0; z < SIZE_BLOCKS; z++) {
for (int x = 0; x < SIZE_BLOCKS; x++, i++) {
updateSurrounding(x, maxY, z, i); // update new top
}
}
lock.writeUnlock();
}
示例7: expand
import ethanjones.cubes.graphics.world.AreaRenderer; //导入方法依赖的package包/类
private void expand(int h) {
lock.writeLock();
if (unloaded) {
lock.writeUnlock();
throw new CubesException("Area has been unloaded");
}
if (isBlank() || h <= maxY || h > MAX_Y) {
lock.writeUnlock();
return;
}
int oldMaxY = maxY;
int[] oldBlocks = blocks;
byte[] oldLight = light;
AreaRenderer[] oldAreaRenderer = areaRenderer;
int newHeight = (int) Math.ceil((h + 1) / (float) SIZE_BLOCKS); //Round up to multiple of SIZE_BLOCKS
int[] newBlocks = new int[SIZE_BLOCKS_CUBED * newHeight];
System.arraycopy(oldBlocks, 0, newBlocks, 0, oldBlocks.length);
byte[] newLight = new byte[SIZE_BLOCKS_CUBED * newHeight];
System.arraycopy(oldLight, 0, newLight, 0, oldLight.length);
if (featuresGenerated()) Arrays.fill(newLight, oldLight.length, newLight.length, (byte) SunLight.MAX_SUNLIGHT);
if (Side.isClient() || shared) {
this.areaRenderer = new AreaRenderer[newHeight];
if (renderStatus.length < newHeight) renderStatus = AreaRenderStatus.create(newHeight);
} else {
this.areaRenderer = null;
}
this.blocks = newBlocks;
this.light = newLight;
this.height = newHeight;
this.maxY = (newHeight * SIZE_BLOCKS) - 1;
int i = oldMaxY * SIZE_BLOCKS_SQUARED;
for (int z = 0; z < SIZE_BLOCKS; z++) { //update previous top
for (int x = 0; x < SIZE_BLOCKS; x++, i++) {
updateSurrounding(x, oldMaxY, z, i);
}
}
lock.writeUnlock();
AreaRenderer.free(oldAreaRenderer);
}
示例8: shrink
import ethanjones.cubes.graphics.world.AreaRenderer; //导入方法依赖的package包/类
public void shrink() {
lock.writeLock();
if (unloaded) {
lock.writeUnlock();
throw new CubesException("Area has been unloaded");
}
if (isBlank()) {
lock.writeUnlock();
return;
}
int usedHeight = usedHeight();
if (usedHeight == height) {
lock.writeUnlock();
return;
}
if (usedHeight == 0) {
removeArrays();
lock.writeUnlock();
return;
}
int[] oldBlocks = blocks;
blocks = new int[SIZE_BLOCKS_CUBED * usedHeight];
System.arraycopy(oldBlocks, 0, blocks, 0, blocks.length);
byte[] oldLight = light;
light = new byte[SIZE_BLOCKS_CUBED * usedHeight];
System.arraycopy(oldLight, 0, light, 0, light.length);
AreaRenderer.free(areaRenderer);
if (Side.isClient() || isShared()) {
areaRenderer = new AreaRenderer[usedHeight];
renderStatus = AreaRenderStatus.create(usedHeight);
} else {
areaRenderer = null;
}
maxY = (usedHeight * SIZE_BLOCKS) - 1;
int i = maxY * SIZE_BLOCKS_SQUARED;
for (int z = 0; z < SIZE_BLOCKS; z++) {
for (int x = 0; x < SIZE_BLOCKS; x++, i++) {
updateSurrounding(x, maxY, z, i); //update new top
}
}
lock.writeUnlock();
}