// Path: tutorials/src/com/xoppa/blog/libgdx/g3d/usingmaterials/step9/TestShader.java
// public static class DoubleColorAttribute extends Attribute {
// 	public final static String DiffuseUVAlias = "diffuseUVColor";
// 	public final static long DiffuseUV = register(DiffuseUVAlias);
// 
// 	public final Color color1 = new Color();
// 	public final Color color2 = new Color();
// 
// 	protected DoubleColorAttribute (long type, Color c1, Color c2) {
// 		super(type);
// 		color1.set(c1);
// 		color2.set(c2);
// 	}
// 
// 	@Override
// 	public Attribute copy () {
// 		return new DoubleColorAttribute(type, color1, color2);
// 	}
// 
// 	@Override
// 	protected boolean equals (Attribute other) {
// 		DoubleColorAttribute attr = (DoubleColorAttribute) other;
// 		return type == other.type && color1.equals(attr.color1)
// 				&& color2.equals(attr.color2);
// 	}
// 
// 	@Override
// 	public int compareTo (Attribute other) {
// 		if (type != other.type)
// 			return (int) (type - other.type);
// 		DoubleColorAttribute attr = (DoubleColorAttribute) other;
// 		return color1.equals(attr.color1)
// 				? attr.color2.toIntBits() - color2.toIntBits()
// 				: attr.color1.toIntBits() - color1.toIntBits();
// 	}
// }


import com.xoppa.blog.libgdx.g3d.usingmaterials.step9.TestShader.DoubleColorAttribute;
import com.badlogic.gdx.ApplicationListener;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.PerspectiveCamera;
import com.badlogic.gdx.graphics.VertexAttributes.Usage;
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.Shader;
import com.badlogic.gdx.graphics.g3d.Material;
import com.badlogic.gdx.graphics.g3d.utils.CameraInputController;
import com.badlogic.gdx.graphics.g3d.utils.ModelBuilder;
import com.badlogic.gdx.utils.Array;
/*******************************************************************************
 * Copyright 2011 See AUTHORS file.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *   http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 ******************************************************************************/

package com.xoppa.blog.libgdx.g3d.usingmaterials.step9;


/**
 * See: http://blog.xoppa.com/using-materials-with-libgdx
 * @author Xoppa
 */
public class MaterialTest implements ApplicationListener {
	public PerspectiveCamera cam;
    public CameraInputController camController;
    public Shader shader;
    public Model model;
    public Array<ModelInstance> instances = new Array<ModelInstance>();
    public ModelBatch modelBatch;
     
    @Override
    public void create () {
    	cam = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    	cam.position.set(0f, 8f, 8f);
    	cam.lookAt(0,0,0);
// Path: tutorials/src/com/xoppa/blog/libgdx/g3d/usingmaterials/step9/TestShader.java
// public static class DoubleColorAttribute extends Attribute {
// 	public final static String DiffuseUVAlias = "diffuseUVColor";
// 	public final static long DiffuseUV = register(DiffuseUVAlias);
// 
// 	public final Color color1 = new Color();
// 	public final Color color2 = new Color();
// 
// 	protected DoubleColorAttribute (long type, Color c1, Color c2) {
// 		super(type);
// 		color1.set(c1);
// 		color2.set(c2);
// 	}
// 
// 	@Override
// 	public Attribute copy () {
// 		return new DoubleColorAttribute(type, color1, color2);
// 	}
// 
// 	@Override
// 	protected boolean equals (Attribute other) {
// 		DoubleColorAttribute attr = (DoubleColorAttribute) other;
// 		return type == other.type && color1.equals(attr.color1)
// 				&& color2.equals(attr.color2);
// 	}
// 
// 	@Override
// 	public int compareTo (Attribute other) {
// 		if (type != other.type)
// 			return (int) (type - other.type);
// 		DoubleColorAttribute attr = (DoubleColorAttribute) other;
// 		return color1.equals(attr.color1)
// 				? attr.color2.toIntBits() - color2.toIntBits()
// 				: attr.color1.toIntBits() - color1.toIntBits();
// 	}
// }


// Path: tutorials/src/com/xoppa/blog/libgdx/g3d/usingmaterials/step9/MaterialTest.java
import com.xoppa.blog.libgdx.g3d.usingmaterials.step9.TestShader.DoubleColorAttribute;
import com.badlogic.gdx.ApplicationListener;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.PerspectiveCamera;
import com.badlogic.gdx.graphics.VertexAttributes.Usage;
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.Shader;
import com.badlogic.gdx.graphics.g3d.Material;
import com.badlogic.gdx.graphics.g3d.utils.CameraInputController;
import com.badlogic.gdx.graphics.g3d.utils.ModelBuilder;
import com.badlogic.gdx.utils.Array;

/*******************************************************************************
 * Copyright 2011 See AUTHORS file.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *   http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 ******************************************************************************/

package com.xoppa.blog.libgdx.g3d.usingmaterials.step9;


/**
 * See: http://blog.xoppa.com/using-materials-with-libgdx
 * @author Xoppa
 */
public class MaterialTest implements ApplicationListener {
	public PerspectiveCamera cam;
    public CameraInputController camController;
    public Shader shader;
    public Model model;
    public Array<ModelInstance> instances = new Array<ModelInstance>();
    public ModelBatch modelBatch;
     
    @Override
    public void create () {
    	cam = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    	cam.position.set(0f, 8f, 8f);
    	cam.lookAt(0,0,0);
    	cam.near = 1f;