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


Java Material类代码示例

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


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

示例1: GameObject

import com.badlogic.gdx.graphics.g3d.Material; //导入依赖的package包/类
public GameObject(ScreenBase context, Model model, BoundingBox bounds) {
super(model);
this.context = context;
this.customBounds = bounds;

      this.bounds = this.customBounds != null ? this.customBounds : new BoundingBox();
      this.center = new Vector3();
      this.enabled = true;
      updateBox();
      
      this.animations = new AnimationController(this);
      this.blending = new BlendingAttribute(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
      
      for(Material item : materials){
      	item.set(new DepthTestAttribute(GL20.GL_LEQUAL, 0.01f, 25f, true));
	item.set(FloatAttribute.createAlphaTest(0.01f));
      	item.set(blending);
      }
  }
 
开发者ID:raphaelbruno,项目名称:ZombieInvadersVR,代码行数:20,代码来源:GameObject.java

示例2: createEntity

import com.badlogic.gdx.graphics.g3d.Material; //导入依赖的package包/类
@Deprecated //Only for creating the first one
private void createEntity(float f, float g, float h) {
	Vector3 position=new Vector3(f,g,h);
	List<EntityStatic> collidingEntities=space.getWithin(position, 0.03);

	if(collidingEntities.size() == 0) {
		EntityStatic entity=new EntityStatic(new ModelInstance(
				Assets.modelBuilder.createBox(0.03f, 0.03f, 0.06f, 
						new Material(StrategyGame.blueAttr), 
						Usage.Normal | Usage.Position)),
				position);

		space.addEntity(entity);
	} else {
		for(EntityStatic e:collidingEntities){
			e.damage(2);
		}
	}
}
 
开发者ID:DevelopersGuild,项目名称:Planetbase,代码行数:20,代码来源:StrategyGame.java

示例3: create

import com.badlogic.gdx.graphics.g3d.Material; //导入依赖的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();
}
 
开发者ID:MovementSpeed,项目名称:nhglib,代码行数:20,代码来源:MainDef.java

示例4: select

import com.badlogic.gdx.graphics.g3d.Material; //导入依赖的package包/类
@Override
    protected AbstractPanel select(T obj) {
        super.select(obj);
        if(obj == null) {
            matList.clearItems();
            selectMtl(null);
            return this;
        }
        ModelInstance inst = gameWorld.renderer().getRenderable(obj);
        matList.clearItems();
        inst.nodes.forEach(n -> n.parts.forEach(p -> {
            ArgentList.ArgentListElement<Material> e = new ArgentList.ArgentListElement<>(p.material, this::selectMtl);
            e.getString = () -> String.format("[%s] %s", n.id, e.obj.id);
            matList.addItem(e);
        }));
//        inst.materials.forEach(m -> {
//            ArgentList.ArgentListElement<Material> e = new ArgentList.ArgentListElement<>(m, this::selectMtl);
//            e.getString = () -> e.obj.id;
//            matList.addItem(e);
//        });

        selectMtl(null);
        return this;
    }
 
开发者ID:ncguy2,项目名称:Argent,代码行数:25,代码来源:MaterialPanel.java

示例5: selectMtl

import com.badlogic.gdx.graphics.g3d.Material; //导入依赖的package包/类
private void selectMtl(Material mtl) {
        configTree.clearChildren();
        selectedMtl = mtl;
        if(mtl == null) return;
        MaterialWrapper wrapper = new MaterialWrapper(mtl);
        List<ConfigurableAttribute<?>> attrs = wrapper.getConfigAttrs();
        builder.compileSet(configTree, attrs);
        configTree.getRootNodes().forEach(node -> node.setExpanded(true));
//        attrs.forEach(ca -> {
//            System.out.println(ca.displayName());
//            Object compObj = builder.buildComponent(ca);
//            if (compObj instanceof Actor) {
//                float compWidth = getWidth()-192;
//                configTable.add(new Label(ca.displayName(), skin)).width(192);
//                configTable.add((Actor) compObj).width(compWidth-10);
//                configTable.row();
//            }
//        });
    }
 
开发者ID:ncguy2,项目名称:Argent,代码行数:20,代码来源:MaterialPanel.java

示例6: SimulationRunner

import com.badlogic.gdx.graphics.g3d.Material; //导入依赖的package包/类
public SimulationRunner() {
    logger.info("Loading models");
    ModelBuilder builder = new ModelBuilder();
    models.put("box", builder.createBox(5f, 5f, 5f,
            new Material(ColorAttribute.createDiffuse(new Color(0.8f, 0f, 0f, 0f))),
            VertexAttributes.Usage.Position | VertexAttributes.Usage.Normal));

    G3dModelLoader loader = new G3dModelLoader(new JsonReader());
    models.put("hub", loader.loadModel(Gdx.files.internal("data/hubreal.g3dj")));
    models.put("rim", loader.loadModel(Gdx.files.internal("data/rimreal.g3dj")));
    models.put("spoke", loader.loadModel(Gdx.files.internal("data/spoke.g3dj")));


    Bullet.init();
    logger.info("Initialized Bullet");
}
 
开发者ID:Matsemann,项目名称:eamaster,代码行数:17,代码来源:SimulationRunner.java

示例7: Terrain

import com.badlogic.gdx.graphics.g3d.Material; //导入依赖的package包/类
private Terrain(int vertexResolution) {
    this.transform = new Matrix4();
    this.attribs = MeshBuilder.createAttributes(VertexAttributes.Usage.Position | VertexAttributes.Usage.Normal
            | VertexAttributes.Usage.TextureCoordinates);
    this.posPos = attribs.getOffset(VertexAttributes.Usage.Position, -1);
    this.norPos = attribs.getOffset(VertexAttributes.Usage.Normal, -1);
    this.uvPos = attribs.getOffset(VertexAttributes.Usage.TextureCoordinates, -1);
    this.stride = attribs.vertexSize / 4;

    this.vertexResolution = vertexResolution;
    this.heightData = new float[vertexResolution * vertexResolution];

    this.terrainTexture = new TerrainTexture();
    this.terrainTexture.setTerrain(this);
    material = new Material();
    material.set(new TerrainTextureAttribute(TerrainTextureAttribute.ATTRIBUTE_SPLAT0, terrainTexture));
}
 
开发者ID:mbrlabs,项目名称:Mundus,代码行数:18,代码来源:Terrain.java

示例8: createAxes

import com.badlogic.gdx.graphics.g3d.Material; //导入依赖的package包/类
public static Model createAxes() {
    final float GRID_MIN = -10f;
    final float GRID_MAX = 10f;
    final float GRID_STEP = 1f;
    ModelBuilder modelBuilder = new ModelBuilder();
    modelBuilder.begin();
    MeshPartBuilder builder = modelBuilder.part("grid", GL20.GL_LINES,
            VertexAttributes.Usage.Position | VertexAttributes.Usage.ColorUnpacked, new Material());
    builder.setColor(Color.LIGHT_GRAY);
    for (float t = GRID_MIN; t <= GRID_MAX; t += GRID_STEP) {
        builder.line(t, 0, GRID_MIN, t, 0, GRID_MAX);
        builder.line(GRID_MIN, 0, t, GRID_MAX, 0, t);
    }
    builder = modelBuilder.part("axes", GL20.GL_LINES,
            VertexAttributes.Usage.Position | VertexAttributes.Usage.ColorUnpacked, new Material());
    builder.setColor(Color.RED);
    builder.line(0, 0, 0, 100, 0, 0);
    builder.setColor(Color.GREEN);
    builder.line(0, 0, 0, 0, 100, 0);
    builder.setColor(Color.BLUE);
    builder.line(0, 0, 0, 0, 0, 100);
    return modelBuilder.end();
}
 
开发者ID:mbrlabs,项目名称:Mundus,代码行数:24,代码来源:UsefulMeshs.java

示例9: RotateHandle

import com.badlogic.gdx.graphics.g3d.Material; //导入依赖的package包/类
public RotateHandle(int id, Color color) {
    super(id);
    model = UsefulMeshs.torus(new Material(ColorAttribute.createDiffuse(color)), 20, 1f, 50, 50);
    modelInstance = new ModelInstance(model);
    modelInstance.materials.first().set(getIdAttribute());
    switch (id) {
    case X_HANDLE_ID:
        this.getRotationEuler().y = 90;
        this.getScale().x = 0.9f;
        this.getScale().y = 0.9f;
        this.getScale().z = 0.9f;
        break;
    case Y_HANDLE_ID:
        this.getRotationEuler().x = 90;
        break;
    case Z_HANDLE_ID:
        this.getRotationEuler().z = 90;
        this.getScale().x = 1.1f;
        this.getScale().y = 1.1f;
        this.getScale().z = 1.1f;
        break;
    }
    // mi.transform.translate(0, 100, 0);
}
 
开发者ID:mbrlabs,项目名称:Mundus,代码行数:25,代码来源:RotateTool.java

示例10: ScaleTool

import com.badlogic.gdx.graphics.g3d.Material; //导入依赖的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 };
}
 
开发者ID:mbrlabs,项目名称:Mundus,代码行数:25,代码来源:ScaleTool.java

示例11: buildPlaneModel

import com.badlogic.gdx.graphics.g3d.Material; //导入依赖的package包/类
public static Model buildPlaneModel(final float width,
									final float height, final Material material, final float u1,
									final float v1, final float u2, final float v2) {

	ModelBuilder modelBuilder = new ModelBuilder();
	modelBuilder.begin();
	MeshPartBuilder bPartBuilder = modelBuilder.part("rect", GL20.GL_TRIANGLES,
			VertexAttributes.Usage.Position
					| VertexAttributes.Usage.Normal
					| VertexAttributes.Usage.TextureCoordinates, material);
	bPartBuilder.setUVRange(u1, v1, u2, v2);
	bPartBuilder.rect(-(width * 0.5f), -(height * 0.5f), 0, (width * 0.5f),
			-(height * 0.5f), 0, (width * 0.5f), (height * 0.5f), 0,
			-(width * 0.5f), (height * 0.5f), 0, 0, 0, -1);

	return (modelBuilder.end());
}
 
开发者ID:jsjolund,项目名称:GdxDemo3D,代码行数:18,代码来源:ModelFactory.java

示例12: MaterialInterpreter

import com.badlogic.gdx.graphics.g3d.Material; //导入依赖的package包/类
public MaterialInterpreter() {

		waterColor = new Color(0.13f, 0.05f, 0.8f, 1);
		waterMaterial = new Material(
				ColorAttribute.createDiffuse(waterColor),
				ColorAttribute.createSpecular(1, 1, 1, 1),
				FloatAttribute.createShininess(8f));

		sandColor = new Color(0.9f, 0.733f, 0.58f, 1);
		sandMaterial = new Material(ColorAttribute.createDiffuse(sandColor),
				ColorAttribute.createSpecular(1, 1, 1, 1),
				FloatAttribute.createShininess(8f));

		grassColor = new Color(0f, 1f, 0f, 1f);
		grassMaterial = new Material(ColorAttribute.createDiffuse(grassColor),
				ColorAttribute.createSpecular(1, 1, 1, 1),
				FloatAttribute.createShininess(8f));

	}
 
开发者ID:aphex-,项目名称:Alien-Ark,代码行数:20,代码来源:MaterialInterpreter.java

示例13: createInfiniteWaterPart

import com.badlogic.gdx.graphics.g3d.Material; //导入依赖的package包/类
public static Model createInfiniteWaterPart(TypeInterpreter interpreter, int landscapeIndex, PlanetConfig planetConfig) {
	ModelBuilder modelBuilder = new ModelBuilder();
	MeshBuilder builder = new MeshBuilder();
	float waterHeight = interpreter.it.get(landscapeIndex).endValue;
	builder.begin(PlanetPart.VERTEX_ATTRIBUTES, GL20.GL_TRIANGLES);
	infiniteWaterHeight = waterHeight * planetConfig.landscapeHeight - 1;
	Vector3 corner01 = new Vector3(-INFINITE_WATER_SIZE, -INFINITE_WATER_SIZE, infiniteWaterHeight);
	Vector3 corner02 = new Vector3(INFINITE_WATER_SIZE, -INFINITE_WATER_SIZE, infiniteWaterHeight);
	Vector3 corner03 = new Vector3(INFINITE_WATER_SIZE, INFINITE_WATER_SIZE, infiniteWaterHeight);
	Vector3 corner04 = new Vector3(-INFINITE_WATER_SIZE, INFINITE_WATER_SIZE, infiniteWaterHeight);
	builder.rect(corner01, corner02, corner03, corner04, new Vector3(0, 0, 1));
	Material waterMaterial = planetConfig.layerConfigs.get(landscapeIndex).material;
	Mesh mesh = builder.end();
	modelBuilder.begin();
	modelBuilder.part(PlanetPart.LANDSCAPE_PART_NAME + landscapeIndex, mesh, GL20.GL_TRIANGLES, waterMaterial);
	return modelBuilder.end();
}
 
开发者ID:aphex-,项目名称:Alien-Ark,代码行数:18,代码来源:ControllerPlanet.java

示例14: createWaterPart

import com.badlogic.gdx.graphics.g3d.Material; //导入依赖的package包/类
/**
 * Creates a water plane.
 * @param chunk The chunk.
 */
private void createWaterPart(Chunk chunk, int landscapeIndex) {
	MeshBuilder builder = meshBuilders.get(landscapeIndex);
	float WATER_HEIGHT = interpreter.it.get(landscapeIndex).endValue;
	builder.begin(VERTEX_ATTRIBUTES, GL20.GL_TRIANGLES);
	float z = WATER_HEIGHT * planetConfig.landscapeHeight;
	float width = chunk.getWidth() * tileSize;
	float height = chunk.getHeight() * tileSize;

	Vector3 corner01 = new Vector3(0f, 0f, z);
	Vector3 corner02 = new Vector3(width, 0f, z);
	Vector3 corner03 = new Vector3(width, height, z);
	Vector3 corner04 = new Vector3(0f, height, z);

	builder.rect(corner01, corner02, corner03, corner04, new Vector3(0, 0, 1));
	Material waterMaterial = planetConfig.layerConfigs.get(landscapeIndex).material;
	Mesh mesh = builder.end();
	modelBuilder.node().id = LANDSCAPE_NODE_NAME + landscapeIndex;
	modelBuilder.part(LANDSCAPE_PART_NAME + landscapeIndex, mesh, GL20.GL_TRIANGLES, waterMaterial);
}
 
开发者ID:aphex-,项目名称:Alien-Ark,代码行数:24,代码来源:PlanetPart.java

示例15: buildFaceForChunkWithAssembler

import com.badlogic.gdx.graphics.g3d.Material; //导入依赖的package包/类
private VoxelChunkRenderable buildFaceForChunkWithAssembler(Chunk chunk, VoxelsAssembler assembler, boolean haveTransparency) {
  if (!assembler.isEmpty()) {
    VoxelChunkRenderable renderable   = new VoxelChunkRenderable();
    renderable.primitiveType          = GL30.GL_TRIANGLES;

    if (ForgE.config.getBool(Config.Key.GenerateWireframe))
      renderable.wireframe           = assembler.wireframe();
    renderable.triangleCount         = assembler.getTriangleCount();
    renderable.meshFactory           = assembler.meshFactory(MeshVertexInfo.voxelTypes());

    renderable.worldTransform.idt();
    renderable.material = new Material(new SolidTerrainAttribute());
    if (haveTransparency) {
      renderable.material.set(new BlendingAttribute(true,1f));
    }

    chunk.addFace(renderable);
    return renderable;
  } else {
    return null;
  }
}
 
开发者ID:macbury,项目名称:ForgE,代码行数:23,代码来源:TerrainBuilder.java


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