本文整理汇总了Java中com.badlogic.gdx.graphics.g3d.utils.ModelBuilder.createBox方法的典型用法代码示例。如果您正苦于以下问题:Java ModelBuilder.createBox方法的具体用法?Java ModelBuilder.createBox怎么用?Java ModelBuilder.createBox使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.graphics.g3d.utils.ModelBuilder
的用法示例。
在下文中一共展示了ModelBuilder.createBox方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: create
import com.badlogic.gdx.graphics.g3d.utils.ModelBuilder; //导入方法依赖的package包/类
@Override
public void create() {
super.create();
geometryPass = new ShaderProgram(
Gdx.files.internal("shaders/g_buffer.vert"),
Gdx.files.internal("shaders/g_buffer.frag"));
lightingPass = new ShaderProgram(
Gdx.files.internal("shaders/deferred_shader.vert"),
Gdx.files.internal("shaders/deferred_shader.frag"));
ModelBuilder mb = new ModelBuilder();
Model cube = mb.createBox(1, 1, 1, new Material(),
VertexAttributes.Usage.Position |
VertexAttributes.Usage.Normal |
VertexAttributes.Usage.TextureCoordinates);
cubeMesh = cube.meshes.first();
}
示例2: ScaleTool
import com.badlogic.gdx.graphics.g3d.utils.ModelBuilder; //导入方法依赖的package包/类
public ScaleTool(ProjectManager projectManager, GameObjectPicker goPicker, ToolHandlePicker handlePicker,
ShapeRenderer shapeRenderer, ModelBatch batch, CommandHistory history) {
super(projectManager, goPicker, handlePicker, batch, history);
this.shapeRenderer = shapeRenderer;
ModelBuilder modelBuilder = new ModelBuilder();
Model xPlaneHandleModel = UsefulMeshs.createArrowStub(new Material(ColorAttribute.createDiffuse(COLOR_X)),
Vector3.Zero, new Vector3(15, 0, 0));
Model yPlaneHandleModel = UsefulMeshs.createArrowStub(new Material(ColorAttribute.createDiffuse(COLOR_Y)),
Vector3.Zero, new Vector3(0, 15, 0));
Model zPlaneHandleModel = UsefulMeshs.createArrowStub(new Material(ColorAttribute.createDiffuse(COLOR_Z)),
Vector3.Zero, new Vector3(0, 0, 15));
Model xyzPlaneHandleModel = modelBuilder.createBox(3, 3, 3,
new Material(ColorAttribute.createDiffuse(COLOR_XYZ)),
VertexAttributes.Usage.Position | VertexAttributes.Usage.Normal);
xHandle = new ScaleHandle(X_HANDLE_ID, xPlaneHandleModel);
yHandle = new ScaleHandle(Y_HANDLE_ID, yPlaneHandleModel);
zHandle = new ScaleHandle(Z_HANDLE_ID, zPlaneHandleModel);
xyzHandle = new ScaleHandle(XYZ_HANDLE_ID, xyzPlaneHandleModel);
handles = new ScaleHandle[] { xHandle, yHandle, zHandle, xyzHandle };
}
示例3: create
import com.badlogic.gdx.graphics.g3d.utils.ModelBuilder; //导入方法依赖的package包/类
@Override
public void create () {
modelBatch = new ModelBatch();
environment = new Environment();
environment.set(new ColorAttribute(ColorAttribute.AmbientLight, 0.4f, 0.4f, 0.4f, 1.f));
environment.set(new ColorAttribute(ColorAttribute.Fog, 0.13f, 0.13f, 0.13f, 1f));
environment.add(new DirectionalLight().set(0.8f, 0.8f, 0.8f, -1f, -0.8f, -0.2f));
cam = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
cam.position.set(30f, 10f, 30f);
cam.lookAt(0, 0, 0);
cam.near = 0.1f;
cam.far = 45f;
cam.update();
ModelBuilder modelBuilder = new ModelBuilder();
model = modelBuilder.createBox(5f, 5f, 5f, new Material(ColorAttribute.createDiffuse(Color.GREEN)), Usage.Position
| Usage.Normal);
instance = new ModelInstance(model);
Gdx.input.setInputProcessor(new InputMultiplexer(this, inputController = new CameraInputController(cam)));
}
示例4: create
import com.badlogic.gdx.graphics.g3d.utils.ModelBuilder; //导入方法依赖的package包/类
@Override
public void create () {
modelBatch = new ModelBatch(new DefaultShaderProvider());
// modelBatch = new ModelBatch();
environment = new Environment();
environment.set(new ColorAttribute(ColorAttribute.AmbientLight, .4f, .4f, .4f, 1f));
environment.add(new DirectionalLight().set(0.8f, 0.8f, 0.8f, -1f, -0.8f, -0.2f));
cam = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
cam.position.set(10f, 10f, 10f);
cam.lookAt(0, 0, 0);
cam.near = 0.1f;
cam.far = 300f;
cam.update();
ModelBuilder modelBuilder = new ModelBuilder();
model = modelBuilder.createBox(5f, 5f, 5f, new Material(ColorAttribute.createDiffuse(Color.GREEN)), Usage.Position
| Usage.Normal);
instance = new ModelInstance(model);
// model = new G3dModelLoader(new UBJsonReader()).loadModel(Gdx.files.internal("data/g3d/knight.g3db"));
// instance = new ModelInstance(model);
Gdx.input.setInputProcessor(new InputMultiplexer(this, inputController = new CameraInputController(cam)));
}
示例5: create
import com.badlogic.gdx.graphics.g3d.utils.ModelBuilder; //导入方法依赖的package包/类
@Override
public void create() {
modelBatch = new ModelBatch();
environment = new Environment();
environment.set(new ColorAttribute(ColorAttribute.AmbientLight, 0.4f, 0.4f, 0.4f, 1f));
environment.add(new DirectionalLight().set(0.8f, 0.8f, 0.8f, -1f, -0.8f, -0.2f));
cam = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
cam.position.set(10f, 10f, 10f);
cam.lookAt(0, 0, 0);
cam.near = 1f;
cam.far = 300f;
cam.update();
camController = new CameraInputController(cam);
Gdx.input.setInputProcessor(camController);
ModelBuilder modelBuilder = new ModelBuilder();
model = modelBuilder.createBox(5f, 5f, 5f,
new Material(ColorAttribute.createDiffuse(Color.GREEN)),
Usage.Position | Usage.Normal);
instance = new ModelInstance(model);
}
示例6: createMeshes
import com.badlogic.gdx.graphics.g3d.utils.ModelBuilder; //导入方法依赖的package包/类
private void createMeshes() {
ModelBuilder mb = new ModelBuilder();
cubeModel = mb.createBox(1, 1, 1, new Material(),
VertexAttributes.Usage.Position |
VertexAttributes.Usage.Normal |
VertexAttributes.Usage.TextureCoordinates);
cubeMesh = cubeModel.meshes.first();
G3dModelLoader modelLoader = new G3dModelLoader(new UBJsonReader());
quadModel = modelLoader.loadModel(Gdx.files.internal("models/quad.g3db"));
quadMesh = quadModel.meshes.first();
}
示例7: drawBlockSelection
import com.badlogic.gdx.graphics.g3d.utils.ModelBuilder; //导入方法依赖的package包/类
private void drawBlockSelection() {
int curProgressInt = Math.round(RadixClient.getInstance().getPlayer().getBreakPercent() * 10) - 1;
if ((blockBreakModel == null || blockBreakStage != curProgressInt) && curProgressInt >= 0) {
if (blockBreakModel != null)
blockBreakModel.dispose();
blockBreakStage = curProgressInt;
ModelBuilder builder = new ModelBuilder();
blockBreakModel = builder.createBox(1f, 1f, 1f,
new Material(TextureAttribute.createDiffuse(blockBreakStages[blockBreakStage]),
new BlendingAttribute(),
FloatAttribute.createAlphaTest(0.25f)),
VertexAttributes.Usage.Position | VertexAttributes.Usage.TextureCoordinates);
blockBreakModelInstance = new ModelInstance(blockBreakModel);
}
Vec3i curBlk = RadixClient.getInstance().getSelectedBlock();
if (curBlk != null && curProgressInt >= 0) {
Gdx.gl.glPolygonOffset(100000, 2000000);
blockOverlayBatch.begin(RadixClient.getInstance().getCamera());
blockBreakModelInstance.transform.translate(curBlk.x + 0.5f, curBlk.y + 0.5f, curBlk.z + 0.5f);
blockOverlayBatch.render(blockBreakModelInstance);
blockBreakModelInstance.transform.translate(-(curBlk.x + 0.5f), -(curBlk.y + 0.5f), -(curBlk.z + 0.5f));
blockOverlayBatch.end();
Gdx.gl.glPolygonOffset(100000, -2000000);
}
}
示例8: createModel
import com.badlogic.gdx.graphics.g3d.utils.ModelBuilder; //导入方法依赖的package包/类
private Model createModel() {
ModelBuilder modelBuilder = new ModelBuilder();
Model model = modelBuilder.createBox(1, 1, 1,
new Material(new CubemapAttribute(CubemapAttribute.EnvironmentMap, cubemap)),
VertexAttributes.Usage.Position);
return model;
}
示例9: PiecesEasy
import com.badlogic.gdx.graphics.g3d.utils.ModelBuilder; //导入方法依赖的package包/类
public PiecesEasy(){
mb = new ModelBuilder();
model = mb.createBox(1f,1f,1f,
new Material(ColorAttribute.createDiffuse(Color.WHITE)),
VertexAttributes.Usage.Position | VertexAttributes.Usage.Normal);
shadowModel = mb.createBox(1f,1f,1f,
new Material(ColorAttribute.createDiffuse(Color.GRAY)),
VertexAttributes.Usage.Position | VertexAttributes.Usage.Normal);
a = new ModelInstance(model);
b = new ModelInstance(model);
c = new ModelInstance(model);
d = new ModelInstance(model);
e = new ModelInstance(shadowModel);
f = new ModelInstance(shadowModel);
g = new ModelInstance(shadowModel);
h = new ModelInstance(shadowModel);
parts = new Array<ModelInstance>();
parts.add(a);
parts.add(b);
parts.add(c);
parts.add(d);
a.transform.setToTranslation(11f, 0f, 12f);
a.transform.translate(0f,8f,0f);
base = new Vector3();
}
示例10: Platform
import com.badlogic.gdx.graphics.g3d.utils.ModelBuilder; //导入方法依赖的package包/类
public Platform() {
mb = new ModelBuilder();
black = mb.createBox(1f, 1f, 1f,
new Material(ColorAttribute.createDiffuse(Color.BLACK)),
VertexAttributes.Usage.Position | VertexAttributes.Usage.Normal);
magenta = mb.createBox(1f, 1f, 1f,
new Material(ColorAttribute.createDiffuse(Color.MAGENTA)),
VertexAttributes.Usage.Position | VertexAttributes.Usage.Normal);
instances = new Array<ModelInstance>();
}
示例11: Pieces
import com.badlogic.gdx.graphics.g3d.utils.ModelBuilder; //导入方法依赖的package包/类
public Pieces(){
mb = new ModelBuilder();
model = mb.createBox(1f,1f,1f,
new Material(ColorAttribute.createDiffuse(Color.WHITE)),
VertexAttributes.Usage.Position | VertexAttributes.Usage.Normal);
shadowModel = mb.createBox(1f,1f,1f,
new Material(ColorAttribute.createDiffuse(Color.GRAY)),
VertexAttributes.Usage.Position | VertexAttributes.Usage.Normal);
a = new ModelInstance(model);
b = new ModelInstance(model);
c = new ModelInstance(model);
d = new ModelInstance(model);
e = new ModelInstance(shadowModel);
f = new ModelInstance(shadowModel);
g = new ModelInstance(shadowModel);
h = new ModelInstance(shadowModel);
parts = new Array<ModelInstance>();
parts.add(a);
parts.add(b);
parts.add(c);
parts.add(d);
a.transform.setToTranslation(13f, 0f, 14f);
a.transform.translate(0f,8f,0f);
base = new Vector3();
}
示例12: create
import com.badlogic.gdx.graphics.g3d.utils.ModelBuilder; //导入方法依赖的package包/类
@Override
public void create () {
Gdx.gl.glClearColor(0.2f, 0.3f, 1.0f, 0.f);
atlas = new TextureAtlas(Gdx.files.internal("data/testpack"));
regions = atlas.getRegions();
modelBatch = new ModelBatch(new DefaultShaderProvider());
environment = new Environment();
environment.set(new ColorAttribute(ColorAttribute.AmbientLight, .4f, .4f, .4f, 1f));
environment.add(new DirectionalLight().set(0.8f, 0.8f, 0.8f, -1f, -0.8f, -0.2f));
cam = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
cam.position.set(10f, 10f, 10f);
cam.lookAt(0, 0, 0);
cam.near = 0.1f;
cam.far = 300f;
cam.update();
ModelBuilder modelBuilder = new ModelBuilder();
final Material material = new Material(ColorAttribute.createDiffuse(1f, 1f, 1f, 1f), new TextureAttribute(TextureAttribute.Diffuse));
model = modelBuilder.createBox(5f, 5f, 5f, material, Usage.Position | Usage.Normal | Usage.TextureCoordinates);
instance = new ModelInstance(model);
attribute = instance.materials.get(0).get(TextureAttribute.class, TextureAttribute.Diffuse);
Gdx.input.setInputProcessor(new InputMultiplexer(this, inputController = new CameraInputController(cam)));
}
示例13: create
import com.badlogic.gdx.graphics.g3d.utils.ModelBuilder; //导入方法依赖的package包/类
@Override
public void create () {
texture = new Texture(Gdx.files.internal("data/badlogic.jpg"), true);
// Create material attributes. Each material can contain x-number of attributes.
textureAttribute = new TextureAttribute(TextureAttribute.Diffuse, texture);
colorAttribute = new ColorAttribute(ColorAttribute.Diffuse, Color.ORANGE);
blendingAttribute = new BlendingAttribute(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
ModelBuilder builder = new ModelBuilder();
model = builder.createBox(1, 1, 1, new Material(), Usage.Position | Usage.Normal | Usage.TextureCoordinates);
model.manageDisposable(texture);
modelInstance = new ModelInstance(model);
modelInstance.transform.rotate(Vector3.X, 45);
material = modelInstance.materials.get(0);
builder.begin();
MeshPartBuilder mpb = builder.part("back", GL20.GL_TRIANGLES, Usage.Position | Usage.TextureCoordinates, new Material(
textureAttribute));
mpb.rect(-2, -2, -2, 2, -2, -2, 2, 2, -2, -2, 2, -2, 0, 0, 1);
backModel = builder.end();
background = new ModelInstance(backModel);
modelBatch = new ModelBatch();
camera = new PerspectiveCamera(45, 4, 4);
camera.position.set(0, 0, 3);
camera.direction.set(0, 0, -1);
camera.update();
Gdx.input.setInputProcessor(this);
}
示例14: spawnfloor
import com.badlogic.gdx.graphics.g3d.utils.ModelBuilder; //导入方法依赖的package包/类
public void spawnfloor(){
ModelBuilder modelBuilder = new ModelBuilder();
Model model;
model = modelBuilder.createBox(blockscale*100, blockscale, blockscale*100, new Material(
ColorAttribute.createDiffuse(Color.CLEAR)),
Usage.Position | Usage.Normal | Usage.TextureCoordinates);
ModelInstance instance = new ModelInstance(model);
instance.transform.translate(blockscale*50, -20.0f, blockscale*50);
instances.add(instance);
}
示例15: spawnCubeArray
import com.badlogic.gdx.graphics.g3d.utils.ModelBuilder; //导入方法依赖的package包/类
public void spawnCubeArray(Array<ModelInstance> cubeinstances){//not used now but has cool effect
for (int z = 0; z < 100; z++) {
for (int x = 0; x < 100; x++) {
ModelBuilder modelBuilder = new ModelBuilder();
Model model;
if (x % 2 == 0) {
if(z % 2 == 0){
model = modelBuilder.createBox(blockscale, blockscale, blockscale, new Material(
ColorAttribute.createDiffuse(Color.RED)),
Usage.Position | Usage.Normal);
}
else {
model = modelBuilder.createBox(blockscale, blockscale, blockscale, new Material(
ColorAttribute.createDiffuse(Color.GREEN)),
Usage.Position | Usage.Normal);
}
} else {
if(z % 2 == 0){
model = modelBuilder.createBox(blockscale, blockscale, blockscale, new Material(
ColorAttribute.createDiffuse(Color.GREEN)),
Usage.Position | Usage.Normal);
}
else{
model = modelBuilder.createBox(blockscale, blockscale, blockscale, new Material(
ColorAttribute.createDiffuse(Color.RED)),
Usage.Position | Usage.Normal);
}
}
ModelInstance instance = new ModelInstance(model);
instance.transform.translate(x * blockscale, 0, z*blockscale);
cubeinstances.add(instance);
}
}
}