This commit is contained in:
parent
b5b562ca8b
commit
0cd7248b94
@ -33,35 +33,55 @@ import static org.lwjgl.system.MemoryUtil.NULL;
|
|||||||
*/
|
*/
|
||||||
public class AudioBuffer {
|
public class AudioBuffer {
|
||||||
|
|
||||||
//the id of the buffer
|
/**
|
||||||
|
* the id of the buffer
|
||||||
|
*/
|
||||||
private int bufferId;
|
private int bufferId;
|
||||||
|
|
||||||
//The number of channels for the audio
|
/**
|
||||||
|
* The number of channels for the audio
|
||||||
|
*/
|
||||||
private int channels = 0;
|
private int channels = 0;
|
||||||
|
|
||||||
//The sample rate of the audio
|
/**
|
||||||
|
* The sample rate of the audio
|
||||||
|
*/
|
||||||
private float sampleRate = 0;
|
private float sampleRate = 0;
|
||||||
|
|
||||||
//The size of a single sample in bits
|
/**
|
||||||
|
* The size of a single sample in bits
|
||||||
|
*/
|
||||||
private int sampleSize = 0;
|
private int sampleSize = 0;
|
||||||
|
|
||||||
//The framerate
|
/**
|
||||||
|
* The framerate
|
||||||
|
*/
|
||||||
private float frameRate = 0;
|
private float frameRate = 0;
|
||||||
|
|
||||||
//the length of a frame
|
/**
|
||||||
|
* the length of a frame
|
||||||
|
*/
|
||||||
private long frameLength = 0;
|
private long frameLength = 0;
|
||||||
|
|
||||||
//The size of a single frame
|
/**
|
||||||
|
* The size of a single frame
|
||||||
|
*/
|
||||||
private int frameSize = 0;
|
private int frameSize = 0;
|
||||||
|
|
||||||
//the length of the audio source in milliseconds
|
/**
|
||||||
float length = 0;
|
* the length of the audio source in milliseconds
|
||||||
|
*/
|
||||||
|
private float length = 0;
|
||||||
|
|
||||||
//whether this buffer has created an al buffer object or not
|
/**
|
||||||
boolean isBuffered = false;
|
* whether this buffer has created an al buffer object or not
|
||||||
|
*/
|
||||||
|
private boolean isBuffered = false;
|
||||||
|
|
||||||
//The filepath associated with this buffer
|
/**
|
||||||
String filePath = null;
|
* The filepath associated with this buffer
|
||||||
|
*/
|
||||||
|
private String filePath = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the audio buffer object
|
* Creates the audio buffer object
|
||||||
@ -303,7 +323,7 @@ public class AudioBuffer {
|
|||||||
* Gets the length of this audio buffer
|
* Gets the length of this audio buffer
|
||||||
* @return The length
|
* @return The length
|
||||||
*/
|
*/
|
||||||
public double getLength(){
|
public float getLength(){
|
||||||
return this.length;
|
return this.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -38,34 +38,54 @@ import static org.lwjgl.system.MemoryUtil.NULL;
|
|||||||
*/
|
*/
|
||||||
public class AudioEngine {
|
public class AudioEngine {
|
||||||
|
|
||||||
//Controls whether the engine initialized or not
|
/**
|
||||||
boolean initialized = false;
|
* Controls whether the engine initialized or not
|
||||||
|
*/
|
||||||
|
private boolean initialized = false;
|
||||||
|
|
||||||
//openal device
|
/**
|
||||||
|
* openal device
|
||||||
|
*/
|
||||||
private long device;
|
private long device;
|
||||||
|
|
||||||
//openal context
|
/**
|
||||||
|
* openal context
|
||||||
|
*/
|
||||||
private long context;
|
private long context;
|
||||||
|
|
||||||
//the listener data for the audio landscape
|
/**
|
||||||
|
* the listener data for the audio landscape
|
||||||
|
*/
|
||||||
private AudioListener listener;
|
private AudioListener listener;
|
||||||
|
|
||||||
//the current gain level of the engine
|
/**
|
||||||
|
* the current gain level of the engine
|
||||||
|
*/
|
||||||
private float engineGain = 1.0f;
|
private float engineGain = 1.0f;
|
||||||
|
|
||||||
//The current device
|
/**
|
||||||
String currentDevice = "";
|
* The current device
|
||||||
|
*/
|
||||||
|
private String currentDevice = "";
|
||||||
|
|
||||||
//the default device
|
/**
|
||||||
String defaultDevice = "";
|
* the default device
|
||||||
|
*/
|
||||||
|
private String defaultDevice = "";
|
||||||
|
|
||||||
//if true, hrtf present and active
|
/**
|
||||||
boolean hasHRTF = false;
|
* if true, hrtf present and active
|
||||||
|
*/
|
||||||
|
private boolean hasHRTF = false;
|
||||||
|
|
||||||
//if true, efx present and active
|
/**
|
||||||
boolean hasEFX = false;
|
* if true, efx present and active
|
||||||
|
*/
|
||||||
|
private boolean hasEFX = false;
|
||||||
|
|
||||||
//The list of sources being tracked
|
/**
|
||||||
|
* The list of sources being tracked
|
||||||
|
*/
|
||||||
private List<AudioSource> openALSources = new CopyOnWriteArrayList<AudioSource>();
|
private List<AudioSource> openALSources = new CopyOnWriteArrayList<AudioSource>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -95,8 +115,8 @@ public class AudioEngine {
|
|||||||
*/
|
*/
|
||||||
public void init() {
|
public void init() {
|
||||||
try {
|
try {
|
||||||
initDevice();
|
this.initDevice();
|
||||||
echoJavaAudioSupport();
|
this.echoJavaAudioSupport();
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
LoggerInterface.loggerEngine.ERROR("Error initializing audio device", ex);
|
LoggerInterface.loggerEngine.ERROR("Error initializing audio device", ex);
|
||||||
}
|
}
|
||||||
@ -120,7 +140,7 @@ public class AudioEngine {
|
|||||||
* Initializes audio devices
|
* Initializes audio devices
|
||||||
* @throws Exception Thrown if there are no audio devices or fails to create openal context
|
* @throws Exception Thrown if there are no audio devices or fails to create openal context
|
||||||
*/
|
*/
|
||||||
void initDevice() throws Exception {
|
private void initDevice() throws Exception {
|
||||||
//create device
|
//create device
|
||||||
LoggerInterface.loggerAudio.DEBUG("Open ALC device");
|
LoggerInterface.loggerAudio.DEBUG("Open ALC device");
|
||||||
this.device = ALC10.alcOpenDevice((ByteBuffer) null);
|
this.device = ALC10.alcOpenDevice((ByteBuffer) null);
|
||||||
@ -149,7 +169,7 @@ public class AudioEngine {
|
|||||||
* @param deviceCaps The device capabilities
|
* @param deviceCaps The device capabilities
|
||||||
* @return The buffer (may be null if no desired extensions present)
|
* @return The buffer (may be null if no desired extensions present)
|
||||||
*/
|
*/
|
||||||
IntBuffer getContextAttrs(ALCCapabilities deviceCaps){
|
private IntBuffer getContextAttrs(ALCCapabilities deviceCaps){
|
||||||
int bufferSize = 0;
|
int bufferSize = 0;
|
||||||
//check for available extensions
|
//check for available extensions
|
||||||
if(deviceCaps.ALC_EXT_EFX){
|
if(deviceCaps.ALC_EXT_EFX){
|
||||||
@ -309,6 +329,14 @@ public class AudioEngine {
|
|||||||
return hasHRTF;
|
return hasHRTF;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the EFX status
|
||||||
|
* @return The EFX status
|
||||||
|
*/
|
||||||
|
public boolean getEFXStatus(){
|
||||||
|
return hasEFX;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the listener for the audio engine
|
* Gets the listener for the audio engine
|
||||||
* @return the listener
|
* @return the listener
|
||||||
|
|||||||
@ -23,8 +23,10 @@ public class AudioSource {
|
|||||||
*/
|
*/
|
||||||
static final int INVALID_ID = 0;
|
static final int INVALID_ID = 0;
|
||||||
|
|
||||||
//The id for the source
|
/**
|
||||||
int sourceId = UNDEFINED_ID;
|
* The id for the source
|
||||||
|
*/
|
||||||
|
private int sourceId = UNDEFINED_ID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an audio source object
|
* Creates an audio source object
|
||||||
|
|||||||
@ -76,12 +76,12 @@ public class VirtualAudioSource implements Comparable<VirtualAudioSource> {
|
|||||||
AudioBuffer buffer = Globals.assetManager.fetchAudio(filePath);
|
AudioBuffer buffer = Globals.assetManager.fetchAudio(filePath);
|
||||||
// LoggerInterface.loggerAudio.DEBUG("Increment virtual audio source " + deltaTime);
|
// LoggerInterface.loggerAudio.DEBUG("Increment virtual audio source " + deltaTime);
|
||||||
if(buffer != null){
|
if(buffer != null){
|
||||||
if(this.totalTimePlayed >= buffer.length){
|
if(this.totalTimePlayed >= buffer.getLength()){
|
||||||
if(loops){
|
if(loops){
|
||||||
this.totalTimePlayed = this.totalTimePlayed % buffer.length;
|
this.totalTimePlayed = this.totalTimePlayed % buffer.getLength();
|
||||||
} else {
|
} else {
|
||||||
isStillPlaying = false;
|
isStillPlaying = false;
|
||||||
LoggerInterface.loggerAudio.DEBUG("Virtual Audio Source Timeout " + totalTimePlayed + " > " + buffer.length);
|
LoggerInterface.loggerAudio.DEBUG("Virtual Audio Source Timeout " + totalTimePlayed + " > " + buffer.getLength());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -207,7 +207,7 @@ public class VirtualAudioSource implements Comparable<VirtualAudioSource> {
|
|||||||
public float getBufferLength(){
|
public float getBufferLength(){
|
||||||
AudioBuffer buffer = Globals.assetManager.fetchAudio(filePath);
|
AudioBuffer buffer = Globals.assetManager.fetchAudio(filePath);
|
||||||
if(buffer != null){
|
if(buffer != null){
|
||||||
return buffer.length;
|
return buffer.getLength();
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,7 +18,7 @@ public class AuthenticationManager {
|
|||||||
/**
|
/**
|
||||||
* Tracks whether this is a mock authentication manager or not
|
* Tracks whether this is a mock authentication manager or not
|
||||||
*/
|
*/
|
||||||
boolean isMock = false;
|
private boolean isMock = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An invalid login
|
* An invalid login
|
||||||
|
|||||||
@ -18,11 +18,15 @@ public class Logger {
|
|||||||
ERROR,
|
ERROR,
|
||||||
}
|
}
|
||||||
|
|
||||||
//the level of this log
|
/**
|
||||||
LogLevel level;
|
* the level of this log
|
||||||
|
*/
|
||||||
|
private LogLevel level;
|
||||||
|
|
||||||
//The name of the logger
|
/**
|
||||||
String name;
|
* The name of the logger
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a logger channel
|
* Creates a logger channel
|
||||||
|
|||||||
@ -10,9 +10,19 @@ import electrosphere.net.parser.net.message.EntityMessage;
|
|||||||
*/
|
*/
|
||||||
public class NetUtils {
|
public class NetUtils {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The default port
|
||||||
|
*/
|
||||||
public static final int DEFAULT_PORT = 34251;
|
public static final int DEFAULT_PORT = 34251;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The port
|
||||||
|
*/
|
||||||
static int port = DEFAULT_PORT;
|
static int port = DEFAULT_PORT;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The address
|
||||||
|
*/
|
||||||
static String address = "localhost";
|
static String address = "localhost";
|
||||||
|
|
||||||
// public static EntityMessage createSpawnEntityMessage(Entity e){
|
// public static EntityMessage createSpawnEntityMessage(Entity e){
|
||||||
@ -26,10 +36,18 @@ public class NetUtils {
|
|||||||
return rVal;
|
return rVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the port
|
||||||
|
* @return The port
|
||||||
|
*/
|
||||||
public static int getPort() {
|
public static int getPort() {
|
||||||
return port;
|
return port;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the address
|
||||||
|
* @return The address
|
||||||
|
*/
|
||||||
public static String getAddress() {
|
public static String getAddress() {
|
||||||
return address;
|
return address;
|
||||||
}
|
}
|
||||||
@ -44,6 +62,10 @@ public class NetUtils {
|
|||||||
NetUtils.port = port;
|
NetUtils.port = port;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the address
|
||||||
|
* @param address The address
|
||||||
|
*/
|
||||||
public static void setAddress(String address) {
|
public static void setAddress(String address) {
|
||||||
NetUtils.address = address;
|
NetUtils.address = address;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,56 +18,48 @@ public class AnimChannel {
|
|||||||
/**
|
/**
|
||||||
* The current time of the channel
|
* The current time of the channel
|
||||||
*/
|
*/
|
||||||
double timeCurrent = 0;
|
private double timeCurrent = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The total time of the channel
|
* The total time of the channel
|
||||||
*/
|
*/
|
||||||
double timeTotal;
|
private double timeTotal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The ticks per second of the channel
|
* The ticks per second of the channel
|
||||||
*/
|
*/
|
||||||
double ticksPerSecond;
|
private double ticksPerSecond;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The bone id associated with the channel
|
* The bone id associated with the channel
|
||||||
*/
|
*/
|
||||||
String nodeID;
|
private String nodeID;
|
||||||
|
|
||||||
/**
|
|
||||||
* The starting position of the bone
|
|
||||||
*/
|
|
||||||
Vector3f startingPosition;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* All position frames
|
* All position frames
|
||||||
*/
|
*/
|
||||||
TreeMap<Double,Keyframe> positionFrameTree;
|
private TreeMap<Double,Keyframe> positionFrameTree;
|
||||||
|
|
||||||
/**
|
|
||||||
* The starting rotation of the bone
|
|
||||||
*/
|
|
||||||
Quaterniond startingRotation;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* All rotation frames
|
* All rotation frames
|
||||||
*/
|
*/
|
||||||
TreeMap<Double,Keyframe> rotationFrameTree;
|
private TreeMap<Double,Keyframe> rotationFrameTree;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* All scale frames
|
* All scale frames
|
||||||
*/
|
*/
|
||||||
TreeMap<Double,Keyframe> scaleFrameTree;
|
private TreeMap<Double,Keyframe> scaleFrameTree;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an anim channel
|
* Creates an anim channel
|
||||||
|
* @param nodeId The node ID
|
||||||
* @param maxTime The max time of the channel
|
* @param maxTime The max time of the channel
|
||||||
* @param ticksPerSecond The ticks per second
|
* @param ticksPerSecond The ticks per second
|
||||||
*/
|
*/
|
||||||
public AnimChannel(double maxTime, double ticksPerSecond){
|
public AnimChannel(String nodeId, double maxTime, double ticksPerSecond){
|
||||||
timeTotal = maxTime;
|
timeTotal = maxTime;
|
||||||
|
this.nodeID = nodeId;
|
||||||
this.ticksPerSecond = ticksPerSecond;
|
this.ticksPerSecond = ticksPerSecond;
|
||||||
positionFrameTree = new TreeMap<Double,Keyframe>();
|
positionFrameTree = new TreeMap<Double,Keyframe>();
|
||||||
rotationFrameTree = new TreeMap<Double,Keyframe>();
|
rotationFrameTree = new TreeMap<Double,Keyframe>();
|
||||||
@ -327,6 +319,14 @@ public class AnimChannel {
|
|||||||
timeCurrent = 0;
|
timeCurrent = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the ticks per second
|
||||||
|
* @return The ticks per second
|
||||||
|
*/
|
||||||
|
public double getTicksPerSecond(){
|
||||||
|
return this.ticksPerSecond;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Describes the channel at a high level
|
* Describes the channel at a high level
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -65,7 +65,7 @@ public class Animation {
|
|||||||
/**
|
/**
|
||||||
* The map of bone name to animation channel
|
* The map of bone name to animation channel
|
||||||
*/
|
*/
|
||||||
Map<String, AnimChannel> channelMap;
|
private Map<String, AnimChannel> channelMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an animation
|
* Creates an animation
|
||||||
@ -95,11 +95,11 @@ public class Animation {
|
|||||||
AINodeAnim currentChannelData = AINodeAnim.create(animData.mChannels().get(i));
|
AINodeAnim currentChannelData = AINodeAnim.create(animData.mChannels().get(i));
|
||||||
|
|
||||||
//Create channel
|
//Create channel
|
||||||
AnimChannel currentChannel = new AnimChannel(duration,ticksPerSecond);
|
String nodeId = currentChannelData.mNodeName().dataString();
|
||||||
currentChannel.nodeID = currentChannelData.mNodeName().dataString();
|
AnimChannel currentChannel = new AnimChannel(nodeId,duration,ticksPerSecond);
|
||||||
channels.add(currentChannel);
|
channels.add(currentChannel);
|
||||||
|
|
||||||
channelMap.put(currentChannel.nodeID,currentChannel);
|
channelMap.put(nodeId,currentChannel);
|
||||||
|
|
||||||
|
|
||||||
//get channel data
|
//get channel data
|
||||||
@ -118,7 +118,6 @@ public class Animation {
|
|||||||
);
|
);
|
||||||
currentFrame.position = new Vector3f((float)positionRaw.x,(float)positionRaw.y,(float)positionRaw.z);
|
currentFrame.position = new Vector3f((float)positionRaw.x,(float)positionRaw.y,(float)positionRaw.z);
|
||||||
currentChannel.addPositionFrame(time,currentFrame);
|
currentChannel.addPositionFrame(time,currentFrame);
|
||||||
currentChannel.startingPosition = currentFrame.position;
|
|
||||||
|
|
||||||
Keyframe previousFrame;
|
Keyframe previousFrame;
|
||||||
while(buff.hasRemaining()){
|
while(buff.hasRemaining()){
|
||||||
@ -155,8 +154,6 @@ public class Animation {
|
|||||||
currentFrame.rotation.set(key.mValue().x(), key.mValue().y(), key.mValue().z(), key.mValue().w());
|
currentFrame.rotation.set(key.mValue().x(), key.mValue().y(), key.mValue().z(), key.mValue().w());
|
||||||
currentChannel.addRotationFrame(time,currentFrame);
|
currentChannel.addRotationFrame(time,currentFrame);
|
||||||
|
|
||||||
currentChannel.startingRotation = currentFrame.rotation;
|
|
||||||
|
|
||||||
Keyframe previousFrame;
|
Keyframe previousFrame;
|
||||||
while(buff.hasRemaining()){
|
while(buff.hasRemaining()){
|
||||||
previousFrame = currentFrame;
|
previousFrame = currentFrame;
|
||||||
|
|||||||
@ -11,22 +11,22 @@ public class Keyframe implements Comparable<Keyframe>{
|
|||||||
/**
|
/**
|
||||||
* The time the keyframe occurs at
|
* The time the keyframe occurs at
|
||||||
*/
|
*/
|
||||||
double time;
|
protected double time;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The position of the keyframe
|
* The position of the keyframe
|
||||||
*/
|
*/
|
||||||
Vector3f position;
|
protected Vector3f position;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The rotation of the keyframe
|
* The rotation of the keyframe
|
||||||
*/
|
*/
|
||||||
Quaterniond rotation;
|
protected Quaterniond rotation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The scale of the keyframe
|
* The scale of the keyframe
|
||||||
*/
|
*/
|
||||||
Vector3f scale;
|
protected Vector3f scale;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a keyframe
|
* Creates a keyframe
|
||||||
|
|||||||
@ -14,10 +14,16 @@ import org.joml.Vector3d;
|
|||||||
* TODO: Transform Animations
|
* TODO: Transform Animations
|
||||||
*/
|
*/
|
||||||
public class ModelPretransforms {
|
public class ModelPretransforms {
|
||||||
//List of models as read from disk, not used after being init'd
|
|
||||||
List<ModelMetadata> models;
|
/**
|
||||||
//Map relating path->model metadata
|
* List of models as read from disk, not used after being init'd
|
||||||
Map<String,ModelMetadata> modelDataMap;
|
*/
|
||||||
|
private List<ModelMetadata> models;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Map relating path->model metadata
|
||||||
|
*/
|
||||||
|
private Map<String,ModelMetadata> modelDataMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes the model pretransform storage
|
* Initializes the model pretransform storage
|
||||||
@ -43,14 +49,25 @@ public class ModelPretransforms {
|
|||||||
* Stores metadata about a single model
|
* Stores metadata about a single model
|
||||||
*/
|
*/
|
||||||
public class ModelMetadata {
|
public class ModelMetadata {
|
||||||
//The path of the model
|
/**
|
||||||
String path;
|
* The path of the model
|
||||||
//List of meshes as read from disk, not used after being init'd
|
*/
|
||||||
List<MeshMetadata> meshes;
|
private String path;
|
||||||
//Map relating path->mesh metadata
|
|
||||||
Map<String,MeshMetadata> meshDataMap;
|
/**
|
||||||
//Optional global transform
|
* List of meshes as read from disk, not used after being init'd
|
||||||
GlobalTransform globalTransform;
|
*/
|
||||||
|
private List<MeshMetadata> meshes;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Map relating path->mesh metadata
|
||||||
|
*/
|
||||||
|
private Map<String,MeshMetadata> meshDataMap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Optional global transform
|
||||||
|
*/
|
||||||
|
private GlobalTransform globalTransform;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes the ModelMetadata object
|
* Initializes the ModelMetadata object
|
||||||
|
|||||||
@ -16,7 +16,7 @@ public class TextureMap {
|
|||||||
/**
|
/**
|
||||||
* The map of modelPath -> list of texture map entries
|
* The map of modelPath -> list of texture map entries
|
||||||
*/
|
*/
|
||||||
Map<String,ModelTextureData> textureMap = new HashMap<String,ModelTextureData>();
|
private Map<String,ModelTextureData> textureMap = new HashMap<String,ModelTextureData>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads a texture map from a given path
|
* Reads a texture map from a given path
|
||||||
@ -96,12 +96,12 @@ public class TextureMap {
|
|||||||
/**
|
/**
|
||||||
* The map of mesh name -> texture data
|
* The map of mesh name -> texture data
|
||||||
*/
|
*/
|
||||||
Map<String,MeshTextureData> meshData = new HashMap<String,MeshTextureData>();
|
private Map<String,MeshTextureData> meshData = new HashMap<String,MeshTextureData>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The default data to apply
|
* The default data to apply
|
||||||
*/
|
*/
|
||||||
MeshTextureData defaultMeshData = null;
|
private MeshTextureData defaultMeshData = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs an object to track texture data for a whole model
|
* Constructs an object to track texture data for a whole model
|
||||||
@ -145,28 +145,28 @@ public class TextureMap {
|
|||||||
/**
|
/**
|
||||||
* The name of the mesh
|
* The name of the mesh
|
||||||
*/
|
*/
|
||||||
String meshName;
|
private String meshName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The specular texture's path
|
* The specular texture's path
|
||||||
*/
|
*/
|
||||||
String specular;
|
private String specular;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The diffuse texture's path
|
* The diffuse texture's path
|
||||||
*/
|
*/
|
||||||
String diffuse;
|
private String diffuse;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If this is true, this entry will be used for all meshes that don't have a defined entry
|
* If this is true, this entry will be used for all meshes that don't have a defined entry
|
||||||
*/
|
*/
|
||||||
boolean isDefault;
|
private boolean isDefault;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the name of the mesh
|
* Gets the name of the mesh
|
||||||
* @return The name of the mesh
|
* @return The name of the mesh
|
||||||
*/
|
*/
|
||||||
String getMeshName(){
|
public String getMeshName(){
|
||||||
return meshName;
|
return meshName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -205,7 +205,7 @@ public class TextureMap {
|
|||||||
/**
|
/**
|
||||||
* Raw format on disk
|
* Raw format on disk
|
||||||
*/
|
*/
|
||||||
Map<String,List<MeshTextureData>> textureMap;
|
private Map<String,List<MeshTextureData>> textureMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the raw texture map data
|
* Gets the raw texture map data
|
||||||
|
|||||||
@ -11,51 +11,226 @@ public interface Element {
|
|||||||
*/
|
*/
|
||||||
public static final int NULL_YOGA_ELEMENT = -1;
|
public static final int NULL_YOGA_ELEMENT = -1;
|
||||||
|
|
||||||
//width and height
|
//
|
||||||
|
//dimensions-related
|
||||||
|
//
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the width of the element
|
||||||
|
* @return The width
|
||||||
|
*/
|
||||||
public int getWidth();
|
public int getWidth();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the height of the element
|
||||||
|
* @return The height
|
||||||
|
*/
|
||||||
public int getHeight();
|
public int getHeight();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the width of the eleement
|
||||||
|
* @param width The width
|
||||||
|
*/
|
||||||
public void setWidth(int width);
|
public void setWidth(int width);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the width as a percentage
|
||||||
|
* @param width The percentage
|
||||||
|
*/
|
||||||
public void setWidthPercent(float width);
|
public void setWidthPercent(float width);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the height of the element
|
||||||
|
* @param height The height
|
||||||
|
*/
|
||||||
public void setHeight(int height);
|
public void setHeight(int height);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the height as a percentage
|
||||||
|
* @param height The percentage
|
||||||
|
*/
|
||||||
public void setHeightPercent(float height);
|
public void setHeightPercent(float height);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the max width of the element
|
||||||
|
* @param width The max width
|
||||||
|
*/
|
||||||
public void setMaxWidth(int width);
|
public void setMaxWidth(int width);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the max width as a percentage
|
||||||
|
* @param percent The width as a percentage
|
||||||
|
*/
|
||||||
public void setMaxWidthPercent(float percent);
|
public void setMaxWidthPercent(float percent);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the max height
|
||||||
|
* @param height The height
|
||||||
|
*/
|
||||||
public void setMaxHeight(int height);
|
public void setMaxHeight(int height);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the max height as a percentage
|
||||||
|
* @param percent The max height
|
||||||
|
*/
|
||||||
public void setMaxHeightPercent(float percent);
|
public void setMaxHeightPercent(float percent);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the min width
|
||||||
|
* @param width The min width
|
||||||
|
*/
|
||||||
public void setMinWidth(int width);
|
public void setMinWidth(int width);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the min width as a percentage
|
||||||
|
* @param percent The min width as a percentage
|
||||||
|
*/
|
||||||
public void setMinWidthPercent(float percent);
|
public void setMinWidthPercent(float percent);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the min height
|
||||||
|
* @param height The min height
|
||||||
|
*/
|
||||||
public void setMinHeight(int height);
|
public void setMinHeight(int height);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the min height s a percentage
|
||||||
|
* @param percent The min height as a percentage
|
||||||
|
*/
|
||||||
public void setMinHeightPercent(float percent);
|
public void setMinHeightPercent(float percent);
|
||||||
|
|
||||||
|
//
|
||||||
//position
|
//position
|
||||||
|
//
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the relative x
|
||||||
|
* @return The x position
|
||||||
|
*/
|
||||||
public int getRelativeX();
|
public int getRelativeX();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the relative y
|
||||||
|
* @return The y position
|
||||||
|
*/
|
||||||
public int getRelativeY();
|
public int getRelativeY();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the absolute x
|
||||||
|
* @return The absolute x
|
||||||
|
*/
|
||||||
public int getAbsoluteX();
|
public int getAbsoluteX();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the absolute y
|
||||||
|
* @return The absolute y
|
||||||
|
*/
|
||||||
public int getAbsoluteY();
|
public int getAbsoluteY();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the x position
|
||||||
|
* @param positionX The x position
|
||||||
|
*/
|
||||||
public void setPositionX(int positionX);
|
public void setPositionX(int positionX);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the y position
|
||||||
|
* @param positionY The y position
|
||||||
|
*/
|
||||||
public void setPositionY(int positionY);
|
public void setPositionY(int positionY);
|
||||||
|
|
||||||
//position-related
|
/**
|
||||||
|
* Sets whether should use absolute position or not
|
||||||
|
* @param useAbsolutePosition true to use absolute position, false otherwise
|
||||||
|
*/
|
||||||
public void setAbsolutePosition(boolean useAbsolutePosition);
|
public void setAbsolutePosition(boolean useAbsolutePosition);
|
||||||
|
|
||||||
|
//
|
||||||
//parent data
|
//parent data
|
||||||
|
//
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the parent element
|
||||||
|
* @return The parent element
|
||||||
|
*/
|
||||||
public ContainerElement getParent();
|
public ContainerElement getParent();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the parent element
|
||||||
|
* @param parent THe parent element
|
||||||
|
*/
|
||||||
public void setParent(ContainerElement parent);
|
public void setParent(ContainerElement parent);
|
||||||
|
|
||||||
|
//
|
||||||
//margin
|
//margin
|
||||||
|
//
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the top margin
|
||||||
|
* @param marginTop The top margin
|
||||||
|
*/
|
||||||
public void setMarginTop(int marginTop);
|
public void setMarginTop(int marginTop);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the right margin
|
||||||
|
* @param marginRight The right margin
|
||||||
|
*/
|
||||||
public void setMarginRight(int marginRight);
|
public void setMarginRight(int marginRight);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the bottom margin
|
||||||
|
* @param marginBottom The bottom margin
|
||||||
|
*/
|
||||||
public void setMarginBottom(int marginBottom);
|
public void setMarginBottom(int marginBottom);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the left margin
|
||||||
|
* @param marginLeft The left margin
|
||||||
|
*/
|
||||||
public void setMarginLeft(int marginLeft);
|
public void setMarginLeft(int marginLeft);
|
||||||
|
|
||||||
|
//
|
||||||
//padding
|
//padding
|
||||||
|
//
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the top padding
|
||||||
|
* @param paddingTop The top padding
|
||||||
|
*/
|
||||||
public void setPaddingTop(int paddingTop);
|
public void setPaddingTop(int paddingTop);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the right padding
|
||||||
|
* @param paddingRight The right padding
|
||||||
|
*/
|
||||||
public void setPaddingRight(int paddingRight);
|
public void setPaddingRight(int paddingRight);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the bottom padding
|
||||||
|
* @param paddingBottom The bottom padding
|
||||||
|
*/
|
||||||
public void setPaddingBottom(int paddingBottom);
|
public void setPaddingBottom(int paddingBottom);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the left padding
|
||||||
|
* @param paddingLeft The left padding
|
||||||
|
*/
|
||||||
public void setPaddingLeft(int paddingLeft);
|
public void setPaddingLeft(int paddingLeft);
|
||||||
|
|
||||||
|
//
|
||||||
//positioning
|
//positioning
|
||||||
|
//
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the position type
|
||||||
|
* @param positionType The position type
|
||||||
|
*/
|
||||||
public void setPositionType(YogaPositionType positionType);
|
public void setPositionType(YogaPositionType positionType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the position type
|
||||||
|
* @return The position type
|
||||||
|
*/
|
||||||
public YogaPositionType getPositionType();
|
public YogaPositionType getPositionType();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -68,17 +243,22 @@ public interface Element {
|
|||||||
//
|
//
|
||||||
//Maintenance related
|
//Maintenance related
|
||||||
//
|
//
|
||||||
|
/**
|
||||||
|
* Destroys the element
|
||||||
|
*/
|
||||||
public void destroy();
|
public void destroy();
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Y O G A
|
// Y O G A
|
||||||
//
|
//
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the yoga node id
|
* Gets the yoga node id
|
||||||
* @return the yoga node id
|
* @return the yoga node id
|
||||||
*/
|
*/
|
||||||
public long getYogaNode();
|
public long getYogaNode();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Applies the yoga values to this component
|
* Applies the yoga values to this component
|
||||||
*/
|
*/
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user