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


Java VertexAttribute类代码示例

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


VertexAttribute类属于com.badlogic.gdx.graphics包,在下文中一共展示了VertexAttribute类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: unbind

import com.badlogic.gdx.graphics.VertexAttribute; //导入依赖的package包/类
public void unbind()
{
  GL11 localGL11 = Gdx.gl11;
  int i = this.attributes.size();
  int j = 0;
  int k = 0;
  if (j < i)
  {
    VertexAttribute localVertexAttribute = this.attributes.get(j);
    switch (localVertexAttribute.usage)
    {
    case 4:
    default:
      throw new GdxRuntimeException("unkown vertex attribute type: " + localVertexAttribute.usage);
    case 1:
    case 5:
      localGL11.glDisableClientState(32886);
    case 0:
    case 2:
    case 3:
    }
    while (true)
    {
      j++;
      break;
      localGL11.glDisableClientState(32885);
      continue;
      localGL11.glClientActiveTexture(33984 + k);
      localGL11.glDisableClientState(32888);
      k++;
    }
  }
  localGL11.glBindBuffer(34962, 0);
  this.isBound = false;
}
 
开发者ID:isnuryusuf,项目名称:ingress-indonesia-dev,代码行数:36,代码来源:VertexBufferObjectSubData.java

示例2: create

import com.badlogic.gdx.graphics.VertexAttribute; //导入依赖的package包/类
@Override
public void create() {
	
        rotationSpeed = 0.5f;
        mesh = new Mesh(true, 4, 6,
                        new VertexAttribute(VertexAttributes.Usage.Position, 3,"attr_Position"),
                        new VertexAttribute(Usage.TextureCoordinates, 2, "attr_texCoords"));
        texture = new Texture(Gdx.files.internal("data/Jellyfish.jpg"));
        mesh.setVertices(new float[] { 
                         -1024f, -1024f, 0, 0, 1,
                          1024f, -1024f, 0, 1, 1,
                          1024f,  1024f, 0, 1, 0,
                         -1024f,  1024f, 0, 0, 0
        });
        mesh.setIndices(new short[] { 0, 1, 2, 2, 3, 0 });

        cam = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());            
        xScale = Gdx.graphics.getWidth()/(float)TARGET_WIDTH;
        yScale = Gdx.graphics.getHeight()/(float)TARGET_HEIGHT;
        font = loadBitmapFont("default.fnt", "default.png");
        scale = Math.min(xScale, yScale);
        cam.zoom = 1/scale;
      //  cam.project(start_position);
        cam.position.set(0, 0, 0);
        batch = new SpriteBatch();
}
 
开发者ID:game-libgdx-unity,项目名称:GDX-Engine,代码行数:27,代码来源:TestCamera.java

示例3: ShaderEffect

import com.badlogic.gdx.graphics.VertexAttribute; //导入依赖的package包/类
/**
 * Instantiates a new ShaderEffect. The ShaderEffect will NOT own shader
 * program, so it will not dispose it either!
 * 
 * @param program
 *            the ShaderProgram to use for this effect
 */
public ShaderEffect(ShaderProgram program) {
	this.program = program;

	if (meshRefCount++ <= 0) {
		mesh = new Mesh(VertexDataType.VertexArray, true, 4, 0,
				new VertexAttribute(Usage.Position, 2, ShaderProgram.POSITION_ATTRIBUTE),
				new VertexAttribute(Usage.TextureCoordinates, 2, ShaderProgram.TEXCOORD_ATTRIBUTE + "0"));

		// @formatter:off
		float[] verts = {
				// vertex    texture
				  -1, -1,    0f, 0f,
				   1, -1,    1f, 0f,
				   1,  1,    1f, 1f,
				  -1,  1,    0f, 1f,
		};
		// @formatter:on

		mesh.setVertices(verts);
	}
}
 
开发者ID:spookygames,项目名称:gdx-gfx,代码行数:29,代码来源:ShaderEffect.java

示例4: createPrefix

import com.badlogic.gdx.graphics.VertexAttribute; //导入依赖的package包/类
private String createPrefix(Renderable renderable) {
    String prefix = "";

    if (params.useBones) {
        prefix += "#define numBones " + 12 + "\n";
        final int n = renderable.meshPart.mesh.getVertexAttributes().size();

        for (int i = 0; i < n; i++) {
            final VertexAttribute attr = renderable.meshPart.mesh.getVertexAttributes().get(i);

            if (attr.usage == VertexAttributes.Usage.BoneWeight) {
                prefix += "#define boneWeight" + attr.unit + "Flag\n";
            }
        }
    }

    return prefix;
}
 
开发者ID:MovementSpeed,项目名称:nhglib,代码行数:19,代码来源:DepthMapShader.java

示例5: getAttributeLocations

import com.badlogic.gdx.graphics.VertexAttribute; //导入依赖的package包/类
protected final int[] getAttributeLocations(Renderable renderable) {
    final IntIntMap attributes = new IntIntMap();
    final VertexAttributes attrs = renderable.meshPart.mesh.getVertexAttributes();
    final int c = attrs.size();
    for (int i = 0; i < c; i++) {
        final VertexAttribute attr = attrs.get(i);
        final int location = program.getAttributeLocation(attr.alias);
        if (location >= 0)
            attributes.put(attr.getKey(), location);
    }

    tempArray.clear();
    final int n = attrs.size();
    for (int i = 0; i < n; i++) {
        tempArray.add(attributes.get(attrs.get(i).getKey(), -1));
    }
    return tempArray.items;
}
 
开发者ID:PWorlds,项目名称:LibGDX-PBR,代码行数:19,代码来源:PBRShader.java

示例6: makeMesh

import com.badlogic.gdx.graphics.VertexAttribute; //导入依赖的package包/类
public void makeMesh() {
	int rayon = Math.max(ExterminateGame.rendu, ExterminateGame.MAX_VIEW_DISTANCE)+5;
	 int nbTriangles=ChunkBuilder.GRIDSIZE*ChunkBuilder.GRIDSIZE*2*rayon*2*rayon*2;
	 int nbVertex=(ChunkBuilder.GRIDSIZE+1)*(ChunkBuilder.GRIDSIZE+1)*rayon*2*rayon*2;
	 
	FloatBuffer vertexL = org.lwjgl.BufferUtils.createFloatBuffer(nbVertex*ChunkBuilder.SOL_VERTICE_SIZE);
	IntBuffer indicesL = org.lwjgl.BufferUtils.createIntBuffer(nbTriangles*3);
	
	mesh = new UniMesh(true, true, nbVertex, nbTriangles*3, new VertexAttributes(VertexAttribute.Position(), VertexAttribute.NormalPacked(), VertexAttribute.TexCoords(0), VertexAttribute.ColorPacked()));
	mesh.setVertices(vertexL, 0, nbVertex*ChunkBuilder.SOL_VERTICE_SIZE);
	mesh.setIndices(indicesL, 0, nbTriangles*3);
	mesh.setCapacity(0);

	usedSol = new boolean[rayon*2*rayon*2];
	forChunk = new Chunk[rayon*2*rayon*2];
	
	for(int i=0;i<rayon*2*rayon*2;i++) {
		usedSol[i] = false;
	}

	UniVertexBufferObject.showMem();
}
 
开发者ID:Osaris31,项目名称:exterminate,代码行数:23,代码来源:Ground.java

示例7: PositionalLight

import com.badlogic.gdx.graphics.VertexAttribute; //导入依赖的package包/类
public PositionalLight (RayHandler rayHandler, int rays, Color color, float distance, float x, float y, float directionDegree) {
	super(rayHandler, rays, color, directionDegree, distance);
	start.x = x;
	start.y = y;
	sin = new float[rays];
	cos = new float[rays];
	endX = new float[rays];
	endY = new float[rays];

	lightMesh = new Mesh(VertexDataType.VertexArray, false, vertexNum, 0, new VertexAttribute(Usage.Position, 2,
		"vertex_positions"), new VertexAttribute(Usage.ColorPacked, 4, "quad_colors"),
		new VertexAttribute(Usage.Generic, 1, "s"));
	softShadowMesh = new Mesh(VertexDataType.VertexArray, false, vertexNum * 2, 0, new VertexAttribute(Usage.Position, 2,
		"vertex_positions"), new VertexAttribute(Usage.ColorPacked, 4, "quad_colors"),
		new VertexAttribute(Usage.Generic, 1, "s"));
	setMesh();
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:18,代码来源:PositionalLight.java

示例8: DirectionalLight

import com.badlogic.gdx.graphics.VertexAttribute; //导入依赖的package包/类
/** Directional lights simulate light source that locations is at infinite distance. Direction and intensity is same everywhere.
 * -90 direction is straight from up.
 * 
 * @param rayHandler
 * @param rays
 * @param color
 * @param directionDegree */
public DirectionalLight (RayHandler rayHandler, int rays, Color color, float directionDegree) {

	super(rayHandler, rays, color, directionDegree, Float.POSITIVE_INFINITY);

	vertexNum = (vertexNum - 1) * 2;

	start = new Vector2[rayNum];
	end = new Vector2[rayNum];
	for (int i = 0; i < rayNum; i++) {
		start[i] = new Vector2();
		end[i] = new Vector2();
	}
	setDirection(direction);

	lightMesh = new Mesh(VertexDataType.VertexArray, staticLight, vertexNum, 0, new VertexAttribute(Usage.Position, 2,
		"vertex_positions"), new VertexAttribute(Usage.ColorPacked, 4, "quad_colors"),
		new VertexAttribute(Usage.Generic, 1, "s"));
	softShadowMesh = new Mesh(VertexDataType.VertexArray, staticLight, vertexNum, 0, new VertexAttribute(Usage.Position, 2,
		"vertex_positions"), new VertexAttribute(Usage.ColorPacked, 4, "quad_colors"),
		new VertexAttribute(Usage.Generic, 1, "s"));
	update();
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:30,代码来源:DirectionalLight.java

示例9: RavChainLight

import com.badlogic.gdx.graphics.VertexAttribute; //导入依赖的package包/类
/** Creates chain light from specified vertices
 * 
 * @param rayHandler not {@code null} instance of RayHandler
 * @param rays number of rays - more rays make light to look more realistic but will decrease performance, can't be less than
 *           MIN_RAYS
 * @param color color, set to {@code null} to use the default color
 * @param distance distance of light
 * @param rayDirection direction of rays
 *           <ul>
 *           <li>1 = left</li>
 *           <li>-1 = right</li>
 *           </ul>
 * @param chain float array of (x, y) vertices from which rays will be evenly distributed */
public RavChainLight (RayHandler rayHandler, int rays, Color color, float distance, int rayDirection, float[] chain) {
	super(rayHandler, rays, color, distance, 0f);

	rayStartOffset = ChainLight.defaultRayStartOffset;
	this.rayDirection = rayDirection;
	vertexNum = (vertexNum - 1) * 2;
	endX = new float[rays];
	endY = new float[rays];
	startX = new float[rays];
	startY = new float[rays];
	this.chain = (chain != null) ? new FloatArray(chain) : new FloatArray();

	lightMesh = new Mesh(VertexDataType.VertexArray, false, vertexNum, 0,
		new VertexAttribute(Usage.Position, 2, "vertex_positions"), new VertexAttribute(Usage.ColorPacked, 4, "quad_colors"),
		new VertexAttribute(Usage.Generic, 1, "s"));
	softShadowMesh = new Mesh(VertexDataType.VertexArray, false, vertexNum * 2, 0,
		new VertexAttribute(Usage.Position, 2, "vertex_positions"), new VertexAttribute(Usage.ColorPacked, 4, "quad_colors"),
		new VertexAttribute(Usage.Generic, 1, "s"));
	setMesh();
}
 
开发者ID:Quexten,项目名称:RavTech,代码行数:34,代码来源:RavChainLight.java

示例10: buildMesh

import com.badlogic.gdx.graphics.VertexAttribute; //导入依赖的package包/类
private void buildMesh() {
  mesh = new Mesh(true, SIZE, 6, VertexAttribute.Position(), VertexAttribute.TexCoords(0));
  mesh.setVertices(vertices);

  short[] indices = new short[6];
  int v = 0;
  for (int i = 0; i < indices.length; i += 6, v += 4) {
    indices[i] = (short)(v);
    indices[i + 1] = (short)(v + 2);
    indices[i + 2] = (short)(v + 1);
    indices[i + 3] = (short)(v + 1);
    indices[i + 4] = (short)(v + 2);
    indices[i + 5] = (short)(v + 3);
  }

  mesh.setIndices(indices);
}
 
开发者ID:macbury,项目名称:ForgE,代码行数:18,代码来源:Sprite3DCache.java

示例11: build

import com.badlogic.gdx.graphics.VertexAttribute; //导入依赖的package包/类
public static Mesh build(float size, TextureRegion region) {
  Mesh mesh = new Mesh(true, SIZE, 6, VertexAttribute.Position(), VertexAttribute.TexCoords(0));
  mesh.setVertices(verticies(size, region));
  mesh.setAutoBind(false);
  short[] indices = new short[6];
  int v = 0;
  for (int i = 0; i < indices.length; i += 6, v += 4) {
    indices[i] = (short)(v);
    indices[i + 1] = (short)(v + 2);
    indices[i + 2] = (short)(v + 1);
    indices[i + 3] = (short)(v + 1);
    indices[i + 4] = (short)(v + 2);
    indices[i + 5] = (short)(v + 3);
  }

  mesh.setIndices(indices);

  return mesh;
}
 
开发者ID:macbury,项目名称:ForgE,代码行数:20,代码来源:QuadBuilder.java

示例12: ImmediateModeRenderer20

import com.badlogic.gdx.graphics.VertexAttribute; //导入依赖的package包/类
public ImmediateModeRenderer20 (int maxVertices, boolean hasNormals, boolean hasColors, int numTexCoords, ShaderProgram shader) {
	this.maxVertices = maxVertices;
	this.numTexCoords = numTexCoords;
	this.shader = shader;

	VertexAttribute[] attribs = buildVertexAttributes(hasNormals, hasColors, numTexCoords);
	mesh = new Mesh(false, maxVertices, 0, attribs);

	vertices = new float[maxVertices * (mesh.getVertexAttributes().vertexSize / 4)];
	vertexSize = mesh.getVertexAttributes().vertexSize / 4;
	normalOffset = mesh.getVertexAttribute(Usage.Normal) != null ? mesh.getVertexAttribute(Usage.Normal).offset / 4 : 0;
	colorOffset = mesh.getVertexAttribute(Usage.ColorPacked) != null ? mesh.getVertexAttribute(Usage.ColorPacked).offset / 4
		: 0;
	texCoordOffset = mesh.getVertexAttribute(Usage.TextureCoordinates) != null ? mesh
		.getVertexAttribute(Usage.TextureCoordinates).offset / 4 : 0;
		
	shaderUniformNames = new String[numTexCoords];
	for (int i = 0; i < numTexCoords; i++) {
		shaderUniformNames[i] = "u_sampler" + i;
	}
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:22,代码来源:ImmediateModeRenderer20.java

示例13: canRender

import com.badlogic.gdx.graphics.VertexAttribute; //导入依赖的package包/类
@Override
public boolean canRender (Renderable renderable) {
	if (renderable.material.has(BlendingAttribute.Type)) {
		if ((materialMask & BlendingAttribute.Type) != BlendingAttribute.Type)
			return false;
		if (renderable.material.has(TextureAttribute.Diffuse) != ((materialMask & TextureAttribute.Diffuse) == TextureAttribute.Diffuse))
			return false;
	}
	final boolean skinned = ((renderable.mesh.getVertexAttributes().getMask() & Usage.BoneWeight) == Usage.BoneWeight);
	if (skinned != (numBones > 0)) return false;
	if (!skinned) return true;
	int w = 0;
	final int n = renderable.mesh.getVertexAttributes().size();
	for (int i = 0; i < n; i++) {
		final VertexAttribute attr = renderable.mesh.getVertexAttributes().get(i);
		if (attr.usage == Usage.BoneWeight) w |= (1 << attr.unit);
	}
	return w == weights;
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:20,代码来源:DepthShader.java

示例14: initialize

import com.badlogic.gdx.graphics.VertexAttribute; //导入依赖的package包/类
/** Initializes the batch with the given amount of decal objects the buffer is able to hold when full.
 * 
 * @param size Maximum size of decal objects to hold in memory */
public void initialize (int size) {
	vertices = new float[size * Decal.SIZE];
	mesh = new Mesh(Mesh.VertexDataType.VertexArray, false, size * 4, size * 6, new VertexAttribute(
		VertexAttributes.Usage.Position, 3, ShaderProgram.POSITION_ATTRIBUTE), new VertexAttribute(
		VertexAttributes.Usage.ColorPacked, 4, ShaderProgram.COLOR_ATTRIBUTE), new VertexAttribute(
		VertexAttributes.Usage.TextureCoordinates, 2, ShaderProgram.TEXCOORD_ATTRIBUTE + "0"));

	short[] indices = new short[size * 6];
	int v = 0;
	for (int i = 0; i < indices.length; i += 6, v += 4) {
		indices[i] = (short)(v);
		indices[i + 1] = (short)(v + 2);
		indices[i + 2] = (short)(v + 1);
		indices[i + 3] = (short)(v + 1);
		indices[i + 4] = (short)(v + 2);
		indices[i + 5] = (short)(v + 3);
	}
	mesh.setIndices(indices);
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:23,代码来源:DecalBatch.java

示例15: createAttributes

import com.badlogic.gdx.graphics.VertexAttribute; //导入依赖的package包/类
/** @param usage bitwise mask of the {@link com.badlogic.gdx.graphics.VertexAttributes.Usage}, only Position, Color, Normal and
 *           TextureCoordinates is supported. */
public static VertexAttributes createAttributes (long usage) {
	final Array<VertexAttribute> attrs = new Array<VertexAttribute>();
	if ((usage & Usage.Position) == Usage.Position)
		attrs.add(new VertexAttribute(Usage.Position, 3, ShaderProgram.POSITION_ATTRIBUTE));
	if ((usage & Usage.Color) == Usage.Color) attrs.add(new VertexAttribute(Usage.Color, 4, ShaderProgram.COLOR_ATTRIBUTE));
	if ((usage & Usage.ColorPacked) == Usage.ColorPacked)
		attrs.add(new VertexAttribute(Usage.ColorPacked, 4, ShaderProgram.COLOR_ATTRIBUTE));
	if ((usage & Usage.Normal) == Usage.Normal)
		attrs.add(new VertexAttribute(Usage.Normal, 3, ShaderProgram.NORMAL_ATTRIBUTE));
	if ((usage & Usage.TextureCoordinates) == Usage.TextureCoordinates)
		attrs.add(new VertexAttribute(Usage.TextureCoordinates, 2, ShaderProgram.TEXCOORD_ATTRIBUTE + "0"));
	final VertexAttribute attributes[] = new VertexAttribute[attrs.size];
	for (int i = 0; i < attributes.length; i++)
		attributes[i] = attrs.get(i);
	return new VertexAttributes(attributes);
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:19,代码来源:MeshBuilder.java


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