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


Java Decal.setPosition方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: create

import com.badlogic.gdx.graphics.g3d.decals.Decal; //导入方法依赖的package包/类
public void create () {
	float width = Gdx.graphics.getWidth();
	float height = Gdx.graphics.getHeight();

	camera = new PerspectiveCamera(45, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
	camera.near = 1;
	camera.far = 300;
	camera.position.set(0, 0, 5);
	controller = new PerspectiveCamController(camera);

	Gdx.input.setInputProcessor(controller);
	batch = new DecalBatch(new CameraGroupStrategy(camera));

	TextureRegion[] textures = {new TextureRegion(new Texture(Gdx.files.internal("data/egg.png"))),
		new TextureRegion(new Texture(Gdx.files.internal("data/wheel.png"))),
		new TextureRegion(new Texture(Gdx.files.internal("data/badlogic.jpg")))};

	Decal decal = Decal.newDecal(1, 1, textures[1]);
	decal.setPosition(0, 0, 0);
	decals.add(decal);

	decal = Decal.newDecal(1, 1, textures[0], true);
	decal.setPosition(0.5f, 0.5f, 1);
	decals.add(decal);

	decal = Decal.newDecal(1, 1, textures[0], true);
	decal.setPosition(1, 1, -1);
	decals.add(decal);

	decal = Decal.newDecal(1, 1, textures[2]);
	decal.setPosition(1.5f, 1.5f, -2);
	decals.add(decal);

	decal = Decal.newDecal(1, 1, textures[1]);
	decal.setPosition(2, 2, -1.5f);
	decals.add(decal);
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:38,代码来源:SimpleDecalTest.java

示例6: makeDecal

import com.badlogic.gdx.graphics.g3d.decals.Decal; //导入方法依赖的package包/类
private Decal makeDecal () {
	Decal sprite = null;
	switch (idx % 2) {
	case 0:
		sprite = Decal.newDecal(new TextureRegion(egg), willItBlend_that_is_the_question);
		break;
	case 1:
		sprite = Decal.newDecal(new TextureRegion(wheel));
		break;
	}
	sprite.setPosition(-w / 2 + (float)Math.random() * w, h / 2 - (float)Math.random() * h, (float)-Math.random() * 10);
	idx++;
	return sprite;
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:15,代码来源:DecalTest.java

示例7: CharacterDisplayable

import com.badlogic.gdx.graphics.g3d.decals.Decal; //导入方法依赖的package包/类
public CharacterDisplayable(IntVector3 logicalPosition,
                            String animationSetName,
                            TextureRegion shadowTexture) {
  super(logicalPosition.toVector3().add(DEFAULT_DISPLACEMENT));

  animations = new AnimationSet(animationSetName);

  AnimatedDecal decal
      = AnimatedDecal.newAnimatedDecal(DEFAULT_DIMENSIONS.x,
                                       DEFAULT_DIMENSIONS.y,
                                       animations.getDefault(),
                                       true);

  decal.setKeepSize(true);
  decal.setPosition(position);
  decal.rotateX(DEFAULT_ROTATION);

  setMainDecal(decal);

  Decal shadow = new Decal();

  shadow.setPosition(position);
  shadow.translate(DEFAULT_SHADOW_DISPLACEMENT);
  shadow.setDimensions(DEFAULT_SHADOW_DIMENSIONS.x,
                       DEFAULT_SHADOW_DIMENSIONS.y);
  shadow.setColor(1, 1, 1, .35f);
  shadow.setTextureRegion(shadowTexture);
  shadow.setBlending(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);

  setShadowDecal(shadow);
}
 
开发者ID:fauu,项目名称:HelixEngine,代码行数:32,代码来源:CharacterDisplayable.java

示例8: draw

import com.badlogic.gdx.graphics.g3d.decals.Decal; //导入方法依赖的package包/类
public void draw(Type type, Texture texture, float x, float y, float z, float width, float height, Color tint) {
	Decal sprite = nextUsable();
	setTexture(sprite, texture);
	sprite.setWidth(width);
	sprite.setHeight(height);
	sprite.setPosition(x, y, z);
	setTintAndBlending(sprite, tint);
	setRotation(sprite, type);
}
 
开发者ID:gered,项目名称:gdx-toolbox,代码行数:10,代码来源:BillboardSpriteBatch.java

示例9: inserted

import com.badlogic.gdx.graphics.g3d.decals.Decal; //导入方法依赖的package包/类
@Override
public void inserted(int entityId, RenderSystem renderSystem) {
    if (cameraBar == null) {
        cameraBar = new OrthographicCamera(renderSystem.getLevelAssets().health_bar_gradient.getWidth(),
                renderSystem.getLevelAssets().health_bar_gradient.getHeight());
        uiCamera = new OrthographicCamera(UI_WIDTH, UI_HEIGHT);
    }

    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<>(entry.getValue().frameDuration, new Array<>(frames), entry.getValue().playMode));
            render.stateTimes.put(entry.getKey(), 0f);
        }
    }
    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);

    FrameBuffer buffer = new FrameBuffer(Pixmap.Format.RGBA8888, UI_WIDTH, UI_HEIGHT, false);
    Assets.LevelAssets levelAssets = renderSystem.getLevelAssets();
    FrameBuffer healthBuffer = new FrameBuffer(Pixmap.Format.RGBA8888, levelAssets.health_bar_gradient.getWidth(), levelAssets.health_bar_gradient.getHeight(), false);
    TextureRegion healthBar = new TextureRegion(healthBuffer.getColorBufferTexture());
    healthBar.flip(false, true);
    FrameBuffer resourceBuffer = new FrameBuffer(Pixmap.Format.RGBA8888, levelAssets.health_bar_gradient.getWidth(), levelAssets.health_bar_gradient.getHeight(), false);
    TextureRegion resourceBar = new TextureRegion(resourceBuffer.getColorBufferTexture());
    resourceBar.flip(false, true);

    healthBars.put(entityId, healthBar);
    resourceBars.put(entityId, resourceBar);

    healthBuffers.put(entityId, healthBuffer);
    resourceBuffers.put(entityId, resourceBuffer);

    buffer.getColorBufferTexture().setFilter(Texture.TextureFilter.Nearest, Texture.TextureFilter.Nearest);
    renderSystem.getBuffers().put(entityId, buffer);

    TextureRegion uiTextureRegion = new TextureRegion(buffer.getColorBufferTexture());
    uiTextureRegion.flip(false, true);
    Decal uiDecal = Decal.newDecal(1.8f, 1f, uiTextureRegion, true);
    uiDecal.setPosition(position.position.x, position.position.y, 1);
    renderSystem.getUiMap().put(entityId, uiDecal);
}
 
开发者ID:EtherWorks,项目名称:arcadelegends-gg,代码行数:58,代码来源:CharacterRenderer.java

示例10: process

import com.badlogic.gdx.graphics.g3d.decals.Decal; //导入方法依赖的package包/类
/**
 * Updates the {@link gg.al.character.Character} {@link Decal}, and uses the currently set animation from the {@link RenderComponent}.<br>
 * Also redraws the health and resource bars, and updates their position accordingly.
 *
 * @param entityId     the {@link gg.al.character.Character} entity 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);
    StatComponent stats = renderSystem.getMapperStats().get(entityId);

    CharacterComponent character = renderSystem.getMapperCharacterComponent().get(entityId);
    Decal decal = renderSystem.getDecalMap().get(entityId);
    float stateTime = renderSystem.getStateTime();

    if (character != null && render.isInState(ATTACK)) {
        stateTime = render.animations.get(PlayerRenderState.ATTACK.name()).getAnimationDuration() * character.getRenderMultiplicator();
    } else if (character != null && render.isInAnyState(
            ABILITY_1, ABILITY_2, ABILITY_3, ABILITY_4, TRAIT
    )) {
        stateTime = render.stateTimes.get(render.renderState);
        stateTime += renderSystem.getDelta();
        if (render.animations.get(render.renderState).isAnimationFinished(stateTime)) {
            render.stateTimes.put(render.renderState, 0f);
            render.setRenderState(IDLE);
        } else
            render.stateTimes.put(render.renderState, stateTime);
    }
    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());

    SpriteBatch shaderBatch = renderSystem.getShaderBatch();
    ShaderProgram shader = renderSystem.getGradientShader();
    drawToBuffer(healthBuffers.get(entityId), healthBarColor, renderSystem.getLevelAssets().health_bar_gradient,
            stats.getRuntimeStat(StatComponent.RuntimeStat.health) / stats.getCurrentStat(StatComponent.BaseStat.maxHealth),
            shaderBatch, shader, cameraBar.combined);
    drawToBuffer(resourceBuffers.get(entityId), resourceBarColor, renderSystem.getLevelAssets().health_bar_gradient,
            stats.getRuntimeStat(StatComponent.RuntimeStat.resource) / stats.getCurrentStat(StatComponent.BaseStat.maxResource),
            shaderBatch, shader, cameraBar.combined);

    FrameBuffer buffer = renderSystem.getBuffers().get(entityId);
    buffer.begin();
    AL.graphics.getGL20().glClearColor(0, 0, 0, 0);
    AL.graphics.getGL20().glClear(GL20.GL_COLOR_BUFFER_BIT);
    renderSystem.getSpriteBatch().setProjectionMatrix(uiCamera.combined);
    renderSystem.getSpriteBatch().begin();
    //renderSystem.getFont().draw(renderSystem.getSpriteBatch(), String.format("%1.0f", stats.getRuntimeStat(StatComponent.RuntimeStat.actionPoints)), 0, buffer.getHeight());

    renderSystem.getSpriteBatch().draw(resourceBars.get(entityId), 50 - UI_WIDTH / 2, -UI_HEIGHT / 2 + RESOURCE_OFFSET, 175, 75 / 2);
    renderSystem.getSpriteBatch().draw(healthBars.get(entityId), 50 - UI_WIDTH / 2, -30, 200, 100 / 2);
    renderSystem.getFont().draw(renderSystem.getSpriteBatch(), String.format("%1.0f", stats.getRuntimeStat(StatComponent.RuntimeStat.actionPoints)),
            -UI_WIDTH / 2 - 4, 20);
    renderSystem.getSpriteBatch().end();
    buffer.end();

    Decal uiDecal = renderSystem.getUiMap().get(entityId);
    uiDecal.setPosition(physic.body.getPosition().x, physic.body.getPosition().y + decal.getHeight() / 2, uiDecal.getZ());
}
 
开发者ID:EtherWorks,项目名称:arcadelegends-gg,代码行数:67,代码来源:CharacterRenderer.java


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