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


Java Decal类代码示例

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


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

示例1: addBackground

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

示例2: ScreenCrafting

import com.badlogic.gdx.graphics.g3d.decals.Decal; //导入依赖的package包/类
public ScreenCrafting(GameManager game) {
    this.gameManager = game;
    informationProfile = InformationProfile.getInstance();
    managerAssets = ManagerAssets.getInstance();
    queue = QueueBuildCraft.getInstance();
    intances = new Array<ModelInstance>();
    camera = new PerspectiveCamera(45,WIDTH,HEIGHT);
    camera.position.set(0,0,1020);
    camera.lookAt(0, 0, 0);
    camera.near = 1;
    camera.far = 1500;
    camera.update();
    nameRes.add("SCRAP");
    nameRes.add("BRICK");
    nameRes.add("CELL");
    arrayDecal = new Array<Decal>();
}
 
开发者ID:TudorRosca,项目名称:enklave,代码行数:18,代码来源:ScreenCrafting.java

示例3: inserted

import com.badlogic.gdx.graphics.g3d.decals.Decal; //导入依赖的package包/类
@Override
public void inserted(int entityId, RenderSystem renderSystem) {
    RenderComponent render = renderSystem.getMapperRender().get(entityId);
    PositionComponent position = renderSystem.getMapperPosition().get(entityId);
    if (render.animations.size == 0) {
        for (Map.Entry<String, RenderComponent.RenderTemplate.AnimationTemplate> entry : render.renderTemplate.animationTemplates.entrySet()) {
            TextureRegion texture = renderSystem.getLevelAssets().get(entry.getValue().texture);

            TextureRegion[][] tmp = texture.split(
                    +texture.getRegionWidth() / entry.getValue().frameColumns,
                    +texture.getRegionHeight() / entry.getValue().frameRows);
            TextureRegion[] frames = new TextureRegion[entry.getValue().frameColumns * entry.getValue().frameRows];
            int index = 0;
            for (int i = 0; i < entry.getValue().frameRows; i++) {
                for (int j = 0; j < entry.getValue().frameColumns; j++) {
                    frames[index++] = tmp[i][j];
                }
            }
            render.animations.put(entry.getKey(), new Animation<TextureRegion>(entry.getValue().frameDuration, new Array<>(frames), Animation.PlayMode.LOOP));
        }
    }
    Decal decal = Decal.newDecal(render.width, render.height, render.getCurrentKeyFrame(renderSystem.getStateTime()), render.transparent);
    decal.rotateX(renderSystem.getWorldDegree());
    decal.setPosition(position.position.x, position.position.y, 0);
    renderSystem.getDecalMap().put(entityId, decal);
}
 
开发者ID:EtherWorks,项目名称:arcadelegends-gg,代码行数:27,代码来源:BulletRenderer.java

示例4: process

import com.badlogic.gdx.graphics.g3d.decals.Decal; //导入依赖的package包/类
/**
 * Sets the current position of the rendered {@link Decal}, and the rotation given by the bullet direction.
 *
 * @param entityId     the bullet id
 * @param renderSystem the delegating {@link RenderSystem}
 */
@Override
public void process(int entityId, RenderSystem renderSystem) {
    PhysicComponent physic = renderSystem.getMapperPhysic().get(entityId);
    RenderComponent render = renderSystem.getMapperRender().get(entityId);


    float deg = (float) (Math.atan2(physic.body.getLinearVelocity().y, physic.body.getLinearVelocity().x) * 180.0 / Math.PI);
    Decal decal = renderSystem.getDecalMap().get(entityId);
    decal.setRotationZ(deg);
    float stateTime = renderSystem.getStateTime();
    TextureRegion region = render.getCurrentKeyFrame(stateTime);
    region.flip(region.isFlipX() ^ render.flipX, region.isFlipY() ^ render.flipY);
    decal.setTextureRegion(region);
    RenderComponent.RenderTemplate.AnimationTemplate template = render.getCurrentAnimation();
    decal.setWidth(template.width);
    decal.setHeight(template.height);
    decal.setPosition(physic.body.getPosition().x, physic.body.getPosition().y, decal.getZ());
}
 
开发者ID:EtherWorks,项目名称:arcadelegends-gg,代码行数:25,代码来源:BulletRenderer.java

示例5: ParticleGroupStrategy

import com.badlogic.gdx.graphics.g3d.decals.Decal; //导入依赖的package包/类
public ParticleGroupStrategy(final Camera camera) {
    this.camera = camera;

    cameraSorter = new Comparator<Decal>() {
        @Override
        public int compare (Decal o1, Decal o2) {
            return (int)Math.signum(((DecalPlus)o2).cameraDistance - ((DecalPlus)o1).cameraDistance);
        }
    };

    billboardCameraSorter = new Comparator<BillboardDecal>() {
        @Override
        public int compare (BillboardDecal o1, BillboardDecal o2) {
            return (int)Math.signum(o2.floatValue - o1.floatValue);
        }
    };

    loadShaders();
}
 
开发者ID:CypherCove,项目名称:DoubleHelix,代码行数:20,代码来源:ParticleGroupStrategy.java

示例6: LayeredEntity

import com.badlogic.gdx.graphics.g3d.decals.Decal; //导入依赖的package包/类
public LayeredEntity(float x, float y, float z, String texturePath, int numberOfLayers){
	setPosition(x,y,z);
	this.numberOfLayers = numberOfLayers;
	
	tag = "";
	
	decalList = new ArrayList<Decal>();
	Texture t = MyGdxGame.assetManager.get(texturePath, Texture.class);
	width = t.getWidth() / numberOfLayers;
	depth = t.getHeight();
	height = numberOfLayers;
	TextureRegion tr = new TextureRegion(t);
	for(int i = 0; i < numberOfLayers; i++){
		tr.setRegion(i * width, 0, width, depth);
		Decal decal = Decal.newDecal(tr, true);
		decal.setPosition(x, y + i * LAYER_SIZE, z);
		decal.rotateX(-90);
		decalList.add(decal);
	}
	velocity = new Vector3();
	maxVelocity = new Vector3();
	drag = new Vector3();
	
}
 
开发者ID:MisterYO1122,项目名称:utilsLibGDX,代码行数:25,代码来源:LayeredEntity.java

示例7: render

import com.badlogic.gdx.graphics.g3d.decals.Decal; //导入依赖的package包/类
public void render () {
		Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);
		Gdx.gl.glEnable(GL20.GL_DEPTH_TEST);

		camera.update();
		for (int i = 0; i < decals.size; i++) {
			Decal decal = decals.get(i);
			if (billboard) {
				// billboarding for ortho cam :)
// dir.set(-camera.direction.x, -camera.direction.y, -camera.direction.z);
// decal.setRotation(dir, Vector3.Y);

				// billboarding for perspective cam
				decal.lookAt(camera.position, camera.up);
			}
			batch.add(decal);
		}
		batch.flush();
		logger.log();
	}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:21,代码来源:SimpleDecalTest.java

示例8: flush

import com.badlogic.gdx.graphics.g3d.decals.Decal; //导入依赖的package包/类
public void flush() {
	if (!hasBegun)
		throw new IllegalStateException("Cannot call outside of a begin/end block.");

	for (int i = 0; i < pointer; ++i) {
		Decal sprite = sprites.items[i];
		decalBatch.add(sprite);
	}
	decalBatch.flush();

	// don't want to hang on to Texture object references
	// TODO: is this overkill? does this really make a big difference?
	for (int i = 0; i < pointer; ++i)
		sprites.items[i].getTextureRegion().setTexture(null);

	pointer = 0;
}
 
开发者ID:gered,项目名称:gdx-toolbox,代码行数:18,代码来源:BillboardSpriteBatch.java

示例9: setRotation

import com.badlogic.gdx.graphics.g3d.decals.Decal; //导入依赖的package包/类
private void setRotation(Decal decal, Type type) {
	Camera camera = groupStrategy.getCamera();

	switch (type) {
		case Spherical:
			decal.lookAt(camera.position, Vector3.Y);
			break;

		case Cylindrical:
			temp.set(camera.position)
				.sub(decal.getPosition())
				.nor();
			temp.y = 0.0f;
			decal.setRotation(temp, Vector3.Y);
			break;

		case ScreenAligned:
			temp.set(camera.direction)
				.scl(-1.0f, -1.0f, -1.0f); // opposite direction to the camera facing dir (point directly out of the screen)
			decal.setRotation(temp, Vector3.Y);
			break;
	}
}
 
开发者ID:gered,项目名称:gdx-toolbox,代码行数:24,代码来源:BillboardSpriteBatch.java

示例10: addMap

import com.badlogic.gdx.graphics.g3d.decals.Decal; //导入依赖的package包/类
private void addMap() {
    MapPixmap imagesmap = MapPixmap.getInstance();
    extendmaps = new Decal[9];
    int k = 0;
    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
            extendmaps[k] = Decal.newDecal(new TextureRegion(new Texture(imagesmap.getImage(i, j))));
            extendmaps[k].setDimensions((HEIGHT*0.3125f), (HEIGHT*0.3125f));
            k++;
        }
    }
    repositionEnklave();
    queueDisplay = QueueDisplay.getInstance();
}
 
开发者ID:TudorRosca,项目名称:enklave,代码行数:15,代码来源:ScreenEnklave.java

示例11: addimagebg

import com.badlogic.gdx.graphics.g3d.decals.Decal; //导入依赖的package包/类
private void addimagebg(){
    MapPixmap imageBG = MapPixmap.getInstance();
    decalBackground = Decal.newDecal(new TextureRegion(new Texture(imageBG.getImage(1,1))));
    decalBackground.setPosition(0, 0, 0);
    decalBackground.setDimensions(Gdx.graphics.getHeight() * 0.3125f, Gdx.graphics.getHeight() * 0.3125f);
    decalBackground.setBlending(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
}
 
开发者ID:TudorRosca,项目名称:enklave,代码行数:8,代码来源:ScreenRooms.java

示例12: drawProfile

import com.badlogic.gdx.graphics.g3d.decals.Decal; //导入依赖的package包/类
private void drawProfile() {
    environment = new Environment();
    environment.set(new ColorAttribute(ColorAttribute.AmbientLight, 1f, 1f, 1f, 1f));
    environment.add(new DirectionalLight().set(1f, 1f, 1f, 1f, 1f, 1f));
    Model model = managerAssets.getAssetsProfile().getModel(NameFiles.profileObject);
    model.nodes.get(2).translation.set(0,-14.5f,9);
    instance = new ModelInstance(model);
    instance.transform.scale(0.2f,0.2f,0.2f);
    instance.transform.trn(0,-8f,27).rotate(0,1,0,55);
    decalBackground = Decal.newDecal(new TextureRegion(managerAssets.getAssetsCrafting().getTexture(NameFiles.backgroundCrafting)));
    decalBackground.setDimensions(75,150);
    decalBackground.setPosition(0,0,0);
    queueDisplay = QueueDisplay.getInstance();
}
 
开发者ID:TudorRosca,项目名称:enklave,代码行数:15,代码来源:ScreenProfile.java

示例13: drawmap

import com.badlogic.gdx.graphics.g3d.decals.Decal; //导入依赖的package包/类
private void drawmap() {
    MapPixmap imageBG = MapPixmap.getInstance();
    decalBackground = Decal.newDecal(new TextureRegion(new Texture(imageBG.getImage(1, 1))));
    decalBackground.setPosition(0, 0, 0);
    decalBackground.setDimensions(800, 800);
    decalBackground.setBlending(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
    Texture text = null;
    groupCenter = new Group();
    switch (InformationEnklave.getInstance().getFaction()){
        case 1:{
            text = managerAssets.getAssetsCombat().getTexture(NameFiles.enklavered);
            break;
        }
        case 2:{
            text = managerAssets.getAssetsCombat().getTexture(NameFiles.enklaveblue);
            break;
        }
        case 3:{
            text = managerAssets.getAssetsCombat().getTexture(NameFiles.enklavegreen);
            break;
        }
    }

    Vector2 crop = Scaling.fit.apply(text.getWidth(),text.getHeight(),WIDTH,HEIGHT);
    Image enklave = new Image(new TextureRegion(text));
    enklave.setSize(crop.x*0.6f,crop.y*0.6f);
    enklave.setPosition(WIDTH / 2 - enklave.getWidth() / 2, HEIGHT / 2 - enklave.getHeight() / 1.7F);
    groupCenter.addActor(enklave);
    labelDistance = new Label("Distance: ",new Label.LabelStyle(Font.getFont((int)(HEIGHT*0.025f)),Color.ORANGE));
    groupCenter.addActor(labelDistance);
}
 
开发者ID:TudorRosca,项目名称:enklave,代码行数:32,代码来源:ScreenCombat.java

示例14: ExtentMap

import com.badlogic.gdx.graphics.g3d.decals.Decal; //导入依赖的package包/类
private void ExtentMap() {
    int k =0;
    for(int i=0;i<3;i++) {
        for (int j = 0; j < 3; j++) {
            extendmaps[k] = Decal.newDecal(new TextureRegion(new Texture(matrixPixmap.getImage(i,j))));
            extendmaps[k].setPosition(pos[i][j].x, pos[i][j].y, 0);
            extendmaps[k].setDimensions(600, 600);
            k++;
        }
    }
}
 
开发者ID:TudorRosca,项目名称:enklave,代码行数:12,代码来源:MapsScreen.java

示例15: addDecal

import com.badlogic.gdx.graphics.g3d.decals.Decal; //导入依赖的package包/类
public void addDecal(TextureRegion texture, int w, int h, Vector3 worldPos, Vector3 normal, int life) {
    Decal decal = Decal.newDecal(w, h, texture, true);
    decal.value = life;
    decal.setScale(.1f);
    decal.setPosition(worldPos.add(normal.nor().scl(.001f)));
    decal.lookAt(worldPos.add(normal), Vector3.Zero);
    decals.add(decal);
    decalLife.put(decal, 0f);
}
 
开发者ID:ncguy2,项目名称:Argent,代码行数:10,代码来源:DecalManager.java


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