1 /******************************************************************************* 2 * Copyright 2011 See AUTHORS file. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 ******************************************************************************/ 16 17 package com.badlogic.gdx.graphics.g3d.attributes; 18 19 import com.badlogic.gdx.graphics.g3d.Attribute; 20 21 public class IntAttribute extends Attribute { 22 public static final String CullFaceAlias = "cullface"; 23 public static final long CullFace = register(CullFaceAlias); 24 createCullFace(int value)25 public static IntAttribute createCullFace (int value) { 26 return new IntAttribute(CullFace, value); 27 } 28 29 public int value; 30 IntAttribute(long type)31 public IntAttribute (long type) { 32 super(type); 33 } 34 IntAttribute(long type, int value)35 public IntAttribute (long type, int value) { 36 super(type); 37 this.value = value; 38 } 39 40 @Override copy()41 public Attribute copy () { 42 return new IntAttribute(type, value); 43 } 44 45 @Override hashCode()46 public int hashCode () { 47 int result = super.hashCode(); 48 result = 983 * result + value; 49 return result; 50 } 51 52 @Override compareTo(Attribute o)53 public int compareTo (Attribute o) { 54 if (type != o.type) return (int)(type - o.type); 55 return value - ((IntAttribute)o).value; 56 } 57 } 58