当前位置: 首页>>代码示例>>Java>>正文


Java AreaRenderer类代码示例

本文整理汇总了Java中ethanjones.cubes.graphics.world.AreaRenderer的典型用法代码示例。如果您正苦于以下问题:Java AreaRenderer类的具体用法?Java AreaRenderer怎么用?Java AreaRenderer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


AreaRenderer类属于ethanjones.cubes.graphics.world包,在下文中一共展示了AreaRenderer类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}
 
开发者ID:RedTroop,项目名称:Cubes_2,代码行数:24,代码来源:Area.java

示例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();
}
 
开发者ID:RedTroop,项目名称:Cubes_2,代码行数:25,代码来源:Area.java

示例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();
}
 
开发者ID:RedTroop,项目名称:Cubes,代码行数:23,代码来源:Area.java

示例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();
}
 
开发者ID:RedTroop,项目名称:Cubes,代码行数:25,代码来源:Area.java

示例5: getDebugString

import ethanjones.cubes.graphics.world.AreaRenderer; //导入依赖的package包/类
public static String getDebugString() {
  Vector3 p = Cubes.getClient().player.position;
  ms.addValue(Gdx.graphics.getRawDeltaTime() * 1000f);

  builder.setLength(brandingDebugLength);
  builder.append("FPS:").append(Gdx.graphics.getFramesPerSecond()).append(" MS:").append(twoDP.format(ms.getMean())).append(" MEM:").append(Compatibility.get().getFreeMemory()).append("MB").append(lineSeparator);
  builder.append("TPS C:").append(Cubes.getClient().ticksPerSecond.last()).append(" A:").append(oneDP.format(Cubes.getClient().ticksPerSecond.average()));
  if (Cubes.getServer() != null) builder.append(" S:").append(Cubes.getServer().ticksPerSecond.last()).append(" A:").append(oneDP.format(Cubes.getServer().ticksPerSecond.average()));
  builder.append(lineSeparator);
  builder.append("POS X:").append(twoDP.format(p.x)).append("(").append(CoordinateConverter.area(p.x)).append(")").append(" Y:").append(twoDP.format(p.y)).append("(").append(CoordinateConverter.area(p.y)).append(")").append(" Z:").append(twoDP.format(p.z)).append("(").append(CoordinateConverter.area(p.z)).append(")").append(lineSeparator);
  builder.append("DIR X:").append(twoDP.format(Cubes.getClient().player.angle.x)).append(" Y:").append(twoDP.format(Cubes.getClient().player.angle.y)).append(" Z:").append(twoDP.format(Cubes.getClient().player.angle.z)).append(lineSeparator);
  builder.append("R A:").append(AreaRenderer.renderedThisFrame).append(" M:").append(AreaRenderer.renderedMeshesThisFrame).append(" D:").append(Settings.getIntegerSetting(Settings.GRAPHICS_VIEW_DISTANCE));
  if (Settings.getBooleanSettingValue(Settings.GRAPHICS_FOG)) builder.append(" FOG");
  if (AmbientOcclusion.isEnabled()) builder.append(" AO");
  builder.append(lineSeparator);
  if (glProfiler) {
    builder.append("TC:").append(LastFrame.totalCalls).append(" DG:").append(LastFrame.drawCalls).append(" TB:").append(LastFrame.textureBindings).append(" SS:").append(LastFrame.shaderSwitches).append(" VC:").append(LastFrame.vertexCount()).append(lineSeparator);
  }
  builder.append("W B:").append(getBlockLight()).append(" S:").append(getSunlight()).append(" T:").append(Cubes.getClient().world.getTime());
  BlockIntersection blockIntersection = BlockIntersection.getBlockIntersection(Cubes.getClient().player.position, Cubes.getClient().player.angle, Cubes.getClient().world);
  if (blockIntersection != null && blockIntersection.getBlock() != null) {
    builder.append(lineSeparator).append("B ID:").append(blockIntersection.getBlock().id).append(" M:").append(blockIntersection.getBlockMeta());
  }
  return builder.toString();
}
 
开发者ID:RedTroop,项目名称:Cubes,代码行数:26,代码来源:ClientDebug.java

示例6: expandIf2

import ethanjones.cubes.graphics.world.AreaRenderer; //导入依赖的package包/类
private void expandIf2(int newHeight) {
	if (Side.isClient() || shared) {
		this.areaRenderer = new AreaRenderer[newHeight];
		if (renderStatus.length < newHeight)
			renderStatus = AreaRenderStatus.create(newHeight);
	} else {
		this.areaRenderer = null;
	}
}
 
开发者ID:RedTroop,项目名称:Cubes_2,代码行数:10,代码来源:Area.java

示例7: 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);
}
 
开发者ID:RedTroop,项目名称:Cubes_2,代码行数:40,代码来源:Area.java

示例8: 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();
}
 
开发者ID:RedTroop,项目名称:Cubes_2,代码行数:36,代码来源:Area.java

示例9: getDebugString

import ethanjones.cubes.graphics.world.AreaRenderer; //导入依赖的package包/类
public static String getDebugString() {
	Vector3 p = Cubes.getClient().player.position;
	ms.addValue(Gdx.graphics.getRawDeltaTime() * 1000f);

	builder.setLength(brandingDebugLength);
	synchronized (twoDP) {
		builder.append("FPS:").append(Gdx.graphics.getFramesPerSecond()).append(" MS:")
				.append(twoDP.format(ms.getMean())).append(" MEM:").append(Compatibility.get().getFreeMemory())
				.append("MB").append(lineSeparator);
	}
	synchronized (oneDP) {
		builder.append("TPS C:").append(Cubes.getClient().ticksPerSecond.last()).append(" A:")
				.append(oneDP.format(Cubes.getClient().ticksPerSecond.average()));
	}
	synchronized (oneDP) {
		if (Cubes.getServer() != null)
			builder.append(" S:").append(Cubes.getServer().ticksPerSecond.last()).append(" A:")
					.append(oneDP.format(Cubes.getServer().ticksPerSecond.average()));
	}
	builder.append(lineSeparator);
	synchronized (twoDP) {
		builder.append("POS X:").append(twoDP.format(p.x)).append("(").append(CoordinateConverter.area(p.x))
				.append(")").append(" Y:").append(twoDP.format(p.y)).append("(")
				.append(CoordinateConverter.area(p.y)).append(")").append(" Z:").append(twoDP.format(p.z))
				.append("(").append(CoordinateConverter.area(p.z)).append(")").append(lineSeparator);
	}
	synchronized (twoDP) {
		builder.append("DIR X:").append(twoDP.format(Cubes.getClient().player.angle.x)).append(" Y:")
				.append(twoDP.format(Cubes.getClient().player.angle.y)).append(" Z:")
				.append(twoDP.format(Cubes.getClient().player.angle.z)).append(lineSeparator);
	}
	builder.append("R A:").append(AreaRenderer.renderedThisFrame).append(" M:")
			.append(AreaRenderer.renderedMeshesThisFrame).append(" D:")
			.append(Settings.getIntegerSetting(Settings.GRAPHICS_VIEW_DISTANCE));
	if (Settings.getBooleanSettingValue(Settings.GRAPHICS_FOG))
		builder.append(" FOG");
	if (AmbientOcclusion.isEnabled())
		builder.append(" AO");
	builder.append(lineSeparator);
	if (glProfiler) {
		builder.append("TC:").append(LastFrame.totalCalls).append(" DG:").append(LastFrame.drawCalls).append(" TB:")
				.append(LastFrame.textureBindings).append(" SS:").append(LastFrame.shaderSwitches).append(" VC:")
				.append(LastFrame.vertexCount()).append(lineSeparator);
	}
	builder.append("W B:").append(getBlockLight()).append(" S:").append(getSunlight()).append(" T:")
			.append(Cubes.getClient().world.getTime());
	BlockIntersection blockIntersection = BlockIntersection.getBlockIntersection(Cubes.getClient().player.position,
			Cubes.getClient().player.angle, Cubes.getClient().world);
	if (blockIntersection != null && blockIntersection.getBlock() != null) {
		builder.append(lineSeparator).append("B ID:").append(blockIntersection.getBlock().id).append(" M:")
				.append(blockIntersection.getBlockMeta());
	}
	return builder.toString();
}
 
开发者ID:RedTroop,项目名称:Cubes_2,代码行数:55,代码来源:ClientDebug.java

示例10: 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);
}
 
开发者ID:RedTroop,项目名称:Cubes,代码行数:51,代码来源:Area.java

示例11: 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();
}
 
开发者ID:RedTroop,项目名称:Cubes,代码行数:50,代码来源:Area.java


注:本文中的ethanjones.cubes.graphics.world.AreaRenderer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。