本文整理汇总了Java中com.badlogic.gdx.graphics.g3d.decals.Decal类的典型用法代码示例。如果您正苦于以下问题:Java Decal类的具体用法?Java Decal怎么用?Java Decal使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Decal类属于com.badlogic.gdx.graphics.g3d.decals包,在下文中一共展示了Decal类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: beforeGroup
import com.badlogic.gdx.graphics.g3d.decals.Decal; //导入依赖的package包/类
@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);
}
开发者ID:CypherCove,项目名称:DoubleHelix,代码行数:14,代码来源:ParticleGroupStrategy.java
示例17: 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
示例18: render
import com.badlogic.gdx.graphics.g3d.decals.Decal; //导入依赖的package包/类
@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;
}
}
开发者ID:basherone,项目名称:libgdxcn,代码行数:40,代码来源:DecalTest.java
示例19: 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
示例20: 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
注:本文中的com.badlogic.gdx.graphics.g3d.decals.Decal类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论