@Override
public Texture create(int width, int height) {
Pixmap map = new Pixmap(width, height, Format.RGBA8888);
Color skinColor = getSkinColor();
Color hairColor = getHairColor();
Color shoeColor = getShoeColor();
Color trousesColor = getTrousesColor();
Color shirtColor = getShirtColor();
generate(map, skinColor, hairColor, shoeColor, trousesColor, shirtColor);
Texture texture = new Texture(map);
map.dispose();
return texture;
}
java类com.badlogic.gdx.graphics.Pixmap.Format的实例源码
VillagerTextureGenerator.java 文件源码
项目:pretender
阅读 19
收藏 0
点赞 0
评论 0
Asset.java 文件源码
项目:GDX-Engine
阅读 27
收藏 0
点赞 0
评论 0
@Override
public void load() {
if(isLoaded())
return;
bird = loadTextureRegion("angrybirds/sprites/bird.png");
pig = loadTexture("angrybirds/sprites/pig.png");
sling = loadTextureRegion("angrybirds/sprites/sling.png");
block = loadTexture("angrybirds/sprites/woods/block.gif");
longwood = loadTexture("angrybirds/sprites/woods/long.gif");
smallblock = loadTexture("angrybirds/sprites/woods/small.gif");
tallwood = loadTexture("angrybirds/sprites/woods/tall.gif");
background = loadTexture("bg.jpg", Format.RGB565, true);
font = loadBitmapFont("default.fnt", "default.png");
damaged_block = loadTexture("angrybirds/sprites/damaged_woods/block.gif");
damaged_longwood = loadTexture("angrybirds/sprites/damaged_woods/long.gif");
damaged_smallblock = loadTexture("angrybirds/sprites/damaged_woods/small.gif");
damaged_tallwood = loadTexture("angrybirds/sprites/damaged_woods/tall.gif");
setLoaded(true);
}
GameObjectHighlightGraphic.java 文件源码
项目:MMORPG_Prototype
阅读 26
收藏 0
点赞 0
评论 0
private Texture createHighlightingGraphic(TextureRegion textureRegion)
{
TextureData textureData = textureRegion.getTexture().getTextureData();
textureData.prepare();
Pixmap sourcePixmap = textureData.consumePixmap();
Pixmap destinationPixmap = new Pixmap(textureRegion.getRegionWidth(), textureRegion.getRegionHeight(), Format.RGBA8888);
Color color = new Color();
for (int x = 0; x < textureRegion.getRegionWidth(); x++)
{
for (int y = 0; y < textureRegion.getRegionHeight(); y++)
{
int colorInt = sourcePixmap.getPixel(textureRegion.getRegionX() + x, textureRegion.getRegionY() + y);
Color.rgba8888ToColor(color, colorInt);
destinationPixmap.setColor(1.0f, 1f, 1.0f, 1);
if (color.a > 0.004f)
destinationPixmap.drawPixel(x, y);
}
}
Texture result = new Texture(destinationPixmap);
textureData.disposePixmap();
destinationPixmap.dispose();
return result;
}
LightMap.java 文件源码
项目:rbcgj-2016
阅读 35
收藏 0
点赞 0
评论 0
public LightMap(RayHandler rayHandler, int fboWidth, int fboHeight) {
this.rayHandler = rayHandler;
if (fboWidth <= 0)
fboWidth = 1;
if (fboHeight <= 0)
fboHeight = 1;
frameBuffer = new FrameBuffer(Format.RGBA8888, fboWidth,
fboHeight, false);
pingPongBuffer = new FrameBuffer(Format.RGBA8888, fboWidth,
fboHeight, false);
lightMapMesh = createLightMapMesh();
shadowShader = ShadowShader.createShadowShader();
diffuseShader = DiffuseShader.createShadowShader();
withoutShadowShader = WithoutShadowShader.createShadowShader();
blurShader = Gaussian.createBlurShader(fboWidth, fboHeight);
}
Renderer.java 文件源码
项目:neblina-libgdx3d
阅读 38
收藏 0
点赞 0
评论 0
public Renderer () {
try {
lights = new Environment();
lights.add(new DirectionalLight().set(Color.WHITE, new Vector3(-1, -0.5f, 0).nor()));
spriteBatch = new SpriteBatch();
modelBatch = new ModelBatch();
backgroundTexture = new Texture(Gdx.files.internal("data/planet.jpg"), Format.RGB565, true);
backgroundTexture.setFilter(TextureFilter.MipMap, TextureFilter.Linear);
font = new BitmapFont(Gdx.files.internal("data/font10.fnt"), Gdx.files.internal("data/font10.png"), false);
camera = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
} catch (Exception ex) {
ex.printStackTrace();
}
}
LightMap.java 文件源码
项目:fabulae
阅读 34
收藏 0
点赞 0
评论 0
public LightMap(RayHandler rayHandler, int fboWidth, int fboHeight) {
this.rayHandler = rayHandler;
if (fboWidth <= 0)
fboWidth = 1;
if (fboHeight <= 0)
fboHeight = 1;
frameBuffer = new FrameBuffer(Format.RGBA8888, fboWidth,
fboHeight, false);
pingPongBuffer = new FrameBuffer(Format.RGBA8888, fboWidth,
fboHeight, false);
lightMapMesh = createLightMapMesh();
shadowShader = ShadowShader.createShadowShader();
diffuseShader = DiffuseShader.createShadowShader();
withoutShadowShader = WithoutShadowShader.createShadowShader();
blurShader = Gaussian.createBlurShader(fboWidth, fboHeight);
}
RemoteEditLoadingScreen.java 文件源码
项目:RavTech
阅读 26
收藏 0
点赞 0
评论 0
@Override
public void show () {
font = new BitmapFont(Gdx.files.internal("fonts/font.fnt"));
cache = font.getCache();
if (Gdx.app.getType() == ApplicationType.Android)
font.getData().setScale(2);
polygonBatch = new PolygonSpriteBatch();
camera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
Pixmap pixMap = new Pixmap(1, 1, Format.RGB565);
pixMap.setColor(Color.WHITE);
pixMap.fill();
emptyTexture = new Texture(pixMap);
pixMap.dispose();
}
ShaderManager.java 文件源码
项目:RavTech
阅读 42
收藏 0
点赞 0
评论 0
/** Resizes internal RavCamera for framebuffer use, call this in you ApplicationListener's resize.
*
* @param width - new screen width
* @param height - new screen height
* @param resizeFramebuffers - whether all of the framebuffers should be recreated to match new screen size */
public void resize (int width, int height, boolean resizeFramebuffers) {
// ?????
if (resizeFramebuffers) {
Keys<String> keys = frameBuffers.keys();
while (keys.hasNext) {
String key = keys.next();
FrameBuffer fb = frameBuffers.get(key);
int oldWidth = fb.getWidth();
int oldHeight = fb.getHeight();
Format format = fb.getColorBufferTexture().getTextureData().getFormat();
fb.dispose();
frameBuffers.put(key, null);
float factorX = 1f * width / screenCamera.viewportWidth;
float factorY = 1f * height / screenCamera.viewportHeight;
createFB(key, format, (int)(factorX * oldWidth), (int)(factorY * oldHeight));
// System.out.println("Recreated FB '" + key + "' from " +
// oldWidth + "x" + oldHeight + " to " +
// frameBuffers.get(key).getWidth() + "x" +
// frameBuffers.get(key).getHeight());
}
}
screenCamera = new OrthographicCamera(width, height);
createScreenQuad();
}
PowerLUT.java 文件源码
项目:DoubleHelix
阅读 18
收藏 0
点赞 0
评论 0
/** W power will be in luminance, and H power will be in alpha**/
public PowerLUT(float powerW, float intensityW, float powerH, float intensityH, int width, int height){
Pixmap pixmap = new Pixmap(width, height, Format.RGBA8888);
for (int i=0; i<width; i++){
float valueW = (float)Math.pow((float)i/width, powerW) * intensityW;
for (int j = 0; j < height; j++) {
float valueH = (float)Math.pow((float)j/height, powerH) * intensityH;
pixmap.setColor(valueW, valueH, 1.0f, 1.0f);
pixmap.drawPixel(i, j);
}
}
PixmapTextureData data = new PixmapTextureData(pixmap, Format.RGBA8888, false, false, true);
texture = new Texture(data);
texture.setWrap(TextureWrap.ClampToEdge, TextureWrap.ClampToEdge);
texture.setFilter(TextureFilter.Linear, TextureFilter.Linear);
}
BufferedImageHelper.java 文件源码
项目:nvlist
阅读 29
收藏 0
点赞 0
评论 0
/**
* Returns the equivalent buffered image type ({@link BufferedImage#getType()}) for the given pixmap
* format.
*/
public static int toBufferedImageType(Format format) {
switch (format) {
case Intensity:
case Alpha:
return BufferedImage.TYPE_BYTE_GRAY;
case RGB565:
case RGB888:
return BufferedImage.TYPE_3BYTE_BGR;
case LuminanceAlpha:
case RGBA4444:
case RGBA8888:
return BufferedImage.TYPE_INT_ARGB;
default:
throw new IllegalArgumentException("Unsupported format: " + format);
}
}
PremultTextureLoader.java 文件源码
项目:nvlist
阅读 33
收藏 0
点赞 0
评论 0
@Override
public void loadAsync(AssetManager manager, String fileName, FileHandle file,
TextureParameter parameter) {
if (parameter == null || parameter.textureData == null) {
Format format = null;
boolean genMipMaps = false;
info.texture = null;
if (parameter != null) {
format = parameter.format;
genMipMaps = parameter.genMipMaps;
info.texture = parameter.texture;
}
info.data = loadTexData(file, format, genMipMaps);
} else {
info.data = parameter.textureData;
info.texture = parameter.texture;
}
if (!info.data.isPrepared()) {
info.data.prepare();
}
}
PixmapUtil.java 文件源码
项目:nvlist
阅读 35
收藏 0
点赞 0
评论 0
/**
* @param pixels A Pixmap in {@link Format#RGBA8888}.
*/
public static void flipVertical(Pixmap pixels) {
Checks.checkArgument(pixels.getFormat() == Format.RGBA8888,
"Pixmap with unsupported format: " + pixels.getFormat());
int bytesPerRow = pixels.getWidth() * 4; // RGBA8888
int h = pixels.getHeight();
byte[] lineBuffer0 = new byte[bytesPerRow];
byte[] lineBuffer1 = new byte[bytesPerRow];
ByteBuffer pixelsBuffer = pixels.getPixels();
for (int y = 0; y < h / 2; y++) {
int y0 = y * bytesPerRow;
int y1 = (h - 1 - y) * bytesPerRow;
// Swap pixels in rows
pixelsBuffer.position(y0);
pixelsBuffer.get(lineBuffer0);
pixelsBuffer.position(y1);
pixelsBuffer.get(lineBuffer1);
pixelsBuffer.position(y1);
pixelsBuffer.put(lineBuffer0);
pixelsBuffer.position(y0);
pixelsBuffer.put(lineBuffer1);
}
pixelsBuffer.rewind();
}
PixmapUtil.java 文件源码
项目:nvlist
阅读 29
收藏 0
点赞 0
评论 0
/**
* Converts the given pixmap to the specified target color format. If the source pixmap is already in the
* correct format, the original pixmap is returned unmodified.
*/
public static Pixmap convert(Pixmap source, Format targetFormat, boolean disposeSource) {
if (source.getFormat() == targetFormat) {
return source; // Already the correct format
}
int iw = source.getWidth();
int ih = source.getHeight();
Pixmap result = newUninitializedPixmap(iw, ih, targetFormat);
copySubRect(source, Rect.of(0, 0, iw, ih), result, Rect.of(0, 0, iw, ih), Filter.NearestNeighbour);
if (disposeSource) {
source.dispose();
}
return result;
}
PixmapUtil.java 文件源码
项目:nvlist
阅读 21
收藏 0
点赞 0
评论 0
/**
* Copies the contents of {@code src} to {@code dst}.
*
* @throws IllegalArgumentException If the pixmaps are different sizes or different formats.
*/
public static void copy(Pixmap src, Pixmap dst) {
Format srcFmt = src.getFormat();
Format dstFmt = dst.getFormat();
Checks.checkArgument(srcFmt == dstFmt, "Formats not equal: src=" + srcFmt + ", dst=" + dstFmt);
int srcW = src.getWidth();
int dstW = dst.getWidth();
Checks.checkArgument(srcW == dstW, "Widths not equal: src.w=" + srcW + ", dst.w=" + dstW);
int srcH = src.getHeight();
int dstH = src.getHeight();
Checks.checkArgument(srcH == dstH, "Heights not equal: src.h=" + srcH + ", dst.h=" + dstH);
ByteBuffer srcPixels = src.getPixels();
ByteBuffer dstPixels = dst.getPixels();
BufferUtils.copy(srcPixels, dstPixels, srcPixels.limit());
srcPixels.clear();
dstPixels.clear();
}
PixmapUtilTest.java 文件源码
项目:nvlist
阅读 19
收藏 0
点赞 0
评论 0
@Test
public void testFlipVertical() {
Pixmap flip = new Pixmap(2, 3, Format.RGBA8888);
flip.drawPixel(0, 0, 0xAABBCCDD);
flip.drawPixel(1, 2, 0x11223344);
PixmapUtil.flipVertical(flip);
Pixmap expected = new Pixmap(2, 3, Format.RGBA8888);
expected.drawPixel(0, 2, 0xAABBCCDD);
expected.drawPixel(1, 0, 0x11223344);
pixmapEquals.assertEquals(expected, flip);
flip.dispose();
expected.dispose();
}
TextureFactory.java 文件源码
项目:SpaceProject
阅读 22
收藏 0
点赞 0
评论 0
public static Texture generatePlanet(int[][] tileMap, ArrayList<Tile> tiles) {
int s = tileMap.length;
Pixmap pixmap = new Pixmap(s, s, Format.RGBA4444);
// draw circle for planet
pixmap.setColor(1, 1, 1, 1);
pixmap.fillCircle(s/2,s/2,s/2-1);
//draw noise
for (int y = 0; y < s; ++y) {
for (int x = 0; x < s; ++x) {
//only draw on circle
if (pixmap.getPixel(x, y) != 0) {
pixmap.setColor(tiles.get(tileMap[x][y]).getColor());
pixmap.drawPixel(x, y);
}
}
}
Texture t = new Texture(pixmap);
pixmap.dispose();
return t;
}
TextureFactory.java 文件源码
项目:SpaceProject
阅读 30
收藏 0
点赞 0
评论 0
public static Texture generateNoise(long seed, int size, double featureSize) {
OpenSimplexNoise noise = new OpenSimplexNoise(seed);
Pixmap pixmap = new Pixmap(size, size, Format.RGBA4444);
//add layer of noise
for (int y = 0; y < pixmap.getHeight(); ++y) {
for (int x = 0; x < pixmap.getWidth(); ++x) {
double nx = x / featureSize, ny = y / featureSize;
double i = noise.eval(nx, ny, 0);
i = (i * 0.5) + 0.5; // convert from range [-1:1] to [0:1]
pixmap.setColor(new Color((float) i, (float) i, (float) i, 1));
pixmap.drawPixel(x, y);
}
}
Texture t = new Texture(pixmap);
pixmap.dispose();
return t;
}
TextureFactory.java 文件源码
项目:SpaceProject
阅读 20
收藏 0
点赞 0
评论 0
public static Texture generateCharacter() {
pixmap = new Pixmap(4, 4, Format.RGB565);
//fill square
pixmap.setColor(0.5f, 0.5f, 0.5f, 1);
pixmap.fill();
//draw face/eyes (front of character)
pixmap.setColor(0, 1, 1, 1);
pixmap.drawPixel(3, 2);
pixmap.drawPixel(3, 1);
Texture t = new Texture(pixmap);
pixmap.dispose();
return t;
}
HeadlessTextureLoader.java 文件源码
项目:swampmachine
阅读 30
收藏 0
点赞 0
评论 0
@Override
public void loadAsync(AssetManager manager, String fileName, FileHandle file, TextureParameter parameter) {
info.filename = fileName;
if (parameter == null || parameter.textureData == null) {
info.texture = null;
if (parameter != null) {
info.texture = parameter.texture;
}
info.data = new PixmapTextureData(null, Format.RGB565, false, false);
} else {
info.data = parameter.textureData;
info.texture = parameter.texture;
}
}
OrthogonalTiledMapRendererWithObjects.java 文件源码
项目:swampmachine
阅读 22
收藏 0
点赞 0
评论 0
public OrthogonalTiledMapRendererWithObjects(TiledMap map) {
super(map);
this.occlusionFbo = new FrameBuffer(Format.RGBA8888, Gdx.graphics.getWidth() / 2, Gdx.graphics.getHeight() / 2, false);
this.shadowmapFbo = new FrameBuffer(Format.RGBA8888, Gdx.graphics.getWidth() / 2, 1, false);
this.shadowmapTex = shadowmapFbo.getColorBufferTexture();
this.shadowmapTex.setFilter(TextureFilter.Linear, TextureFilter.Linear);
this.shadowmapTex.setWrap(TextureWrap.Repeat, TextureWrap.Repeat);
//this.orthoCam = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
//this.orthoCam.setToOrtho(Y_DOWN);
this.lights = new ArrayList<Light>();
this.mouseLight = new Light(0, 0, Color.WHITE);
}
Renderer.java 文件源码
项目:libgdx-demo-invaders
阅读 28
收藏 0
点赞 0
评论 0
public Renderer () {
try {
lights = new Environment();
lights.add(new DirectionalLight().set(Color.WHITE, new Vector3(-1, -0.5f, 0).nor()));
spriteBatch = new SpriteBatch();
modelBatch = new ModelBatch();
backgroundTexture = new Texture(Gdx.files.internal("data/planet.jpg"), Format.RGB565, true);
backgroundTexture.setFilter(TextureFilter.MipMap, TextureFilter.Linear);
font = new BitmapFont(Gdx.files.internal("data/font10.fnt"), Gdx.files.internal("data/font10.png"), false);
camera = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
} catch (Exception ex) {
ex.printStackTrace();
}
}
MenuButtonFactory.java 文件源码
项目:bomberman-libgdx
阅读 25
收藏 0
点赞 0
评论 0
/**
* Constructor apply default button style
*/
public MenuButtonFactory() {
pixmap = new Pixmap(100, 100, Format.RGBA8888);
pixmap.setColor(Color.WHITE);
pixmap.fill();
skin = new Skin();
skin.add("white", new Texture(pixmap));
textButtonStyle = new TextButtonStyle();
textButtonStyle.up = skin.newDrawable("white", Color.DARK_GRAY);
textButtonStyle.down = skin.newDrawable("white", Color.DARK_GRAY);
textButtonStyle.over = skin.newDrawable("white", Color.LIGHT_GRAY);
textButtonStyle.checked = skin.newDrawable("white", Color.BLACK);
textButtonStyle.font = new BitmapFont(
Gdx.files.internal("data/font.fnt"),
Gdx.files.internal("data/font.png"), false);
textButtonStyle.font.setScale(1.6f);
}
Renderer.java 文件源码
项目:android-screen-recorder
阅读 35
收藏 0
点赞 0
评论 0
public Renderer () {
try {
lights = new Environment();
lights.add(new DirectionalLight().set(Color.WHITE, new Vector3(-1, -0.5f, 0).nor()));
spriteBatch = new SpriteBatch();
modelBatch = new ModelBatch();
backgroundTexture = new Texture(Gdx.files.internal("data/planet.jpg"), Format.RGB565, true);
backgroundTexture.setFilter(TextureFilter.MipMap, TextureFilter.Linear);
font = new BitmapFont(Gdx.files.internal("data/font10.fnt"), Gdx.files.internal("data/font10.png"), false);
camera = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
} catch (Exception ex) {
ex.printStackTrace();
}
}
LifeBar.java 文件源码
项目:plox
阅读 27
收藏 0
点赞 0
评论 0
public LifeBar(GameObject target, TweenManager tweenManager) {
this.target = target;
Texture lifeTexture = Resources.get(Resources.LIFE, Texture.class);
currentPoints = target.getCurrentLife();
this.tweenManager = tweenManager;
Pixmap map = new Pixmap(20, 100, Format.RGBA8888);
map.setColor(Color.BLACK);
map.fill();
Texture backgroundTexture = new Texture(map);
map.dispose();
life = new Sprite(lifeTexture);
background = new Sprite(backgroundTexture);
padding = 10;
getColor().a = 0.5f;
}
ETC1TextureData.java 文件源码
项目:libgdxcn
阅读 19
收藏 0
点赞 0
评论 0
@Override
public void consumeCustomData (int target) {
if (!isPrepared) throw new GdxRuntimeException("Call prepare() before calling consumeCompressedData()");
if (!Gdx.graphics.supportsExtension("GL_OES_compressed_ETC1_RGB8_texture")) {
Pixmap pixmap = ETC1.decodeImage(data, Format.RGB565);
Gdx.gl.glTexImage2D(target, 0, pixmap.getGLInternalFormat(), pixmap.getWidth(), pixmap.getHeight(), 0,
pixmap.getGLFormat(), pixmap.getGLType(), pixmap.getPixels());
if (useMipMaps) MipMapGenerator.generateMipMap(target, pixmap, pixmap.getWidth(), pixmap.getHeight());
pixmap.dispose();
useMipMaps = false;
} else {
Gdx.gl.glCompressedTexImage2D(target, 0, ETC1.ETC1_RGB8_OES, width, height, 0, data.compressedData.capacity()
- data.dataOffset, data.compressedData);
if (useMipMaps()) Gdx.gl20.glGenerateMipmap(GL20.GL_TEXTURE_2D);
}
data.dispose();
data = null;
isPrepared = false;
}
ETC1.java 文件源码
项目:libgdxcn
阅读 28
收藏 0
点赞 0
评论 0
/** Takes ETC1 compressed image data and converts it to a {@link Format#RGB565} or {@link Format#RGB888} {@link Pixmap}. Does
* not modify the ByteBuffer's position or limit.
* @param etc1Data the {@link ETC1Data} instance
* @param format either {@link Format#RGB565} or {@link Format#RGB888}
* @return the Pixmap */
public static Pixmap decodeImage (ETC1Data etc1Data, Format format) {
int dataOffset = 0;
int width = 0;
int height = 0;
if (etc1Data.hasPKMHeader()) {
dataOffset = 16;
width = ETC1.getWidthPKM(etc1Data.compressedData, 0);
height = ETC1.getHeightPKM(etc1Data.compressedData, 0);
} else {
dataOffset = 0;
width = etc1Data.width;
height = etc1Data.height;
}
int pixelSize = getPixelSize(format);
Pixmap pixmap = new Pixmap(width, height, format);
decodeImage(etc1Data.compressedData, dataOffset, pixmap.getPixels(), 0, width, height, pixelSize);
return pixmap;
}
CubemapLoader.java 文件源码
项目:libgdxcn
阅读 35
收藏 0
点赞 0
评论 0
@Override
public void loadAsync (AssetManager manager, String fileName, FileHandle file, CubemapParameter parameter) {
info.filename = fileName;
if (parameter == null || parameter.cubemapData == null) {
Pixmap pixmap = null;
Format format = null;
boolean genMipMaps = false;
info.cubemap = null;
if (parameter != null) {
format = parameter.format;
info.cubemap = parameter.cubemap;
}
} else {
info.data = parameter.cubemapData;
info.cubemap = parameter.cubemap;
}
if (!info.data.isPrepared()) info.data.prepare();
}
TextureLoader.java 文件源码
项目:libgdxcn
阅读 29
收藏 0
点赞 0
评论 0
@Override
public void loadAsync (AssetManager manager, String fileName, FileHandle fileHandle, TextureParameter parameter) {
if (parameter == null || (parameter != null && parameter.textureData == null)) {
Pixmap pixmap = null;
Format format = null;
boolean genMipMaps = false;
texture = null;
if (parameter != null) {
format = parameter.format;
genMipMaps = parameter.genMipMaps;
texture = parameter.texture;
}
FileHandle handle = resolve(fileName);
pixmap = new Pixmap(handle);
data = new FileTextureData(handle, pixmap, format, genMipMaps);
} else {
data = parameter.textureData;
if (!data.isPrepared()) data.prepare();
texture = parameter.texture;
}
}
ShaderMultitextureTest.java 文件源码
项目:libgdxcn
阅读 18
收藏 0
点赞 0
评论 0
private void createTexture () {
Pixmap pixmap = new Pixmap(256, 256, Format.RGBA8888);
pixmap.setColor(1, 1, 1, 1);
pixmap.fill();
pixmap.setColor(0, 0, 0, 1);
pixmap.drawLine(0, 0, 256, 256);
pixmap.drawLine(256, 0, 0, 256);
texture = new Texture(pixmap);
pixmap.dispose();
pixmap = new Pixmap(256, 256, Format.RGBA8888);
pixmap.setColor(1, 1, 1, 1);
pixmap.fill();
pixmap.setColor(0, 0, 0, 1);
pixmap.drawLine(128, 0, 128, 256);
texture2 = new Texture(pixmap);
pixmap.dispose();
}
ProjectiveTextureTest.java 文件源码
项目:libgdxcn
阅读 28
收藏 0
点赞 0
评论 0
public void setupScene () {
plane = new Mesh(true, 4, 6, new VertexAttribute(Usage.Position, 3, ShaderProgram.POSITION_ATTRIBUTE), new VertexAttribute(
Usage.Normal, 3, ShaderProgram.NORMAL_ATTRIBUTE));
plane.setVertices(new float[] {-10, -1, 10, 0, 1, 0, 10, -1, 10, 0, 1, 0, 10, -1, -10, 0, 1, 0, -10, -1, -10, 0, 1, 0});
plane.setIndices(new short[] {3, 2, 1, 1, 0, 3});
texture = new Texture(Gdx.files.internal("data/badlogic.jpg"), Format.RGB565, true);
texture.setFilter(TextureFilter.MipMap, TextureFilter.Nearest);
cam = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
cam.position.set(0, 5, 10);
cam.lookAt(0, 0, 0);
cam.update();
controller = new PerspectiveCamController(cam);
projector = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
projector.position.set(2, 3, 2);
projector.lookAt(0, 0, 0);
projector.normalizeUp();
projector.update();
}