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


Java ColorAttribute类代码示例

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


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

示例1: GameScreen

import com.badlogic.gdx.graphics.g3d.attributes.ColorAttribute; //导入依赖的package包/类
public GameScreen(){
	spriteBatch = new SpriteBatch(); // buffer ok
	texture     = new Texture(Gdx.files.internal("bg/gameBG.jpg"));
	viewMatrix  = new Matrix4();  // matriz de visualização
	tranMatrix  = new Matrix4();  // matriz de escala
	
	// camera
	camera = new PerspectiveCamera(67.0f, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
	camera.near = 0.1f;
	camera.far  = 1000f;
	camera.position.set(0, 5, 10);
	camera.lookAt(0, 5, 0);
	camera.update();
	
	// ambiente
	environment = new Environment();
	environment.set(new ColorAttribute(ColorAttribute.AmbientLight, 1,1,1,1));
	
	// renderizador
	modelBatch = new ModelBatch();
	p1 = new Player(1);
	p2 = new Player(2);
	
	
	
}
 
开发者ID:fmassetto,项目名称:StreetCampusFighter,代码行数:27,代码来源:GameScreen.java

示例2: addBackground

import com.badlogic.gdx.graphics.g3d.attributes.ColorAttribute; //导入依赖的package包/类
private void addBackground(){
        decalBackground = Decal.newDecal(new TextureRegion(managerAssets.getAssetsCrafting().getTexture(NameFiles.backgroundCrafting)));
        decalBackground.setDimensions(100,200);
        decalBackground.setPosition(0,0,0);
        environment = new Environment();
//        environment.set(new ColorAttribute(ColorAttribute.AmbientLight, 1f, 1f, 1f, 1f));
        environment.set(new ColorAttribute(ColorAttribute.Diffuse));
        environment.set(new ColorAttribute(ColorAttribute.Specular));
        environment.set(new ColorAttribute(ColorAttribute.Reflection));
        environment.add(new DirectionalLight().set(0.51f, 0.5f, 0.5f, 0f, -2f, -30f));
        Model model = managerAssets.getAssetsRaider().getModel(NameFiles.raiderFull);
        model.nodes.get(2).translation.set(-12,28.6f,-5.5f);
//        model.nodes.get(0).translation.set(0,28f,29.2f);
//        model.nodes.get(2).translation.set(0,13,-1);
        instance = new ModelInstance(model);
        instance.transform.trn(0,-20,25).rotate(0,1,0,-25);
        instance.transform.scale(1.5f,1.5f,1.5f);
    }
 
开发者ID:TudorRosca,项目名称:enklave,代码行数:19,代码来源:ScreenRaider.java

示例3: Renderer

import com.badlogic.gdx.graphics.g3d.attributes.ColorAttribute; //导入依赖的package包/类
public Renderer(VuforiaRenderer arRenderer) {

        lights = new Environment();
        lights.set(new ColorAttribute(ColorAttribute.AmbientLight, Color.WHITE));

        camera = new PerspectiveCamera(60, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
        camera.near = 1.0F;
        camera.far = 1000.0F;
        //set camera into "Vuforia - style" direction
        camera.position.set(new Vector3(0,0,0));
        camera.lookAt(new Vector3(0,0,1));

        this.vuforiaRenderer = arRenderer;

        modelBatch = new ModelBatch();
    }
 
开发者ID:daemontus,项目名称:VuforiaLibGDX,代码行数:17,代码来源:Renderer.java

示例4: GameModel

import com.badlogic.gdx.graphics.g3d.attributes.ColorAttribute; //导入依赖的package包/类
public GameModel(PerspectiveCamera cam, boolean [][][] collision){
    //setup the model instances
    parts = new Array<ModelInstance>();
    frame = new Array<ModelInstance>();
    shadow = new Array<ModelInstance>();

    //setup environment
    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));

    //setup collision matrix
    matrix = collision;

    //setup camera
    camera = cam;



}
 
开发者ID:msk610,项目名称:Chemtris,代码行数:21,代码来源:GameModel.java

示例5: SimulationRunner

import com.badlogic.gdx.graphics.g3d.attributes.ColorAttribute; //导入依赖的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

示例6: create

import com.badlogic.gdx.graphics.g3d.attributes.ColorAttribute; //导入依赖的package包/类
@Override
public void create () {
	super.create();

	final Model carModel = objLoader.loadModel(Gdx.files.internal("data/car.obj"));
	disposables.add(carModel);
	carModel.materials.get(0).clear();
	carModel.materials.get(0).set(ColorAttribute.createDiffuse(Color.WHITE), ColorAttribute.createSpecular(Color.WHITE));
	world.addConstructor("car", new BulletConstructor(carModel, 5f, createConvexHullShape(carModel, true)));

	// Create the entities
	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);

	for (float y = 10f; y < 50f; y += 5f)
		world.add("car", -2f + (float)Math.random() * 4f, y, -2f + (float)Math.random() * 4f).setColor(
			0.25f + 0.5f * (float)Math.random(), 0.25f + 0.5f * (float)Math.random(), 0.25f + 0.5f * (float)Math.random(), 1f);
	distance = new ConvexHullDistance();
	shapeRenderer = new ShapeRenderer();
}
 
开发者ID:Matsemann,项目名称:eamaster,代码行数:21,代码来源:ConvexHullDistanceTest.java

示例7: create

import com.badlogic.gdx.graphics.g3d.attributes.ColorAttribute; //导入依赖的package包/类
@Override
public void create () {
	super.create();

	final Model carModel = objLoader.loadModel(Gdx.files.internal("data/car.obj"));
	disposables.add(carModel);
	carModel.materials.get(0).clear();
	carModel.materials.get(0).set(ColorAttribute.createDiffuse(Color.WHITE), ColorAttribute.createSpecular(Color.WHITE));
	world.addConstructor("car", new BulletConstructor(carModel, 5f, createConvexHullShape(carModel, true)));

	// Create the entities
	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);

	for (float y = 10f; y < 50f; y += 5f)
		world.add("car", -2f + (float)Math.random() * 4f, y, -2f + (float)Math.random() * 4f).setColor(
			0.25f + 0.5f * (float)Math.random(), 0.25f + 0.5f * (float)Math.random(), 0.25f + 0.5f * (float)Math.random(), 1f);
}
 
开发者ID:Matsemann,项目名称:eamaster,代码行数:19,代码来源:ConvexHullTest.java

示例8: create

import com.badlogic.gdx.graphics.g3d.attributes.ColorAttribute; //导入依赖的package包/类
@Override
public void create () {
	super.create();
	
	final Model chassisModel = objLoader.loadModel(Gdx.files.internal("data/car.obj"));
	disposables.add(chassisModel);
	chassisModel.materials.get(0).clear();
	chassisModel.materials.get(0).set(ColorAttribute.createDiffuse(Color.RED), ColorAttribute.createSpecular(Color.WHITE));
	
	chassisVertexArray = new btTriangleIndexVertexArray(chassisModel.meshParts);
	btGImpactMeshShape chassisShape = new btGImpactMeshShape(chassisVertexArray);
	chassisShape.setLocalScaling(new Vector3(1f, 1f, 1f));
	chassisShape.setMargin(0f);
	chassisShape.updateBound();
	
	world.addConstructor("chassis", new BulletConstructor(chassisModel, 1f, chassisShape));
	
	(ground = 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);
	
	world.add("chassis", 3f, 10f, 3f);
	world.add("chassis", 4f, 5f, 3f);
	world.add("chassis", 4f, 1f, 5f);

       btGImpactCollisionAlgorithm.registerAlgorithm(world.dispatcher);
}
 
开发者ID:Matsemann,项目名称:eamaster,代码行数:27,代码来源:GimpactTest.java

示例9: setEffect

import com.badlogic.gdx.graphics.g3d.attributes.ColorAttribute; //导入依赖的package包/类
/**
 * Initializes a highlighter effect, will be processed in
 * {@link GridSpaceHighlighter#update(float)}
 * 
 * @param state
 *            effect to be initialized
 */
public void setEffect(GridState state) {

	mGridState = state;

	switch (state) {
	case FADE_GREEN:
		mModelInstance.materials.get(0).set(ColorAttribute.createDiffuse(0.5f, 1.0f, 0.5f, 1.0f));
		mAlphaBlend.opacity = 0.8f;
		break;
	case FADE_RED:
	case ILLEGAL_HOVER:
		mModelInstance.materials.get(0).set(ColorAttribute.createDiffuse(Color.RED));
		mAlphaBlend.opacity = 0.8f;
		break;
	case LEGAL_HOVER:
		mModelInstance.materials.get(0).set(ColorAttribute.createDiffuse(0.5f, 1.0f, 0.5f, 1.0f));
		mAlphaBlend.opacity = 0.8f;
		break;
	case NONE:
		mAlphaBlend.opacity = 0.0f;
	default:
		break;
	}
}
 
开发者ID:nkarasch,项目名称:ChessGDX,代码行数:32,代码来源:GridSpaceHighlighter.java

示例10: RotateHandle

import com.badlogic.gdx.graphics.g3d.attributes.ColorAttribute; //导入依赖的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

示例11: ScaleTool

import com.badlogic.gdx.graphics.g3d.attributes.ColorAttribute; //导入依赖的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

示例12: setEnvironmentLights

import com.badlogic.gdx.graphics.g3d.attributes.ColorAttribute; //导入依赖的package包/类
public void setEnvironmentLights(Array<BaseLight<?>> lights, Vector3 sunDirection) {
	environment = new Environment();
	environment.add((shadowLight = new DirectionalShadowLight(
			GameSettings.SHADOW_MAP_WIDTH,
			GameSettings.SHADOW_MAP_HEIGHT,
			GameSettings.SHADOW_VIEWPORT_WIDTH,
			GameSettings.SHADOW_VIEWPORT_HEIGHT,
			GameSettings.SHADOW_NEAR,
			GameSettings.SHADOW_FAR))
			.set(GameSettings.SHADOW_INTENSITY,
					GameSettings.SHADOW_INTENSITY,
					GameSettings.SHADOW_INTENSITY,
					sunDirection.nor()));
	environment.shadowMap = shadowLight;

	float ambientLight = GameSettings.SCENE_AMBIENT_LIGHT;
	environment.set(new ColorAttribute(ColorAttribute.AmbientLight, ambientLight, ambientLight, ambientLight, 1));
	for (BaseLight<?> light : lights) {
		environment.add(light);
	}
}
 
开发者ID:jsjolund,项目名称:GdxDemo3D,代码行数:22,代码来源:GameRenderer.java

示例13: MaterialInterpreter

import com.badlogic.gdx.graphics.g3d.attributes.ColorAttribute; //导入依赖的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

示例14: set

import com.badlogic.gdx.graphics.g3d.attributes.ColorAttribute; //导入依赖的package包/类
@Override
public void set (BaseShader shader, int inputID, Renderable renderable, Attributes combinedAttributes) {
	if (renderable.environment == null)
		shader.program.setUniform3fv(shader.loc(inputID), ones, 0, ones.length);
	else {
		renderable.worldTransform.getTranslation(tmpV1);
		if (renderable.environment.has(ColorAttribute.AmbientLight))
			cacheAmbientCubemap.set(((ColorAttribute)renderable.environment.get(ColorAttribute.AmbientLight)).color);

		for (int i = dirLightsOffset; i < renderable.environment.directionalLights.size; i++)
			cacheAmbientCubemap.add(renderable.environment.directionalLights.get(i).color,
				renderable.environment.directionalLights.get(i).direction);

		for (int i = pointLightsOffset; i < renderable.environment.pointLights.size; i++)
			cacheAmbientCubemap.add(renderable.environment.pointLights.get(i).color,
				renderable.environment.pointLights.get(i).position, tmpV1,
				renderable.environment.pointLights.get(i).intensity);

		cacheAmbientCubemap.clamp();

		shader.program.setUniform3fv(shader.loc(inputID), cacheAmbientCubemap.data, 0, cacheAmbientCubemap.data.length);
	}
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:24,代码来源:DefaultShader.java

示例15: create

import com.badlogic.gdx.graphics.g3d.attributes.ColorAttribute; //导入依赖的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)));
	}
 
开发者ID:if1live,项目名称:amatsukaze,代码行数:26,代码来源:Basic3DTest.java


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