Java 类com.badlogic.gdx.graphics.g3d.decals.Decal 实例源码

项目:enklave    文件:ScreenRaider.java   
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);
    }
项目:enklave    文件:ScreenCrafting.java   
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>();
}
项目:arcadelegends-gg    文件:BulletRenderer.java   
@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);
}
项目:arcadelegends-gg    文件:BulletRenderer.java   
/**
 * 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());
}
项目:DoubleHelix    文件:ParticleGroupStrategy.java   
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();
}
项目:utilsLibGDX    文件:LayeredEntity.java   
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();

}
项目:libgdxcn    文件:SimpleDecalTest.java   
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();
    }
项目:gdx-toolbox    文件:BillboardSpriteBatch.java   
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;
}
项目:gdx-toolbox    文件:BillboardSpriteBatch.java   
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;
    }
}
项目:enklave    文件:ScreenEnklave.java   
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();
}
项目:enklave    文件:ScreenRooms.java   
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);
}
项目:enklave    文件:ScreenProfile.java   
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();
}
项目:enklave    文件:ScreenCombat.java   
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);
}
项目:enklave    文件:MapsScreen.java   
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++;
        }
    }
}
项目:Argent    文件:DecalManager.java   
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);
}
项目:DoubleHelix    文件:ParticleGroupStrategy.java   
@Override
public void beforeGroup (int group, Array<Decal> contents) {
    Gdx.gl.glEnable(GL20.GL_BLEND);
    Gdx.gl.glBlendFunc(GL20.GL_ONE, GL20.GL_ONE_MINUS_SRC_COLOR);
    contents.sort(cameraSorter);

    tmpColor.set(Settings.backgroundColor).lerp(Color.WHITE, WHITENESS);

    shader.begin();
    shader.setUniformMatrix("u_projTrans", camera.combined);
    shader.setUniformi("u_texture", 0);
    shader.setUniformf("u_baseColor", tmpColor);
}
项目:libgdxcn    文件:SimpleDecalTest.java   
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);
}
项目:libgdxcn    文件:DecalTest.java   
@Override
public void render () {
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);

    float elapsed = Gdx.graphics.getDeltaTime();
    float scale = timePassed > 0.5 ? 1 - timePassed / 2 : 0.5f + timePassed / 2;

    for (Decal decal : toRender) {
        decal.rotateZ(elapsed * 45);
        decal.setScale(scale);
        batch.add(decal);
    }
    batch.flush();

    timePassed += elapsed;
    frames++;
    if (timePassed > 1.0f) {
        System.out.println("DecalPerformanceTest2 fps: " + frames + " at spritecount: " + toRender.size());
        fps.addValue(frames);
        if (fps.hasEnoughData()) {
            float factor = fps.getMean() / (float)TARGET_FPS;
            int target = (int)(toRender.size() * factor);
            if (fps.getMean() > TARGET_FPS) {
                int start = toRender.size();
                for (int i = start; toRender.size() < target; i++) {
                    toRender.add(makeDecal());
                }
                fps.clear();
            } else {
                while (toRender.size() > target) {
                    toRender.removeLast();
                }
                fps.clear();
            }
        }
        timePassed = 0;
        frames = 0;
    }
}
项目:libgdxcn    文件:DecalTest.java   
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;
}
项目:HelixEngine    文件:CharacterDisplayable.java   
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);
}
项目:gaiasky    文件:SpacecraftGui.java   
/**
 * Constructs the interface
 */
public void doneLoading(AssetManager assetManager) {
    skin = GlobalResources.skin;

    aiTexture = assetManager.get("data/tex/attitudeindicator.png", Texture.class);
    aiTexture.setFilter(TextureFilter.Linear, TextureFilter.Linear);
    aiPointerTexture = assetManager.get("img/ai-pointer.png", Texture.class);
    aiPointerTexture.setFilter(TextureFilter.Linear, TextureFilter.Linear);

    aiVelTex = assetManager.get("img/ai-vel.png", Texture.class);
    aiVelTex.setFilter(TextureFilter.Linear, TextureFilter.Linear);
    aiAntivelTex = assetManager.get("img/ai-antivel.png", Texture.class);
    aiAntivelTex.setFilter(TextureFilter.Linear, TextureFilter.Linear);

    aiVelDec = Decal.newDecal(new TextureRegion(aiVelTex));
    aiAntivelDec = Decal.newDecal(new TextureRegion(aiAntivelTex));

    Material mat = new Material(new TextureAttribute(TextureAttribute.Diffuse, aiTexture), new ColorAttribute(ColorAttribute.Specular, 0.3f, 0.3f, 0.3f, 1f));
    aiModel = new ModelBuilder2().createSphere(1 * GlobalConf.SCALE_FACTOR, 30, 30, false, mat, Usage.Position | Usage.Normal | Usage.TextureCoordinates);
    aiTransform = new Matrix4();
    aiModelInstance = new ModelInstance(aiModel, aiTransform);
    aiViewport = new ExtendViewport(indicatorw, indicatorh, aiCam);

    buildGui();

    EventManager.instance.subscribe(this, Events.SPACECRAFT_STABILISE_CMD, Events.SPACECRAFT_STOP_CMD, Events.SPACECRAFT_INFO, Events.SPACECRAFT_NEAREST_INFO, Events.SPACECRAFT_THRUST_INFO);
    EventManager.instance.unsubscribe(this, Events.SPACECRAFT_LOADED);

}
项目:BotLogic    文件:SpritesManager.java   
public Decal sonarDecal() {
  Decal decal = Decal.newDecal(this.effectsAtlas.findRegion("sonar_ping"), true);
  decal.setWidth(1);
  decal.setHeight(1);
  decal.rotateX(90);
  return decal;
}
项目:gdx-toolbox    文件:AlphaTestCameraGroupStrategy.java   
public AlphaTestCameraGroupStrategy (final Camera camera) {
    this.camera = camera;
    createDefaultShader();

    final AlphaTestCameraGroupStrategy that = this;
    this.cameraSorter = new Comparator<Decal>() {
        @Override
        public int compare (Decal o1, Decal o2) {
            float dist1 = that.camera.position.dst(o1.getPosition());
            float dist2 = that.camera.position.dst(o2.getPosition());
            return (int)Math.signum(dist2 - dist1);
        }
    };
}
项目:gdx-toolbox    文件:BillboardSpriteBatch.java   
public BillboardSpriteBatch() {
    sprites = new Array<Decal>(true, CAPACITY_INCREMENT, Decal.class);
    pointer = 0;
    addNewSprites(CAPACITY_INCREMENT);

    hasBegun = false;
    groupStrategy = new AlphaTestCameraGroupStrategy(null);
    decalBatch = new DecalBatch(groupStrategy);
}
项目:gdx-toolbox    文件:BillboardSpriteBatch.java   
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);
}
项目:gdx-toolbox    文件:BillboardSpriteBatch.java   
public void draw(Type type, Texture texture, float x, float y, float z, float width, float height, float u, float v, float u2, float v2, Color tint) {
    Decal sprite = nextUsable();
    setTexture(sprite, texture, u, v, u2, v2);
    sprite.setWidth(width);
    sprite.setHeight(height);
    sprite.setPosition(x, y, z);
    setTintAndBlending(sprite, tint);
    setRotation(sprite, type);
}
项目:gdx-toolbox    文件:BillboardSpriteBatch.java   
public void draw(Type type, Texture texture, float x, float y, float z, float width, float height, int srcX, int srcY, int srcWidth, int srcHeight, Color tint) {
    Decal sprite = nextUsable();
    setTexture(sprite, texture, srcX, srcY, srcWidth, srcHeight);
    sprite.setWidth(width);
    sprite.setHeight(height);
    sprite.setPosition(x, y, z);
    setTintAndBlending(sprite, tint);
    setRotation(sprite, type);
}
项目:gdx-toolbox    文件:BillboardSpriteBatch.java   
public void draw(Type type, TextureRegion region, float x, float y, float z, float width, float height, Color tint) {
    Decal sprite = nextUsable();
    setTexture(sprite, region);
    sprite.setWidth(width);
    sprite.setHeight(height);
    sprite.setPosition(x, y, z);
    setTintAndBlending(sprite, tint);
    setRotation(sprite, type);
}
项目:gdx-toolbox    文件:BillboardSpriteBatch.java   
private void setTexture(Decal decal, TextureRegion srcRegion) {
    // we don't want to keep a reference to the source region object (or replace the TextureRegion object
    // reference on the Decal object with a different one) so that in flush() we can, without side-effect,
    // clear the Texture object reference

    TextureRegion dstRegion = decal.getTextureRegion();
    dstRegion.setRegion(srcRegion);
    decal.setTextureRegion(dstRegion);
}
项目:gdx-toolbox    文件:BillboardSpriteBatch.java   
private void setTintAndBlending(Decal decal, Color tint) {
    int srcFactor = DecalMaterial.NO_BLEND;
    int destFactor = DecalMaterial.NO_BLEND;

    if (tint.a > 0.0f && tint.a < 1.0f) {
        srcFactor = GL20.GL_SRC_ALPHA;
        destFactor = GL20.GL_ONE_MINUS_SRC_ALPHA;
    }

    decal.setColor(tint);
    decal.setBlending(srcFactor, destFactor);
}
项目:gdx-toolbox    文件:BillboardSpriteBatch.java   
private Decal nextUsable() {
    if (getRemainingSpace() == 0)
        increaseCapacity();

    Decal usable = sprites.items[pointer];
    pointer++;
    return usable;
}
项目:enklave    文件:ScreenExtensions.java   
public void addPuls(){
    pulsImage = Decal.newDecal(new TextureRegion(manager.getAssetsExtension().getTexture(NameFiles.imagePulse)));
    pulsImage.setDimensions(Gdx.graphics.getHeight()*0.0104f, Gdx.graphics.getHeight()*0.0104f);
    pulsImage.setPosition(0, 0, Gdx.graphics.getHeight()*0.001f);
    pulsImage.setBlending(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
}
项目:enklave    文件:ScreenRooms.java   
public void addPuls(){
    pulsImage = Decal.newDecal(new TextureRegion(manager.getAssetsRooms().getTexture(NameFiles.imagePulse)));
    pulsImage.setDimensions(Gdx.graphics.getHeight()*0.0104f, Gdx.graphics.getHeight()*0.0104f);
    pulsImage.setPosition(0, 0, 3);
    pulsImage.setBlending(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
}
项目:enklave    文件:MapsScreen.java   
private void DrawMap(){
        startlat = matrixPixmap.getMatrix()[1][1].getLatitude();
        startlong = matrixPixmap.getMatrix()[1][1].getLongitude();
        latitude = matrixPixmap.translateMaps.getInitiallat();
        longitude = matrixPixmap.translateMaps.getInitiallong();
        new ThreadSendCoordonate(latitude,longitude).run();
        mthread = new MyThread(startlat,startlong,latitude,longitude,myLocation.getLatitude(),myLocation.getLongitude(),distanta,unitlat,unitlong);
        ModelBuilder modelBuilder = new ModelBuilder();
        model =  modelBuilder.createBox(0.1f, 0.1f, 0.1f, new Material(ColorAttribute.createDiffuse(Color.WHITE)), Position | Normal);
        instance = new ModelInstance(model);
        position = Decal.newDecal(new TextureRegion(managerAssets.getAssetsMaps().getTexture(NameFiles.imgPossition)));
        position1 = Decal.newDecal(new TextureRegion(managerAssets.getAssetsMaps().getTexture(NameFiles.imgPossition)));
        position.setPosition(0, 0, 5);
        position1.setPosition(0, 0, 8);
        position.setBlending(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
        position1.setBlending(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
        position.setDimensions(15, 15);
        position1.setDimensions(15, 15);
        position.rotateZ((float) -compass);position1.rotateZ((float) -compass);
        decalcircle = Decal.newDecal((float)(60.0*unitlong),(float)(60.0*unitlat),new TextureRegion(managerAssets.getAssetsMaps().getTexture(NameFiles.imgCirclePos)));
        decalcircle.setPosition(0, 0, 3);decalcircle.setDimensions((float) (120.0 * unitlong), (float) (120.0 * unitlat));
        decalcircle.setBlending(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
        //scrap
        scoreLabel = new Label("Scrap : "+informationProfile.getDateUserGame().getScrap(),new Label.LabelStyle(Font.getFont((int) (Height * 0.03)), Color.WHITE));
        //scoreLabel.setPosition(Gdx.graphics.getWidth() - scoreLabel.getWidth() - (float) (Gdx.graphics.getWidth() * 0.08), Gdx.graphics.getHeight() - scoreLabel.getHeight() - (float) (Gdx.graphics.getHeight() * 0.01));
        progressBarEnergy = ProgressBarEnergy.getInstance();
        progressBarEnergy.setMapsScreen(this);
//        if(!informationProfile.getDateUserGame().isInCombat())
//            startTimer();
        //enklava
        enklavesArray = new DrawEnklaves();
        //raider
        raiderMap = new RaiderMap();

        //initialize position matrix  lat=x  long=y
        extendmaps = new Decal[9];
        for(int i=0;i<3;i++){
            for(int j=0;j<3;j++) {
                pos[i][j] = new Vector2();
                pos[i][j].set(600 * (j - 1), -600 * (i - 1));
            }
        }

        pref = Gdx.app.getPreferences("Profile");
        if(!pref.contains("tutorialShow")) {
            pref.putBoolean("tutorialShow", false);
            pref.flush();
        }
        pref.putBoolean("showonetime", true);
        pref.flush();
        addButtonChatCrafting();
        //exit dialog
        createexitdialog();
        //matrix map
        ExtentMap();
        for (int i = 0; i < 9; i++) {
            extendmaps[i].translate((float) (-matrixPixmap.translateMaps.getDirx() * unitlong), (float) (-matrixPixmap.translateMaps.getDiry() * unitlat), 0);
        }
        enklavesArray.translateEnk((float) (-matrixPixmap.translateMaps.getDirx() * unitlong), (float) (-matrixPixmap.translateMaps.getDiry() * unitlat));
        queueDisplay = QueueDisplay.getInstance();
        screenChat = ScreenChat.getInstance();
        queueDisplay = QueueDisplay.getInstance();

    }
项目:enklave    文件:ScreenCrafting.java   
private void drawBackground(){
    imageBackground = Decal.newDecal(new TextureRegion(managerAssets.getAssetsCrafting().getTexture(NameFiles.backgroundCrafting)));
    imageBackground.setDimensions(1200,2000);
    imageBackground.setPosition(0,0,-30);
    queueDisplay = QueueDisplay.getInstance();
}
项目:arcadelegends-gg    文件:CharacterRenderer.java   
@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);
}
项目:arcadelegends-gg    文件:CharacterRenderer.java   
/**
 * 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());
}
项目:arcadelegends-gg    文件:CameraLayerGroupStrategy.java   
@Override
protected Array<Decal> newObject() {
    return new Array();
}
项目:arcadelegends-gg    文件:CameraLayerGroupStrategy.java   
public CameraLayerGroupStrategy(Camera camera, Comparator<Decal> sorter) {
    this.camera = camera;
    this.cameraSorter = sorter;
    createDefaultShader();

}
项目:arcadelegends-gg    文件:CameraLayerGroupStrategy.java   
@Override
public int decideGroup(Decal decal) {
    return decal.getMaterial().isOpaque() ? GROUP_OPAQUE : GROUP_BLEND;
}