Skip to content

Instantly share code, notes, and snippets.

package com.badlogic.gdx.tests.g3d;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.InputMultiplexer;
import com.badlogic.gdx.assets.AssetManager;
import com.badlogic.gdx.graphics.Camera;
import com.badlogic.gdx.graphics.GL10;
import com.badlogic.gdx.graphics.PerspectiveCamera;
import com.badlogic.gdx.graphics.g3d.Model;
import com.badlogic.gdx.graphics.g3d.ModelBatch;
public class Grid<T extends Grid.GridCell> {
public interface GridCell {
int getX();
int getY();
void setLocation(int x, int y);
}
public interface CellProvider<T extends GridCell> {
T obtainCell();
void releaseCell(T b);
@xoppa
xoppa / gist:7724943
Last active December 29, 2015 20:39
default precompiled
attribute vec3 a_position;
uniform mat4 u_projViewTrans;
attribute vec3 a_normal;
uniform mat3 u_normalMatrix;
varying vec3 v_normal;
uniform mat4 u_worldTrans;
const float u_shininess = 20.0;
varying vec3 v_lightDiffuse;
uniform vec3 u_ambientCubemap[6];
varying vec3 v_lightSpecular;
package com.badlogic.gdx.tests.g3d;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.assets.AssetManager;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.GL10;
import com.badlogic.gdx.graphics.PerspectiveCamera;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.VertexAttributes.Usage;
import com.badlogic.gdx.graphics.g3d.Environment;
@xoppa
xoppa / Particle3DTest.java
Created January 14, 2014 18:47
Particle 3D test
package com.badlogic.gdx.tests.g3d;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Camera;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.GL10;
import com.badlogic.gdx.graphics.Mesh;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.VertexAttribute;
import com.badlogic.gdx.graphics.VertexAttributes;
@xoppa
xoppa / gist:8647365
Last active January 9, 2020 06:43
CustomTextureTest.java
public class CustomTextureTest extends GdxTest {
public static class BgTextureUnitAttribute extends IntAttribute{
public static final String Alias = "bgTtextureUnit";
public final static long Type = register(Alias);
public BgTextureUnitAttribute(long type, int textureNum) {
super(type, textureNum);
}
}
public static class BgTextureShader extends DefaultShader {
@xoppa
xoppa / fragment.glsl
Last active November 9, 2023 21:52
Fragment lighting shader
#ifdef GL_ES
#define LOWP lowp
#define MED mediump
#define HIGH highp
precision mediump float;
#else
#define MED
#define LOWP
#define HIGH
#endif
package com.badlogic.gdx.graphics.g3d.utils;
import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.FloatBuffer;
import java.nio.ShortBuffer;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Mesh;
@xoppa
xoppa / PointingTest.java
Created July 22, 2014 22:17
PointingTest
package com.badlogic.gdx.tests.g3d;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input.Keys;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.g3d.Model;
import com.badlogic.gdx.graphics.g3d.ModelBatch;
import com.badlogic.gdx.graphics.g3d.ModelInstance;
import com.badlogic.gdx.graphics.g3d.attributes.BlendingAttribute;
@xoppa
xoppa / fragment
Created August 21, 2014 21:58
outline shader
#ifdef GL_ES
#define LOWP lowp
precision mediump float;
#else
#define LOWP
#endif
const float offset = 1.0 / 128.0;
varying vec2 v_texCoords;
uniform sampler2D u_texture;