Skip to content

Instantly share code, notes, and snippets.

@xoppa
xoppa / fragment
Created Aug 21, 2014
outline shader
View fragment
#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;
View PointingTest.java
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;
View gist:b75aef57829eb4509709
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 / fragment.glsl
Last active Jul 29, 2021
Fragment lighting shader
View fragment.glsl
#ifdef GL_ES
#define LOWP lowp
#define MED mediump
#define HIGH highp
precision mediump float;
#else
#define MED
#define LOWP
#define HIGH
#endif
@xoppa
xoppa / gist:8647365
Last active Jan 9, 2020
CustomTextureTest.java
View gist:8647365
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 {
View Particle3DTest.java
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;
View fireball.java
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 / gist:7724943
Last active Dec 29, 2015
default precompiled
View gist:7724943
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;
View gist:7158179
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);
View gist:6654328
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;