本文整理汇总了Java中com.badlogic.gdx.graphics.g3d.attributes.IntAttribute类的典型用法代码示例。如果您正苦于以下问题:Java IntAttribute类的具体用法?Java IntAttribute怎么用?Java IntAttribute使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IntAttribute类属于com.badlogic.gdx.graphics.g3d.attributes包,在下文中一共展示了IntAttribute类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createOutlineModel
import com.badlogic.gdx.graphics.g3d.attributes.IntAttribute; //导入依赖的package包/类
public static void createOutlineModel(Model model, Color outlineColor, float fattenAmount) {
fatten(model, fattenAmount);
for (Material m : model.materials) {
m.clear();
m.set(new IntAttribute(IntAttribute.CullFace, Gdx.gl.GL_FRONT));
m.set(ColorAttribute.createDiffuse(outlineColor));
}
}
开发者ID:jsjolund,项目名称:GdxDemo3D,代码行数:9,代码来源:ModelFactory.java
示例2: bindMaterial
import com.badlogic.gdx.graphics.g3d.attributes.IntAttribute; //导入依赖的package包/类
protected void bindMaterial (final Renderable renderable) {
if (currentMaterial == renderable.material) return;
int cullFace = config.defaultCullFace == -1 ? defaultCullFace : config.defaultCullFace;
int depthFunc = config.defaultDepthFunc == -1 ? defaultDepthFunc : config.defaultDepthFunc;
float depthRangeNear = 0f;
float depthRangeFar = 1f;
boolean depthMask = true;
currentMaterial = renderable.material;
for (final Attribute attr : currentMaterial) {
final long t = attr.type;
if (BlendingAttribute.is(t)) {
context.setBlending(true, ((BlendingAttribute)attr).sourceFunction, ((BlendingAttribute)attr).destFunction);
set(u_opacity, ((BlendingAttribute)attr).opacity);
} else if ((t & IntAttribute.CullFace) == IntAttribute.CullFace)
cullFace = ((IntAttribute)attr).value;
else if ((t & FloatAttribute.AlphaTest) == FloatAttribute.AlphaTest)
set(u_alphaTest, ((FloatAttribute)attr).value);
else if ((t & DepthTestAttribute.Type) == DepthTestAttribute.Type) {
DepthTestAttribute dta = (DepthTestAttribute)attr;
depthFunc = dta.depthFunc;
depthRangeNear = dta.depthRangeNear;
depthRangeFar = dta.depthRangeFar;
depthMask = dta.depthMask;
} else if (!config.ignoreUnimplemented) throw new GdxRuntimeException("Unknown material attribute: " + attr.toString());
}
context.setCullFace(cullFace);
context.setDepthTest(depthFunc, depthRangeNear, depthRangeFar);
context.setDepthMask(depthMask);
}
开发者ID:basherone,项目名称:libgdxcn,代码行数:33,代码来源:DefaultShader.java
示例3: bindMaterial
import com.badlogic.gdx.graphics.g3d.attributes.IntAttribute; //导入依赖的package包/类
protected void bindMaterial(final Renderable renderable) {
if (currentMaterial == renderable.material)
return;
int cullFace = config.defaultCullFace == -1 ? defaultCullFace : config.defaultCullFace;
int depthFunc = config.defaultDepthFunc == -1 ? defaultDepthFunc : config.defaultDepthFunc;
float depthRangeNear = 0f;
float depthRangeFar = 1f;
boolean depthMask = true;
currentMaterial = renderable.material;
for (final Attribute attr : currentMaterial) {
final long t = attr.type;
if (BlendingAttribute.is(t)) {
context.setBlending(true, ((BlendingAttribute) attr).sourceFunction, ((BlendingAttribute) attr).destFunction);
} else if ((t & IntAttribute.CullFace) == IntAttribute.CullFace)
cullFace = ((IntAttribute) attr).value;
else if ((t & DepthTestAttribute.Type) == DepthTestAttribute.Type) {
DepthTestAttribute dta = (DepthTestAttribute) attr;
depthFunc = dta.depthFunc;
depthRangeNear = dta.depthRangeNear;
depthRangeFar = dta.depthRangeFar;
depthMask = dta.depthMask;
} else if (!config.ignoreUnimplemented)
throw new GdxRuntimeException("Unknown material attribute: " + attr.toString());
}
context.setCullFace(cullFace);
context.setDepthTest(depthFunc, depthRangeNear, depthRangeFar);
context.setDepthMask(depthMask);
}
开发者ID:langurmonkey,项目名称:gaiasky,代码行数:32,代码来源:AtmosphereShader.java
示例4: create
import com.badlogic.gdx.graphics.g3d.attributes.IntAttribute; //导入依赖的package包/类
@Override
public void create () {
super.create();
world.add("ground", 0f, 0f, 0f).setColor(0.25f + 0.5f * (float)Math.random(), 0.25f + 0.5f * (float)Math.random(),
0.25f + 0.5f * (float)Math.random(), 1f);
float x0 = -2f, y0 = 6f, z0 = -2f;
float x1 = 8f, y1 = 6f, z1 = 8f;
Vector3 patch00 = new Vector3(x0, y0, z0);
Vector3 patch10 = new Vector3(x1, y1, z0);
Vector3 patch01 = new Vector3(x0, y0, z1);
Vector3 patch11 = new Vector3(x1, y1, z1);
softBody = btSoftBodyHelpers.CreatePatch(worldInfo, patch00, patch10, patch01, patch11, 15, 15, 15, false);
softBody.takeOwnership();
softBody.setTotalMass(100f);
// softBody.setConfig_kDP(0.2f);
// softBody.setConfig_kCHR(0.99f);
// softBody.setConfig_kKHR(0.99f);
// softBody.setConfig_kSHR(0.99f);
((btSoftRigidDynamicsWorld)(world.collisionWorld)).addSoftBody(softBody);
final int vertCount = softBody.getNodeCount();
final int faceCount = softBody.getFaceCount();
mesh = new Mesh(false, vertCount, faceCount * 3, new VertexAttribute(Usage.Position, 3, ShaderProgram.POSITION_ATTRIBUTE),
new VertexAttribute(Usage.Normal, 3, ShaderProgram.NORMAL_ATTRIBUTE), new VertexAttribute(Usage.TextureCoordinates, 2,
ShaderProgram.TEXCOORD_ATTRIBUTE + "0"));
final int vertSize = mesh.getVertexSize() / 4;
mesh.getVerticesBuffer().position(0);
mesh.getVerticesBuffer().limit(vertCount * vertSize);
mesh.getIndicesBuffer().position(0);
mesh.getIndicesBuffer().limit(faceCount * 3);
softBody.getVertices(mesh.getVerticesBuffer(), vertCount, mesh.getVertexSize(), 0);
softBody.getIndices(mesh.getIndicesBuffer(), faceCount);
final float[] verts = new float[vertCount * vertSize];
final int uvOffset = mesh.getVertexAttribute(Usage.TextureCoordinates).offset / 4;
final int normalOffset = mesh.getVertexAttribute(Usage.Normal).offset / 4;
mesh.getVertices(verts);
for (int i = 0; i < vertCount; i++) {
verts[i * vertSize + normalOffset] = 0f;
verts[i * vertSize + normalOffset + 1] = 1f;
verts[i * vertSize + normalOffset + 2] = 0f;
verts[i * vertSize + uvOffset] = (verts[i * vertSize] - x0) / (x1 - x0);
verts[i * vertSize + uvOffset + 1] = (verts[i * vertSize + 2] - z0) / (z1 - z0);
}
mesh.setVertices(verts);
texture = new Texture(Gdx.files.internal("data/badlogic.jpg"));
model = ModelBuilder.createFromMesh(mesh, GL20.GL_TRIANGLES, new Material(TextureAttribute.createDiffuse(texture),
ColorAttribute.createSpecular(Color.WHITE), FloatAttribute.createShininess(64f), IntAttribute.createCullFace(0)));
instance = new ModelInstance(model);
world.add(new BulletEntity(instance, null));
shoot(320f, 240f, 20f);
}
开发者ID:Matsemann,项目名称:eamaster,代码行数:57,代码来源:SoftBodyTest.java
示例5: create
import com.badlogic.gdx.graphics.g3d.attributes.IntAttribute; //导入依赖的package包/类
@Override
public void create () {
super.create();
world.add("ground", 0f, 0f, 0f).setColor(0.25f + 0.5f * (float)Math.random(), 0.25f + 0.5f * (float)Math.random(),
0.25f + 0.5f * (float)Math.random(), 1f);
float x0 = -2f, y0 = 6f, z0 = -2f;
float x1 = 8f, y1 = 6f, z1 = 8f;
Vector3 patch00 = new Vector3(x0, y0, z0);
Vector3 patch10 = new Vector3(x1, y1, z0);
Vector3 patch01 = new Vector3(x0, y0, z1);
Vector3 patch11 = new Vector3(x1, y1, z1);
softBody = btSoftBodyHelpers.CreatePatch(worldInfo, patch00, patch10, patch01, patch11, 15, 15, 15, false);
softBody.takeOwnership();
softBody.setTotalMass(100f);
((btSoftRigidDynamicsWorld)(world.collisionWorld)).addSoftBody(softBody);
final int vertCount = softBody.getNodeCount();
final int faceCount = softBody.getFaceCount();
mesh = new Mesh(false, vertCount, faceCount * 3, new VertexAttribute(Usage.Position, 3, ShaderProgram.POSITION_ATTRIBUTE),
new VertexAttribute(Usage.Normal, 3, ShaderProgram.NORMAL_ATTRIBUTE), new VertexAttribute(Usage.TextureCoordinates, 2,
ShaderProgram.TEXCOORD_ATTRIBUTE + "0"));
final int vertSize = mesh.getVertexSize() / 4;
mesh.getVerticesBuffer().position(0);
mesh.getVerticesBuffer().limit(vertCount * vertSize);
mesh.getIndicesBuffer().position(0);
mesh.getIndicesBuffer().limit(faceCount * 3);
softBody.getVertices(mesh.getVerticesBuffer(), vertCount, mesh.getVertexSize(), 0);
softBody.getIndices(mesh.getIndicesBuffer(), faceCount);
final float[] verts = new float[vertCount * vertSize];
final int uvOffset = mesh.getVertexAttribute(Usage.TextureCoordinates).offset / 4;
final int normalOffset = mesh.getVertexAttribute(Usage.Normal).offset / 4;
mesh.getVertices(verts);
for (int i = 0; i < vertCount; i++) {
verts[i * vertSize + normalOffset] = 0f;
verts[i * vertSize + normalOffset + 1] = 1f;
verts[i * vertSize + normalOffset + 2] = 0f;
verts[i * vertSize + uvOffset] = (verts[i * vertSize] - x0) / (x1 - x0);
verts[i * vertSize + uvOffset + 1] = (verts[i * vertSize + 2] - z0) / (z1 - z0);
}
mesh.setVertices(verts);
texture = new Texture(Gdx.files.internal("data/badlogic.jpg"));
model = ModelBuilder.createFromMesh(mesh, GL20.GL_TRIANGLES, new Material(TextureAttribute.createDiffuse(texture),
ColorAttribute.createSpecular(Color.WHITE), FloatAttribute.createShininess(64f), IntAttribute.createCullFace(0)));
instance = new ModelInstance(model);
world.add(new BulletEntity(instance, null));
}
开发者ID:basherone,项目名称:libgdxcn,代码行数:51,代码来源:SoftBodyTest.java
示例6: touch
import com.badlogic.gdx.graphics.g3d.attributes.IntAttribute; //导入依赖的package包/类
/**
* Initialises the texture if it is not initialised yet
*/
public void touch() {
if (GlobalConf.scene.LAZY_TEXTURE_INIT && !initialised) {
if (tc != null) {
if (!loading) {
Logger.info(I18n.bundle.format("notif.loading", tc.base));
tc.initialize(manager);
// Set to loading
loading = true;
} else if (tc.isFinishedLoading(manager)) {
Gdx.app.postRunnable(() -> {
tc.initMaterial(manager, instance, cc, culling);
});
// Set to initialised
initialised = true;
loading = false;
}
} else {
// Use color if necessary
if (cc != null && useColor) {
// Regular mesh, we use the color
int n = instance.materials.size;
for (int i = 0; i < n; i++) {
Material material = instance.materials.get(i);
if (material.get(TextureAttribute.Ambient) == null && material.get(TextureAttribute.Diffuse) == null) {
material.set(new ColorAttribute(ColorAttribute.Diffuse, cc[0], cc[1], cc[2], cc[3]));
material.set(new ColorAttribute(ColorAttribute.Ambient, cc[0], cc[1], cc[2], cc[3]));
if (!culling)
material.set(new IntAttribute(IntAttribute.CullFace, GL20.GL_NONE));
}
}
}
// Set to initialised
initialised = true;
loading = false;
}
}
}
开发者ID:langurmonkey,项目名称:gaiasky,代码行数:45,代码来源:ModelComponent.java
注:本文中的com.badlogic.gdx.graphics.g3d.attributes.IntAttribute类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论