commit
b84bd0d120
@ -0,0 +1,66 @@ |
||||
/* |
||||
* Copyright (c) 2009-2015 jMonkeyEngine |
||||
* All rights reserved. |
||||
* |
||||
* Redistribution and use in source and binary forms, with or without |
||||
* modification, are permitted provided that the following conditions are |
||||
* met: |
||||
* |
||||
* * Redistributions of source code must retain the above copyright |
||||
* notice, this list of conditions and the following disclaimer. |
||||
* |
||||
* * Redistributions in binary form must reproduce the above copyright |
||||
* notice, this list of conditions and the following disclaimer in the |
||||
* documentation and/or other materials provided with the distribution. |
||||
* |
||||
* * Neither the name of 'jMonkeyEngine' nor the names of its contributors |
||||
* may be used to endorse or promote products derived from this software |
||||
* without specific prior written permission. |
||||
* |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||
*/ |
||||
package com.jme3.system; |
||||
|
||||
import java.io.IOException; |
||||
import java.util.Properties; |
||||
import java.util.logging.Level; |
||||
import java.util.logging.Logger; |
||||
|
||||
/** |
||||
* Pulls in version info from the version.properties file. |
||||
* |
||||
* @author Kirill Vainer |
||||
*/ |
||||
public class JmeVersion { |
||||
|
||||
private static final Logger logger = Logger.getLogger(JmeVersion.class.getName()); |
||||
private static final Properties props = new Properties(); |
||||
|
||||
static { |
||||
try { |
||||
props.load(JmeVersion.class.getResourceAsStream("version.properties")); |
||||
} catch (IOException ex) { |
||||
logger.log(Level.WARNING, "Unable to read version info!", ex); |
||||
} |
||||
} |
||||
|
||||
public static final String BUILD_DATE = props.getProperty("build.date", "1900-01-01"); |
||||
public static final String BRANCH_NAME = props.getProperty("git.branch", "unknown"); |
||||
public static final String GIT_HASH = props.getProperty("git.hash", ""); |
||||
public static final String GIT_SHORT_HASH = props.getProperty("git.hash.short", ""); |
||||
public static final String GIT_TAG = props.getProperty("git.tag", ""); |
||||
public static final String VERSION_NUMBER = props.getProperty("version.number", ""); |
||||
public static final String VERSION_TAG = props.getProperty("version.tag", ""); |
||||
public static final String VERSION_FULL = props.getProperty("version.full", ""); |
||||
public static final String FULL_NAME = props.getProperty("name.full", "jMonkeyEngine (unknown version)"); |
||||
} |
@ -1,14 +0,0 @@ |
||||
#if _VERSION_ >= 150 |
||||
out vec4 outFragColor; |
||||
# define texture1D texture |
||||
# define texture2D texture |
||||
# define texture3D texture |
||||
# define texture2DLod texture |
||||
# if defined VERTEX_SHADER |
||||
# define varying out |
||||
# define attribute in |
||||
# elif defined FRAGMENT_SHADER |
||||
# define varying in |
||||
# define gl_FragColor outFragColor |
||||
# endif |
||||
#endif |
@ -0,0 +1,34 @@ |
||||
#if defined _GL_ES_ |
||||
# define hfloat highp float |
||||
# define hvec2 highp vec2 |
||||
# define hvec3 highp vec3 |
||||
# define hvec4 highp vec4 |
||||
# define lfloat lowp float |
||||
# define lvec2 lowp vec2 |
||||
# define lvec3 lowp vec3 |
||||
# define lvec4 lowp vec4 |
||||
#else |
||||
# define hfloat float |
||||
# define hvec2 vec2 |
||||
# define hvec3 vec3 |
||||
# define hvec4 vec4 |
||||
# define lfloat float |
||||
# define lvec2 vec2 |
||||
# define lvec3 vec3 |
||||
# define lvec4 vec4 |
||||
#endif |
||||
|
||||
#if __VERSION__ >= 130 |
||||
out vec4 outFragColor; |
||||
# define texture1D texture |
||||
# define texture2D texture |
||||
# define texture3D texture |
||||
# define texture2DLod texture |
||||
# if defined VERTEX_SHADER |
||||
# define varying out |
||||
# define attribute in |
||||
# elif defined FRAGMENT_SHADER |
||||
# define varying in |
||||
# define gl_FragColor outFragColor |
||||
# endif |
||||
#endif |
@ -0,0 +1,11 @@ |
||||
# THIS IS AN AUTO-GENERATED FILE.. |
||||
# DO NOT MODIFY! |
||||
build.date=1900-01-01 |
||||
git.revision=0 |
||||
git.branch=unknown |
||||
git.hash= |
||||
git.hash.short= |
||||
git.tag= |
||||
name.full=jMonkeyEngine 3.1.0-UNKNOWN |
||||
version.number=3.1.0 |
||||
version.tag=SNAPSHOT |
@ -0,0 +1,69 @@ |
||||
/* |
||||
* Copyright (c) 2009-2015 jMonkeyEngine |
||||
* All rights reserved. |
||||
* |
||||
* Redistribution and use in source and binary forms, with or without |
||||
* modification, are permitted provided that the following conditions are |
||||
* met: |
||||
* |
||||
* * Redistributions of source code must retain the above copyright |
||||
* notice, this list of conditions and the following disclaimer. |
||||
* |
||||
* * Redistributions in binary form must reproduce the above copyright |
||||
* notice, this list of conditions and the following disclaimer in the |
||||
* documentation and/or other materials provided with the distribution. |
||||
* |
||||
* * Neither the name of 'jMonkeyEngine' nor the names of its contributors |
||||
* may be used to endorse or promote products derived from this software |
||||
* without specific prior written permission. |
||||
* |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||
*/ |
||||
package com.jme3.cinematic; |
||||
|
||||
import com.jme3.animation.AnimControl; |
||||
import com.jme3.animation.Animation; |
||||
import com.jme3.cinematic.events.AnimationEvent; |
||||
import com.jme3.scene.Node; |
||||
import org.junit.Test; |
||||
|
||||
/** |
||||
* |
||||
* @author davidB |
||||
*/ |
||||
public class CinematicTest { |
||||
|
||||
/** |
||||
* No NPE or any exception when clear() a new Cinematic |
||||
*/ |
||||
@Test |
||||
public void clearEmpty() { |
||||
Cinematic sut = new Cinematic(); |
||||
sut.clear(); |
||||
} |
||||
|
||||
/** |
||||
* No ClassCastException when clear() a Cinematic with AnimationEvent |
||||
*/ |
||||
@Test |
||||
public void clearAnimationEvent() { |
||||
Cinematic sut = new Cinematic(); |
||||
Node model = new Node("model"); |
||||
AnimControl ac = new AnimControl(); |
||||
ac.addAnim(new Animation("animName", 1.0f)); |
||||
model.addControl(ac); |
||||
sut.enqueueCinematicEvent(new AnimationEvent(model, "animName")); |
||||
sut.initialize(null, null); |
||||
sut.clear(); |
||||
} |
||||
} |
@ -0,0 +1,594 @@ |
||||
package com.jme3.renderer.jogl; |
||||
|
||||
import com.jme3.renderer.RendererException; |
||||
import com.jme3.renderer.opengl.GL; |
||||
import com.jme3.renderer.opengl.GL2; |
||||
import com.jme3.renderer.opengl.GL3; |
||||
|
||||
import java.nio.Buffer; |
||||
import java.nio.ByteBuffer; |
||||
import java.nio.ByteOrder; |
||||
import java.nio.FloatBuffer; |
||||
import java.nio.IntBuffer; |
||||
import java.nio.ShortBuffer; |
||||
|
||||
import com.jme3.renderer.opengl.GL4; |
||||
import com.jogamp.opengl.GLContext; |
||||
|
||||
public class JoglGL implements GL, GL2, GL3, GL4 { |
||||
|
||||
private static int getLimitBytes(ByteBuffer buffer) { |
||||
checkLimit(buffer); |
||||
return buffer.limit(); |
||||
} |
||||
|
||||
private static int getLimitBytes(ShortBuffer buffer) { |
||||
checkLimit(buffer); |
||||
return buffer.limit() * 2; |
||||
} |
||||
|
||||
private static int getLimitBytes(FloatBuffer buffer) { |
||||
checkLimit(buffer); |
||||
return buffer.limit() * 4; |
||||
} |
||||
|
||||
private static int getLimitCount(Buffer buffer, int elementSize) { |
||||
checkLimit(buffer); |
||||
return buffer.limit() / elementSize; |
||||
} |
||||
|
||||
private static void checkLimit(Buffer buffer) { |
||||
if (buffer == null) { |
||||
return; |
||||
} |
||||
if (buffer.limit() == 0) { |
||||
throw new RendererException("Attempting to upload empty buffer (limit = 0), that's an error"); |
||||
} |
||||
if (buffer.remaining() == 0) { |
||||
throw new RendererException("Attempting to upload empty buffer (remaining = 0), that's an error"); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public void resetStats() { |
||||
} |
||||
|
||||
@Override |
||||
public void glActiveTexture(int param1) { |
||||
GLContext.getCurrentGL().glActiveTexture(param1); |
||||
} |
||||
|
||||
@Override |
||||
public void glAlphaFunc(int param1, float param2) { |
||||
GLContext.getCurrentGL().getGL2ES1().glAlphaFunc(param1, param2); |
||||
} |
||||
|
||||
@Override |
||||
public void glAttachShader(int param1, int param2) { |
||||
GLContext.getCurrentGL().getGL2ES2().glAttachShader(param1, param2); |
||||
} |
||||
|
||||
@Override |
||||
public void glBindBuffer(int param1, int param2) { |
||||
GLContext.getCurrentGL().glBindBuffer(param1, param2); |
||||
} |
||||
|
||||
@Override |
||||
public void glBindTexture(int param1, int param2) { |
||||
GLContext.getCurrentGL().glBindTexture(param1, param2); |
||||
} |
||||
|
||||
@Override |
||||
public void glBlendFunc(int param1, int param2) { |
||||
GLContext.getCurrentGL().glBlendFunc(param1, param2); |
||||
} |
||||
|
||||
@Override |
||||
public void glBufferData(int param1, long param2, int param3) { |
||||
GLContext.getCurrentGL().glBufferData(param1, param2, null, param3); |
||||
} |
||||
|
||||
@Override |
||||
public void glBufferData(int param1, FloatBuffer param2, int param3) { |
||||
checkLimit(param2); |
||||
GLContext.getCurrentGL().glBufferData(param1, getLimitBytes(param2), param2, param3); |
||||
} |
||||
|
||||
@Override |
||||
public void glBufferData(int param1, ShortBuffer param2, int param3) { |
||||
checkLimit(param2); |
||||
GLContext.getCurrentGL().glBufferData(param1, getLimitBytes(param2), param2, param3); |
||||
} |
||||
|
||||
@Override |
||||
public void glBufferData(int param1, ByteBuffer param2, int param3) { |
||||
checkLimit(param2); |
||||
GLContext.getCurrentGL().glBufferData(param1, getLimitBytes(param2), param2, param3); |
||||
} |
||||
|
||||
@Override |
||||
public void glBufferSubData(int param1, long param2, FloatBuffer param3) { |
||||
checkLimit(param3); |
||||
GLContext.getCurrentGL().glBufferSubData(param1, param2, getLimitBytes(param3), param3); |
||||
} |
||||
|
||||
@Override |
||||
public void glBufferSubData(int param1, long param2, ShortBuffer param3) { |
||||
checkLimit(param3); |
||||
GLContext.getCurrentGL().glBufferSubData(param1, param2, getLimitBytes(param3), param3); |
||||
} |
||||
|
||||
@Override |
||||
public void glBufferSubData(int param1, long param2, ByteBuffer param3) { |
||||
checkLimit(param3); |
||||
GLContext.getCurrentGL().glBufferSubData(param1, param2, getLimitBytes(param3), param3); |
||||
} |
||||
|
||||
@Override |
||||
public void glClear(int param1) { |
||||
GLContext.getCurrentGL().glClear(param1); |
||||
} |
||||
|
||||
@Override |
||||
public void glClearColor(float param1, float param2, float param3, float param4) { |
||||
GLContext.getCurrentGL().glClearColor(param1, param2, param3, param4); |
||||
} |
||||
|
||||
@Override |
||||
public void glColorMask(boolean param1, boolean param2, boolean param3, boolean param4) { |
||||
GLContext.getCurrentGL().glColorMask(param1, param2, param3, param4); |
||||
} |
||||
|
||||
@Override |
||||
public void glCompileShader(int param1) { |
||||
GLContext.getCurrentGL().getGL2ES2().glCompileShader(param1); |
||||
} |
||||
|
||||
@Override |
||||
public void glCompressedTexImage2D(int param1, int param2, int param3, int param4, int param5, int param6, ByteBuffer param7) { |
||||
checkLimit(param7); |
||||
GLContext.getCurrentGL().glCompressedTexImage2D(param1, param2, param3, param4, param5, param6, getLimitBytes(param7), param7); |
||||
} |
||||
|
||||
@Override |
||||
public void glCompressedTexImage3D(int param1, int param2, int param3, int param4, int param5, int param6, int param7, ByteBuffer param8) { |
||||
checkLimit(param8); |
||||
GLContext.getCurrentGL().getGL2ES2().glCompressedTexImage3D(param1, param2, param3, param4, param5, param6, param7, getLimitBytes(param8), param8); |
||||
} |
||||
|
||||
@Override |
||||
public void glCompressedTexSubImage2D(int param1, int param2, int param3, int param4, int param5, int param6, int param7, ByteBuffer param8) { |
||||
checkLimit(param8); |
||||
GLContext.getCurrentGL().glCompressedTexSubImage2D(param1, param2, param3, param4, param5, param6, param7, getLimitBytes(param8), param8); |
||||
} |
||||
|
||||
@Override |
||||
public void glCompressedTexSubImage3D(int param1, int param2, int param3, int param4, int param5, int param6, int param7, int param8, int param9, ByteBuffer param10) { |
||||
checkLimit(param10); |
||||
GLContext.getCurrentGL().getGL2ES2().glCompressedTexSubImage3D(param1, param2, param3, param4, param5, param6, param7, param8, param9, getLimitBytes(param10), param10); |
||||
} |
||||
|
||||
@Override |
||||
public int glCreateProgram() { |
||||
return GLContext.getCurrentGL().getGL2ES2().glCreateProgram(); |
||||
} |
||||
|
||||
@Override |
||||
public int glCreateShader(int param1) { |
||||
return GLContext.getCurrentGL().getGL2ES2().glCreateShader(param1); |
||||
} |
||||
|
||||
@Override |
||||
public void glCullFace(int param1) { |
||||
GLContext.getCurrentGL().glCullFace(param1); |
||||
} |
||||
|
||||
@Override |
||||
public void glDeleteBuffers(IntBuffer param1) { |
||||
checkLimit(param1); |
||||
GLContext.getCurrentGL().glDeleteBuffers(param1.limit(), param1); |
||||
} |
||||
|
||||
@Override |
||||
public void glDeleteProgram(int param1) { |
||||
GLContext.getCurrentGL().getGL2ES2().glDeleteProgram(param1); |
||||
} |
||||
|
||||
@Override |
||||
public void glDeleteShader(int param1) { |
||||
GLContext.getCurrentGL().getGL2ES2().glDeleteShader(param1); |
||||
} |
||||
|
||||
@Override |
||||
public void glDeleteTextures(IntBuffer param1) { |
||||
checkLimit(param1); |
||||
GLContext.getCurrentGL().glDeleteTextures(param1.limit() ,param1); |
||||
} |
||||
|
||||
@Override |
||||
public void glDepthFunc(int param1) { |
||||
GLContext.getCurrentGL().glDepthFunc(param1); |
||||
} |
||||
|
||||
@Override |
||||
public void glDepthMask(boolean param1) { |
||||
GLContext.getCurrentGL().glDepthMask(param1); |
||||
} |
||||
|
||||
@Override |
||||
public void glDepthRange(double param1, double param2) { |
||||
GLContext.getCurrentGL().glDepthRange(param1, param2); |
||||
} |
||||
|
||||
@Override |
||||
public void glDetachShader(int param1, int param2) { |
||||
GLContext.getCurrentGL().getGL2ES2().glDetachShader(param1, param2); |
||||
} |
||||
|
||||
@Override |
||||
public void glDisable(int param1) { |
||||
GLContext.getCurrentGL().glDisable(param1); |
||||
} |
||||
|
||||
@Override |
||||
public void glDisableVertexAttribArray(int param1) { |
||||
GLContext.getCurrentGL().getGL2ES2().glDisableVertexAttribArray(param1); |
||||
} |
||||
|
||||
@Override |
||||
public void glDrawArrays(int param1, int param2, int param3) { |
||||
GLContext.getCurrentGL().glDrawArrays(param1, param2, param3); |
||||
} |
||||
|
||||
@Override |
||||
public void glDrawBuffer(int param1) { |
||||
GLContext.getCurrentGL().getGL2GL3().glDrawBuffer(param1); |
||||
} |
||||
|
||||
@Override |
||||
public void glDrawRangeElements(int param1, int param2, int param3, int param4, int param5, long param6) { |
||||
GLContext.getCurrentGL().getGL2ES3().glDrawRangeElements(param1, param2, param3, param4, param5, param6); |
||||
} |
||||
|
||||
@Override |
||||
public void glEnable(int param1) { |
||||
GLContext.getCurrentGL().glEnable(param1); |
||||
} |
||||
|
||||
@Override |
||||
public void glEnableVertexAttribArray(int param1) { |
||||
GLContext.getCurrentGL().getGL2ES2().glEnableVertexAttribArray(param1); |
||||
} |
||||
|
||||
@Override |
||||
public void glGenBuffers(IntBuffer param1) { |
||||
checkLimit(param1); |
||||
GLContext.getCurrentGL().glGenBuffers(param1.limit(), param1); |
||||
} |
||||
|
||||
@Override |
||||
public void glGenTextures(IntBuffer param1) { |
||||
checkLimit(param1); |
||||
GLContext.getCurrentGL().glGenTextures(param1.limit(), param1); |
||||
} |
||||
|
||||
@Override |
||||
public void glGetBoolean(int param1, ByteBuffer param2) { |
||||
checkLimit(param2); |
||||
GLContext.getCurrentGL().glGetBooleanv(param1, param2); |
||||
} |
||||
|
||||
@Override |
||||
public void glGetBufferSubData(int target, long offset, ByteBuffer data) { |
||||
checkLimit(data); |
||||
GLContext.getCurrentGL().getGL2GL3().glGetBufferSubData(target, offset, getLimitBytes(data), data); |
||||
} |
||||
|
||||
@Override |
||||
public int glGetError() { |
||||
return GLContext.getCurrentGL().glGetError(); |
||||
} |
||||
|
||||
@Override |
||||
public void glGetInteger(int param1, IntBuffer param2) { |
||||
checkLimit(param2); |
||||
GLContext.getCurrentGL().glGetIntegerv(param1, param2); |
||||
} |
||||
|
||||
@Override |
||||
public void glGetProgram(int param1, int param2, IntBuffer param3) { |
||||
checkLimit(param3); |
||||
GLContext.getCurrentGL().getGL2ES2().glGetProgramiv(param1, param2, param3); |
||||
} |
||||
|
||||
@Override |
||||
public void glGetShader(int param1, int param2, IntBuffer param3) { |
||||
checkLimit(param3); |
||||
GLContext.getCurrentGL().getGL2ES2().glGetShaderiv(param1, param2, param3); |
||||
} |
||||
|
||||
@Override |
||||
public String glGetString(int param1) { |
||||
return GLContext.getCurrentGL().glGetString(param1); |
||||
} |
||||
|
||||
@Override |
||||
public String glGetString(int param1, int param2) { |
||||
return GLContext.getCurrentGL().getGL2ES3().glGetStringi(param1, param2); |
||||
} |
||||
|
||||
@Override |
||||
public boolean glIsEnabled(int param1) { |
||||
return GLContext.getCurrentGL().glIsEnabled(param1); |
||||
} |
||||
|
||||
@Override |
||||
public void glLineWidth(float param1) { |
||||
GLContext.getCurrentGL().glLineWidth(param1); |
||||
} |
||||
|
||||
@Override |
||||
public void glLinkProgram(int param1) { |
||||
GLContext.getCurrentGL().getGL2ES2().glLinkProgram(param1); |
||||
} |
||||
|
||||
@Override |
||||
public void glPixelStorei(int param1, int param2) { |
||||
GLContext.getCurrentGL().glPixelStorei(param1, param2); |
||||
} |
||||
|
||||
@Override |
||||
public void glPointSize(float param1) { |
||||
GLContext.getCurrentGL().getGL2ES1().glPointSize(param1); |
||||
} |
||||
|
||||
@Override |
||||
public void glPolygonMode(int param1, int param2) { |
||||
GLContext.getCurrentGL().getGL2().glPolygonMode(param1, param2); |
||||
} |
||||
|
||||
@Override |
||||
public void glPolygonOffset(float param1, float param2) { |
||||
GLContext.getCurrentGL().glPolygonOffset(param1, param2); |
||||
} |
||||
|
||||
@Override |
||||
public void glReadBuffer(int param1) { |
||||
GLContext.getCurrentGL().getGL2ES3().glReadBuffer(param1); |
||||
} |
||||
|
||||
@Override |
||||
public void glReadPixels(int param1, int param2, int param3, int param4, int param5, int param6, ByteBuffer param7) { |
||||
checkLimit(param7); |
||||
GLContext.getCurrentGL().glReadPixels(param1, param2, param3, param4, param5, param6, param7); |
||||
} |
||||
|
||||
@Override |
||||
public void glReadPixels(int param1, int param2, int param3, int param4, int param5, int param6, long param7) { |
||||
GLContext.getCurrentGL().glReadPixels(param1, param2, param3, param4, param5, param6, param7); |
||||
} |
||||
|
||||
@Override |
||||
public void glScissor(int param1, int param2, int param3, int param4) { |
||||
GLContext.getCurrentGL().glScissor(param1, param2, param3, param4); |
||||
} |
||||
|
||||
@Override |
||||
public void glStencilFuncSeparate(int param1, int param2, int param3, int param4) { |
||||
GLContext.getCurrentGL().getGL2ES2().glStencilFuncSeparate(param1, param2, param3, param4); |
||||
} |
||||
|
||||
@Override |
||||
public void glStencilOpSeparate(int param1, int param2, int param3, int param4) { |
||||
GLContext.getCurrentGL().getGL2ES2().glStencilOpSeparate(param1, param2, param3, param4); |
||||
} |
||||
|
||||
@Override |
||||
public void glTexImage2D(int param1, int param2, int param3, int param4, int param5, int param6, int param7, int param8, ByteBuffer param9) { |
||||
checkLimit(param9); |
||||
GLContext.getCurrentGL().glTexImage2D(param1, param2, param3, param4, param5, param6, param7, param8, param9); |
||||
} |
||||
|
||||
@Override |
||||
public void glTexImage3D(int param1, int param2, int param3, int param4, int param5, int param6, int param7, int param8, int param9, ByteBuffer param10) { |
||||
checkLimit(param10); |
||||
GLContext.getCurrentGL().getGL2ES2().glTexImage3D(param1, param2, param3, param4, param5, param6, param7, param8, param9, param10); |
||||
} |
||||
|
||||
@Override |
||||
public void glTexParameterf(int param1, int param2, float param3) { |
||||
GLContext.getCurrentGL().glTexParameterf(param1, param2, param3); |
||||
} |
||||
|
||||
@Override |
||||
public void glTexParameteri(int param1, int param2, int param3) { |
||||
GLContext.getCurrentGL().glTexParameteri(param1, param2, param3); |
||||
} |
||||
|
||||
@Override |
||||
public void glTexSubImage2D(int param1, int param2, int param3, int param4, int param5, int param6, int param7, int param8, ByteBuffer param9) { |
||||
checkLimit(param9); |
||||
GLContext.getCurrentGL().glTexSubImage2D(param1, param2, param3, param4, param5, param6, param7, param8, param9); |
||||
} |
||||
|
||||
@Override |
||||
public void glTexSubImage3D(int param1, int param2, int param3, int param4, int param5, int param6, int param7, int param8, int param9, int param10, ByteBuffer param11) { |
||||
checkLimit(param11); |
||||
GLContext.getCurrentGL().getGL2ES2().glTexSubImage3D(param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11); |
||||
} |
||||
|
||||
@Override |
||||
public void glUniform1(int param1, FloatBuffer param2) { |
||||
checkLimit(param2); |
||||
GLContext.getCurrentGL().getGL2ES2().glUniform1fv(param1, getLimitCount(param2, 1), param2); |
||||
} |
||||
|
||||
@Override |
||||
public void glUniform1(int param1, IntBuffer param2) { |
||||
checkLimit(param2); |
||||
GLContext.getCurrentGL().getGL2ES2().glUniform1iv(param1, getLimitCount(param2, 1), param2); |
||||
} |
||||
|
||||
@Override |
||||
public void glUniform1f(int param1, float param2) { |
||||
GLContext.getCurrentGL().getGL2ES2().glUniform1f(param1, param2); |
||||
} |
||||
|
||||
@Override |
||||
public void glUniform1i(int param1, int param2) { |
||||
GLContext.getCurrentGL().getGL2ES2().glUniform1i(param1, param2); |
||||
} |
||||
|
||||
@Override |
||||
public void glUniform2(int param1, IntBuffer param2) { |
||||
checkLimit(param2); |
||||
GLContext.getCurrentGL().getGL2ES2().glUniform2iv(param1, getLimitCount(param2, 2), param2); |
||||
} |
||||
|
||||
@Override |
||||
public void glUniform2(int param1, FloatBuffer param2) { |
||||
checkLimit(param2); |
||||
GLContext.getCurrentGL().getGL2ES2().glUniform2fv(param1, getLimitCount(param2, 2), param2); |
||||
} |
||||
|
||||
@Override |
||||
public void glUniform2f(int param1, float param2, float param3) { |
||||
GLContext.getCurrentGL().getGL2ES2().glUniform2f(param1, param2, param3); |
||||
} |
||||
|
||||
@Override |
||||
public void glUniform3(int param1, IntBuffer param2) { |
||||
checkLimit(param2); |
||||
GLContext.getCurrentGL().getGL2ES2().glUniform3iv(param1, getLimitCount(param2, 3), param2); |
||||
} |
||||
|
||||
@Override |
||||
public void glUniform3(int param1, FloatBuffer param2) { |
||||
checkLimit(param2); |
||||
GLContext.getCurrentGL().getGL2ES2().glUniform3fv(param1, getLimitCount(param2, 3), param2); |
||||
} |
||||
|
||||
@Override |
||||
public void glUniform3f(int param1, float param2, float param3, float param4) { |
||||
GLContext.getCurrentGL().getGL2ES2().glUniform3f(param1, param2, param3, param4); |
||||
} |
||||
|
||||
@Override |
||||
public void glUniform4(int param1, FloatBuffer param2) { |
||||
checkLimit(param2); |
||||
GLContext.getCurrentGL().getGL2ES2().glUniform4fv(param1, getLimitCount(param2, 4), param2); |
||||
} |
||||
|
||||
@Override |
||||
public void glUniform4(int param1, IntBuffer param2) { |
||||
checkLimit(param2); |
||||
GLContext.getCurrentGL().getGL2ES2().glUniform4iv(param1, getLimitCount(param2, 4), param2); |
||||
} |
||||
|
||||
@Override |
||||
public void glUniform4f(int param1, float param2, float param3, float param4, float param5) { |
||||
GLContext.getCurrentGL().getGL2ES2().glUniform4f(param1, param2, param3, param4, param5); |
||||
} |
||||
|
||||
@Override |
||||
public void glUniformMatrix3(int param1, boolean param2, FloatBuffer param3) { |
||||
checkLimit(param3); |
||||
GLContext.getCurrentGL().getGL2ES2().glUniformMatrix3fv(param1, getLimitCount(param3, 3 * 3), param2, param3); |
||||
} |
||||
|
||||
@Override |
||||
public void glUniformMatrix4(int param1, boolean param2, FloatBuffer param3) { |
||||
checkLimit(param3); |
||||
GLContext.getCurrentGL().getGL2ES2().glUniformMatrix4fv(param1, getLimitCount(param3, 4 * 4), param2, param3); |
||||
} |
||||
|
||||
@Override |
||||
public void glUseProgram(int param1) { |
||||
GLContext.getCurrentGL().getGL2ES2().glUseProgram(param1); |
||||
} |
||||
|
||||
@Override |
||||
public void glVertexAttribPointer(int param1, int param2, int param3, boolean param4, int param5, long param6) { |
||||
GLContext.getCurrentGL().getGL2ES2().glVertexAttribPointer(param1, param2, param3, param4, param5, param6); |
||||
} |
||||
|
||||
@Override |
||||
public void glViewport(int param1, int param2, int param3, int param4) { |
||||
GLContext.getCurrentGL().glViewport(param1, param2, param3, param4); |
||||
} |
||||
|
||||
@Override |
||||
public int glGetAttribLocation(int param1, String param2) { |
||||
// FIXME: Does JOGL require null-terminated strings?????
|
||||
return GLContext.getCurrentGL().getGL2ES2().glGetAttribLocation(param1, param2 + "\0"); |
||||
} |
||||
|
||||
@Override |
||||
public int glGetUniformLocation(int param1, String param2) { |
||||
// FIXME: Does JOGL require null-terminated strings????????
|
||||
return GLContext.getCurrentGL().getGL2ES2().glGetUniformLocation(param1, param2 + "\0"); |
||||
} |
||||
|
||||
@Override |
||||
public void glShaderSource(int param1, String[] param2, IntBuffer param3) { |
||||
checkLimit(param3); |
||||
GLContext.getCurrentGL().getGL2ES2().glShaderSource(param1, param2.length, param2, param3); |
||||
} |
||||
|
||||
@Override |
||||
public String glGetProgramInfoLog(int program, int maxSize) { |
||||
ByteBuffer buffer = ByteBuffer.allocateDirect(maxSize); |
||||
buffer.order(ByteOrder.nativeOrder()); |
||||
ByteBuffer tmp = ByteBuffer.allocateDirect(4); |
||||
tmp.order(ByteOrder.nativeOrder()); |
||||
IntBuffer intBuffer = tmp.asIntBuffer(); |
||||
|
||||
GLContext.getCurrentGL().getGL2ES2().glGetProgramInfoLog(program, maxSize, intBuffer, buffer); |
||||
int numBytes = intBuffer.get(0); |
||||
byte[] bytes = new byte[numBytes]; |
||||
buffer.get(bytes); |
||||
return new String(bytes); |
||||
} |
||||
|
||||
@Override |
||||
public String glGetShaderInfoLog(int shader, int maxSize) { |
||||
ByteBuffer buffer = ByteBuffer.allocateDirect(maxSize); |
||||
buffer.order(ByteOrder.nativeOrder()); |
||||
ByteBuffer tmp = ByteBuffer.allocateDirect(4); |
||||
tmp.order(ByteOrder.nativeOrder()); |
||||
IntBuffer intBuffer = tmp.asIntBuffer(); |
||||
|
||||
GLContext.getCurrentGL().getGL2ES2().glGetShaderInfoLog(shader, maxSize, intBuffer, buffer); |
||||
int numBytes = intBuffer.get(0); |
||||
byte[] bytes = new byte[numBytes]; |
||||
buffer.get(bytes); |
||||
return new String(bytes); |
||||
} |
||||
|
||||
@Override |
||||
public void glBindFragDataLocation(int param1, int param2, String param3) { |
||||
GLContext.getCurrentGL().getGL2GL3().glBindFragDataLocation(param1, param2, param3); |
||||
} |
||||
|
||||
@Override |
||||
public void glBindVertexArray(int param1) { |
||||
GLContext.getCurrentGL().getGL2ES3().glBindVertexArray(param1); |
||||
} |
||||
|
||||
@Override |
||||
public void glGenVertexArrays(IntBuffer param1) { |
||||
checkLimit(param1); |
||||
GLContext.getCurrentGL().getGL2ES3().glGenVertexArrays(param1.limit(), param1); |
||||
} |
||||
|
||||
@Override |
||||
public void glPatchParameter(int count) { |
||||
GLContext.getCurrentGL().getGL3().glPatchParameteri(com.jogamp.opengl.GL3.GL_PATCH_VERTICES, count); |
||||
} |
||||
|
||||
@Override |
||||
public void glDeleteVertexArrays(IntBuffer arrays) { |
||||
checkLimit(arrays); |
||||
GLContext.getCurrentGL().getGL2ES3().glDeleteVertexArrays(arrays.limit(), arrays); |
||||
} |
||||
} |
@ -0,0 +1,88 @@ |
||||
package com.jme3.renderer.jogl; |
||||
|
||||
import com.jme3.renderer.RendererException; |
||||
import com.jme3.renderer.opengl.GLExt; |
||||
import com.jogamp.opengl.GLContext; |
||||
|
||||
import java.nio.Buffer; |
||||
import java.nio.FloatBuffer; |
||||
import java.nio.IntBuffer; |
||||
|
||||
public class JoglGLExt implements GLExt { |
||||
|
||||
private static int getLimitBytes(IntBuffer buffer) { |
||||
checkLimit(buffer); |
||||
return buffer.limit() * 4; |
||||
} |
||||
|
||||
private static void checkLimit(Buffer buffer) { |
||||
if (buffer == null) { |
||||
return; |
||||
} |
||||
if (buffer.limit() == 0) { |
||||
throw new RendererException("Attempting to upload empty buffer (limit = 0), that's an error"); |
||||
} |
||||
if (buffer.remaining() == 0) { |
||||
throw new RendererException("Attempting to upload empty buffer (remaining = 0), that's an error"); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public void glBufferData(int target, IntBuffer data, int usage) { |
||||
checkLimit(data); |
||||
GLContext.getCurrentGL().glBufferData(target, getLimitBytes(data), data, usage); |
||||
} |
||||
|
||||
@Override |
||||
public void glBufferSubData(int target, long offset, IntBuffer data) { |
||||
checkLimit(data); |
||||
GLContext.getCurrentGL().glBufferSubData(target, getLimitBytes(data), offset, data); |
||||
} |
||||
|
||||
@Override |
||||
public void glDrawArraysInstancedARB(int mode, int first, int count, int primcount) { |
||||
GLContext.getCurrentGL().getGL2ES3().glDrawArraysInstanced(mode, first, count, primcount); |
||||
} |
||||
|
||||
@Override |
||||
public void glDrawBuffers(IntBuffer bufs) { |
||||
checkLimit(bufs); |
||||
GLContext.getCurrentGL().getGL2ES2().glDrawBuffers(bufs.limit(), bufs); |
||||
} |
||||
|
||||
@Override |
||||
public void glDrawElementsInstancedARB(int mode, int indices_count, int type, long indices_buffer_offset, int primcount) { |
||||
GLContext.getCurrentGL().getGL2ES3().glDrawElementsInstanced(mode, indices_count, type, indices_buffer_offset, primcount); |
||||
} |
||||
|
||||
@Override |
||||
public void glGetMultisample(int pname, int index, FloatBuffer val) { |
||||
checkLimit(val); |
||||
GLContext.getCurrentGL().getGL2ES2().glGetMultisamplefv(pname, index, val); |
||||
} |
||||
|
||||
@Override |
||||
public void glTexImage2DMultisample(int target, int samples, int internalformat, int width, int height, boolean fixedsamplelocations) { |
||||
GLContext.getCurrentGL().getGL2ES2().glTexImage2DMultisample(target, samples, internalformat, width, height, fixedsamplelocations); |
||||
} |
||||
|
||||
@Override |
||||
public void glVertexAttribDivisorARB(int index, int divisor) { |
||||
GLContext.getCurrentGL().getGL2ES3().glVertexAttribDivisor(index, divisor); |
||||
} |
||||
|
||||
@Override |
||||
public Object glFenceSync(int condition, int flags) { |
||||
return GLContext.getCurrentGL().getGL3ES3().glFenceSync(condition, flags); |
||||
} |
||||
|
||||
@Override |
||||
public int glClientWaitSync(Object sync, int flags, long timeout) { |
||||
return GLContext.getCurrentGL().getGL3ES3().glClientWaitSync(((Long) sync).longValue(), flags, timeout); |
||||
} |
||||
|
||||
@Override |
||||
public void glDeleteSync(Object sync) { |
||||
GLContext.getCurrentGL().getGL3ES3().glDeleteSync(((Long) sync).longValue()); |
||||
} |
||||
} |
@ -0,0 +1,97 @@ |
||||
package com.jme3.renderer.jogl; |
||||
|
||||
import com.jme3.renderer.RendererException; |
||||
import com.jme3.renderer.opengl.GLFbo; |
||||
import com.jogamp.opengl.GLContext; |
||||
|
||||
import java.nio.Buffer; |
||||
import java.nio.IntBuffer; |
||||
|
||||
/** |
||||
* Implements GLFbo |
||||
* |
||||
* @author Kirill Vainer |
||||
*/ |
||||
public class JoglGLFbo implements GLFbo { |
||||
|
||||
private static void checkLimit(Buffer buffer) { |
||||
if (buffer == null) { |
||||
return; |
||||
} |
||||
if (buffer.limit() == 0) { |
||||
throw new RendererException("Attempting to upload empty buffer (limit = 0), that's an error"); |
||||
} |
||||
if (buffer.remaining() == 0) { |
||||
throw new RendererException("Attempting to upload empty buffer (remaining = 0), that's an error"); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public void glBlitFramebufferEXT(int srcX0, int srcY0, int srcX1, int srcY1, int dstX0, int dstY0, int dstX1, int dstY1, int mask, int filter) { |
||||
GLContext.getCurrentGL().getGL2ES3().glBlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); |
||||
} |
||||
|
||||
@Override |
||||
public void glRenderbufferStorageMultisampleEXT(int target, int samples, int internalformat, int width, int height) { |
||||
GLContext.getCurrentGL().glRenderbufferStorageMultisample(target, samples, internalformat, width, height); |
||||
} |
||||
|
||||
@Override |
||||
public void glBindFramebufferEXT(int param1, int param2) { |
||||
GLContext.getCurrentGL().glBindFramebuffer(param1, param2); |
||||
} |
||||
|
||||
@Override |
||||
public void glBindRenderbufferEXT(int param1, int param2) { |
||||
GLContext.getCurrentGL().glBindRenderbuffer(param1, param2); |
||||
} |
||||
|
||||
@Override |
||||
public int glCheckFramebufferStatusEXT(int param1) { |
||||
return GLContext.getCurrentGL().glCheckFramebufferStatus(param1); |
||||
} |
||||
|
||||
@Override |
||||
public void glDeleteFramebuffersEXT(IntBuffer param1) { |
||||
checkLimit(param1); |
||||
GLContext.getCurrentGL().glDeleteFramebuffers(param1.limit(), param1); |
||||
} |
||||
|
||||
@Override |
||||
public void glDeleteRenderbuffersEXT(IntBuffer param1) { |
||||
checkLimit(param1); |
||||
GLContext.getCurrentGL().glDeleteRenderbuffers(param1.limit(), param1); |
||||
} |
||||
|
||||
@Override |
||||
public void glFramebufferRenderbufferEXT(int param1, int param2, int param3, int param4) { |
||||
GLContext.getCurrentGL().glFramebufferRenderbuffer(param1, param2, param3, param4); |
||||
} |
||||
|
||||
@Override |
||||
public void glFramebufferTexture2DEXT(int param1, int param2, int param3, int param4, int param5) { |
||||
GLContext.getCurrentGL().glFramebufferTexture2D(param1, param2, param3, param4, param5); |
||||
} |
||||
|
||||
@Override |
||||
public void glGenFramebuffersEXT(IntBuffer param1) { |
||||
checkLimit(param1); |
||||
GLContext.getCurrentGL().glGenFramebuffers(param1.limit(), param1); |
||||
} |
||||
|
||||
@Override |
||||
public void glGenRenderbuffersEXT(IntBuffer param1) { |
||||
checkLimit(param1); |
||||
GLContext.getCurrentGL().glGenRenderbuffers(param1.limit(), param1); |
||||
} |
||||
|
||||
@Override |
||||
public void glGenerateMipmapEXT(int param1) { |
||||
GLContext.getCurrentGL().glGenerateMipmap(param1); |
||||
} |
||||
|
||||
@Override |
||||
public void glRenderbufferStorageEXT(int param1, int param2, int param3, int param4) { |
||||
GLContext.getCurrentGL().glRenderbufferStorage(param1, param2, param3, param4); |
||||
} |
||||
} |
@ -0,0 +1,80 @@ |
||||
/* |
||||
* Copyright (c) 2009-2015 jMonkeyEngine |
||||
* All rights reserved. |
||||
* |
||||
* Redistribution and use in source and binary forms, with or without |
||||
* modification, are permitted provided that the following conditions are |
||||
* met: |
||||
* |
||||
* * Redistributions of source code must retain the above copyright |
||||
* notice, this list of conditions and the following disclaimer. |
||||
* |
||||
* * Redistributions in binary form must reproduce the above copyright |
||||
* notice, this list of conditions and the following disclaimer in the |
||||
* documentation and/or other materials provided with the distribution. |
||||
* |
||||
* * Neither the name of 'jMonkeyEngine' nor the names of its contributors |
||||
* may be used to endorse or promote products derived from this software |
||||
* without specific prior written permission. |
||||
* |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||
*/ |
||||
package com.jme3.system.jogl; |
||||
|
||||
import java.util.HashMap; |
||||
|
||||
import com.jogamp.opengl.GL2ES2; |
||||
import com.jogamp.opengl.GLDebugListener; |
||||
import com.jogamp.opengl.GLDebugMessage; |
||||
|
||||
class JoglGLDebugOutputHandler implements GLDebugListener { |
||||
|
||||
private static final HashMap<Integer, String> constMap = new HashMap<Integer, String>(); |
||||
private static final String MESSAGE_FORMAT = |
||||
"[JME3] OpenGL debug message\r\n" + |
||||
" ID: %d\r\n" + |
||||
" Source: %s\r\n" + |
||||
" Type: %s\r\n" + |
||||
" Severity: %s\r\n" + |
||||
" Message: %s"; |
||||
|
||||
static { |
||||
constMap.put(GL2ES2.GL_DEBUG_SOURCE_API, "API"); |
||||
constMap.put(GL2ES2.GL_DEBUG_SOURCE_APPLICATION, "APPLICATION"); |
||||
constMap.put(GL2ES2.GL_DEBUG_SOURCE_OTHER, "OTHER"); |
||||
constMap.put(GL2ES2.GL_DEBUG_SOURCE_SHADER_COMPILER, "SHADER_COMPILER"); |
||||
constMap.put(GL2ES2.GL_DEBUG_SOURCE_THIRD_PARTY, "THIRD_PARTY"); |
||||
constMap.put(GL2ES2.GL_DEBUG_SOURCE_WINDOW_SYSTEM, "WINDOW_SYSTEM"); |
||||
|
||||
constMap.put(GL2ES2.GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR, "DEPRECATED_BEHAVIOR"); |
||||
constMap.put(GL2ES2.GL_DEBUG_TYPE_ERROR, "ERROR"); |
||||
constMap.put(GL2ES2.GL_DEBUG_TYPE_OTHER, "OTHER"); |
||||
constMap.put(GL2ES2.GL_DEBUG_TYPE_PERFORMANCE, "PERFORMANCE"); |
||||
constMap.put(GL2ES2.GL_DEBUG_TYPE_PORTABILITY, "PORTABILITY"); |
||||
constMap.put(GL2ES2.GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR, "UNDEFINED_BEHAVIOR"); |
||||
|
||||
constMap.put(GL2ES2.GL_DEBUG_SEVERITY_HIGH, "HIGH"); |
||||
constMap.put(GL2ES2.GL_DEBUG_SEVERITY_MEDIUM, "MEDIUM"); |
||||
constMap.put(GL2ES2.GL_DEBUG_SEVERITY_LOW, "LOW"); |
||||
} |
||||
|
||||
@Override |
||||
public void messageSent(GLDebugMessage event) { |
||||
String sourceStr = constMap.get(event.getDbgSource()); |
||||
String typeStr = constMap.get(event.getDbgType()); |
||||
String severityStr = constMap.get(event.getDbgSeverity()); |
||||
|
||||
System.err.println(String.format(MESSAGE_FORMAT, event.getDbgId(), sourceStr, typeStr, severityStr, event.getDbgMsg())); |
||||
} |
||||
|
||||
} |
@ -0,0 +1 @@ |
||||
updates.jmonkeyengine.org ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC5bNOiZwU5dF62nBllxkjiSIfn0k6RVfprvO1aUypRmARD3/MKJKg7cGLezlLKaHZtVs84VpEqpmg5IzPAXWEmxUw1oke70uYMli7JV+4oPAeQRFwUdldP98I5h9VHwSjBqMycRLkxYaHF8edIPt1Zsa2dM3qrufy71ndQoFF6g7QxmT7gsTxwcNufDxymIgiAna/Qp2fr0YCLCiB8RQ7JTHfqA3dOWw0wz7AwfBTwwDCHkVxB5B4nz5iZxFr0scvqcae8vMncq8xKS7OMrLbn6asVaF6dDu+5Jc0mqxma5Qg7VC1xQXZsvlRISfrTFhQMhEx+j9w5snzihrlFnZ35 |
Binary file not shown.
@ -1,8 +1,8 @@ |
||||
build.xml.data.CRC32=0f706f4a |
||||
build.xml.script.CRC32=0b0b23c4 |
||||
build.xml.stylesheet.CRC32=28e38971@1.38.1.45 |
||||
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. |
||||
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. |
||||
nbproject/build-impl.xml.data.CRC32=0f706f4a |
||||
nbproject/build-impl.xml.script.CRC32=46d1a69a |
||||
nbproject/build-impl.xml.stylesheet.CRC32=0ae3a408@1.44.1.45 |
||||
build.xml.data.CRC32=0f706f4a |
||||
build.xml.script.CRC32=82b8b23d |
||||
build.xml.stylesheet.CRC32=8064a381@1.75.2.48 |
||||
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. |
||||
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. |
||||
nbproject/build-impl.xml.data.CRC32=0f706f4a |
||||
nbproject/build-impl.xml.script.CRC32=46d1a69a |
||||
nbproject/build-impl.xml.stylesheet.CRC32=0ae3a408@1.44.1.45 |
||||
|
@ -1,4 +1,6 @@ |
||||
#Thu, 25 Aug 2011 20:26:50 +0200 |
||||
javac.source=1.5 |
||||
javac.source=1.6 |
||||
javac.compilerargs=-Xlint -Xlint\:-serial |
||||
nbm.homepage=http\://www.jmonkeyengine.org |
||||
nbm.module.author=Normen Hansen |
||||
spec.version.base=3.1.0 |
||||
|
@ -1,8 +1,8 @@ |
||||
#Thu, 25 Aug 2011 20:26:49 +0200 |
||||
javac.source=1.5 |
||||
javac.source=1.6 |
||||
javac.compilerargs=-Xlint -Xlint\:-serial |
||||
license.file=../license-jme.txt |
||||
nbm.homepage=http\://www.jmonkeyengine.com |
||||
nbm.homepage=http\://www.jmonkeyengine.org |
||||
nbm.module.author=Normen Hansen |
||||
nbm.needs.restart=true |
||||
spec.version.base=3.1.0 |
||||
|
@ -1,7 +1,8 @@ |
||||
#Thu, 25 Aug 2011 20:26:50 +0200 |
||||
javac.source=1.5 |
||||
javac.source=1.6 |
||||
javac.compilerargs=-Xlint -Xlint\:-serial |
||||
nbm.homepage=http\://www.jmonkeyengine.com |
||||
license.file=../license-jme.txt |
||||
nbm.homepage=http\://www.jmonkeyengine.org |
||||
nbm.module.author=Kaelthas |
||||
nbm.needs.restart=true |
||||
spec.version.base=3.1.0 |
||||
|
@ -1,8 +1,8 @@ |
||||
#Thu, 25 Aug 2011 20:26:50 +0200 |
||||
javac.source=1.5 |
||||
javac.source=1.6 |
||||
javac.compilerargs=-Xlint -Xlint\:-serial |
||||
license.file=../license-jme.txt |
||||
nbm.homepage=http\://www.jmonkeyengine.com |
||||
nbm.homepage=http\://www.jmonkeyengine.org |
||||
nbm.module.author=R\u00e9my Bouquet |
||||
nbm.needs.restart=true |
||||
spec.version.base=3.1.0 |
||||
|
@ -1,4 +1,7 @@ |
||||
#Thu, 25 Aug 2011 20:26:50 +0200 |
||||
javac.source=1.6 |
||||
javac.compilerargs=-Xlint -Xlint\:-serial |
||||
license.file=../license-jme.txt |
||||
nbm.homepage=http\://www.jmonkeyengine.org |
||||
nbm.module.author=Normen Hansen |
||||
spec.version.base=3.1.0 |
||||
|
@ -1,8 +1,8 @@ |
||||
#Thu, 25 Aug 2011 20:26:49 +0200 |
||||
javac.source=1.5 |
||||
javac.source=1.6 |
||||
javac.compilerargs=-Xlint -Xlint\:-serial |
||||
license.file=../license-jme.txt |
||||
nbm.homepage=http\://www.jmonkeyengine.com |
||||
nbm.homepage=http\://www.jmonkeyengine.org |
||||
nbm.module.author=Normen Hansen |
||||
nbm.needs.restart=true |
||||
spec.version.base=3.1.0 |
||||
|
@ -1,8 +1,8 @@ |
||||
build.xml.data.CRC32=278ea45d |
||||
build.xml.data.CRC32=d43b0890 |
||||
build.xml.script.CRC32=cdae6a36 |
||||
build.xml.stylesheet.CRC32=a56c6a5b@2.67.1 |
||||
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. |
||||
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. |
||||
nbproject/build-impl.xml.data.CRC32=278ea45d |
||||
nbproject/build-impl.xml.data.CRC32=d43b0890 |
||||
nbproject/build-impl.xml.script.CRC32=246f9b81 |
||||
nbproject/build-impl.xml.stylesheet.CRC32=238281d1@2.67.1 |
||||
|
@ -1,7 +1,7 @@ |
||||
javac.source=1.5 |
||||
javac.source=1.6 |
||||
javac.compilerargs=-Xlint -Xlint\:-serial |
||||
license.file=../license-jme.txt |
||||
nbm.homepage=http\://www.jmonkeyengine.com |
||||
nbm.homepage=http\://www.jmonkeyengine.org |
||||
nbm.module.author=jMonkeyEngine |
||||
nbm.needs.restart=true |
||||
spec.version.base=3.1.0 |
||||
|
@ -1,8 +1,8 @@ |
||||
#Thu, 25 Aug 2011 20:26:48 +0200 |
||||
javac.source=1.5 |
||||
javac.source=1.6 |
||||
javac.compilerargs=-Xlint -Xlint\:-serial |
||||
license.file=../license-jme.txt |
||||
nbm.homepage=http\://www.jmonkeyengine.com |
||||
nbm.homepage=http\://www.jmonkeyengine.org |
||||
nbm.module.author=jMonkeyEngine |
||||
nbm.needs.restart=true |
||||
spec.version.base=3.1.0 |
||||
|
@ -1,8 +1,8 @@ |
||||
build.xml.data.CRC32=08468784 |
||||
build.xml.data.CRC32=e145fa2a |
||||
build.xml.script.CRC32=cfa8d5c5 |
||||
build.xml.stylesheet.CRC32=a56c6a5b@2.67.1 |
||||
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. |
||||
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. |
||||
nbproject/build-impl.xml.data.CRC32=08468784 |
||||
nbproject/build-impl.xml.data.CRC32=e145fa2a |
||||
nbproject/build-impl.xml.script.CRC32=270846fb |
||||
nbproject/build-impl.xml.stylesheet.CRC32=238281d1@2.67.1 |
||||
|
@ -1,4 +1,4 @@ |
||||
#Thu, 25 Aug 2011 20:26:49 +0200 |
||||
javac.source=1.5 |
||||
javac.source=1.6 |
||||
javac.compilerargs=-Xlint -Xlint\:-serial |
||||
spec.version.base=3.1.0 |
||||
|
@ -0,0 +1 @@ |
||||
com.jme3.gde.core.updatecenters.keystore.JmeKeyStoreProvider |
@ -0,0 +1,47 @@ |
||||
package com.jme3.gde.core.updatecenters.keystore; |
||||
|
||||
import java.io.IOException; |
||||
import java.io.InputStream; |
||||
import java.security.KeyStore; |
||||
import java.security.KeyStoreException; |
||||
import java.security.NoSuchAlgorithmException; |
||||
import java.security.cert.CertificateException; |
||||
import org.netbeans.spi.autoupdate.KeyStoreProvider; |
||||
import org.openide.util.Exceptions; |
||||
|
||||
/** |
||||
* Loads the jMonkeyEngine SDK Plugins certificates into the AutoUpdate system. |
||||
* |
||||
* @author Kirill Vainer |
||||
*/ |
||||
public class JmeKeyStoreProvider implements KeyStoreProvider { |
||||
|
||||
@Override |
||||
public KeyStore getKeyStore() { |
||||
InputStream in = null; |
||||
try { |
||||
in = JmeKeyStoreProvider.class.getResourceAsStream("trustedcerts.jks"); |
||||
KeyStore store = KeyStore.getInstance("JKS"); |
||||
store.load(in, "trustedcerts".toCharArray()); |
||||
return store; |
||||
} catch (KeyStoreException ex) { |
||||
Exceptions.printStackTrace(ex); |
||||
} catch (IOException ex) { |
||||
Exceptions.printStackTrace(ex); |
||||
} catch (NoSuchAlgorithmException ex) { |
||||
Exceptions.printStackTrace(ex); |
||||
} catch (CertificateException ex) { |
||||
Exceptions.printStackTrace(ex); |
||||
} finally { |
||||
if (in != null) { |
||||
try { |
||||
in.close(); |
||||
} catch (IOException ex) { |
||||
Exceptions.printStackTrace(ex); |
||||
} |
||||
} |
||||
} |
||||
return null; |
||||
} |
||||
|
||||
} |
Binary file not shown.
@ -0,0 +1,10 @@ |
||||
# DarkMonkey |
||||
Netbeans LAF and FAC combo - uses NimROD and Obsidian |
||||
|
||||
This is a plug-in for for Netbeans 8+ (well, the version it was developed for is 8.0.2). We wanted a dark theme variant for the jMonkeyEngine 3.1 sdk, so we made one. Enjoy! |
||||
|
||||
![DarkMonkey Screenshot](http://jme-hub-cdn.jmonkeyengineor.netdna-cdn.com/uploads/default/_optimized/fdd/136/87eb8a1efd_690x387.png) |
||||
|
||||
## Features |
||||
- Adds the DarkMonkey LaF to the Netbeans 8 environment under appearance - It's NimROD with a couple of tweaks. We've just adapted Nilo's wonderful project for the look we were going for. |
||||
- Adds the DarkMonkey FaC to the editor profile listing - It's Obsidian with some tweaks. DejaVu Sans Mono brings some sophistication to an otherwise courier world. |
@ -0,0 +1,8 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<!-- You may freely edit this file. See harness/README in the NetBeans platform --> |
||||
<!-- for some information on what you could do (e.g. targets to override). --> |
||||
<!-- If you delete this file and reopen the project it will be recreated. --> |
||||
<project name="org.jme3.netbeans.plaf.darkmonkey" default="netbeans" basedir="."> |
||||
<description>Builds, tests, and runs the project org.jme3.netbeans.plaf.darkmonkey.</description> |
||||
<import file="nbproject/build-impl.xml"/> |
||||
</project> |
@ -0,0 +1,7 @@ |
||||
Manifest-Version: 1.0 |
||||
OpenIDE-Module: org.jme3.netbeans.plaf.darkmonkey/1 |
||||
OpenIDE-Module-Implementation-Version: 0 |
||||
OpenIDE-Module-Install: org/jme3/netbeans/plaf/darkmonkey/Installer.class |
||||
OpenIDE-Module-Layer: org/jme3/netbeans/plaf/darkmonkey/layer.xml |
||||
OpenIDE-Module-Localizing-Bundle: org/jme3/netbeans/plaf/darkmonkey/Bundle.properties |
||||
|
@ -0,0 +1,45 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<!-- |
||||
*** GENERATED FROM project.xml - DO NOT EDIT *** |
||||
*** EDIT ../build.xml INSTEAD *** |
||||
--> |
||||
<project name="org.jme3.netbeans.plaf.darkmonkey-impl" basedir=".."> |
||||
<fail message="Please build using Ant 1.7.1 or higher."> |
||||
<condition> |
||||
<not> |
||||
<antversion atleast="1.7.1"/> |
||||
</not> |
||||
</condition> |
||||
</fail> |
||||
<property file="nbproject/private/suite-private.properties"/> |
||||
<property file="nbproject/suite.properties"/> |
||||
<fail unless="suite.dir">You must set 'suite.dir' to point to your containing module suite</fail> |
||||
<property file="${suite.dir}/nbproject/private/platform-private.properties"/> |
||||
<property file="${suite.dir}/nbproject/platform.properties"/> |
||||
<macrodef name="property" uri="http://www.netbeans.org/ns/nb-module-project/2"> |
||||
<attribute name="name"/> |
||||
<attribute name="value"/> |
||||
<sequential> |
||||
<property name="@{name}" value="${@{value}}"/> |
||||
</sequential> |
||||
</macrodef> |
||||
<macrodef name="evalprops" uri="http://www.netbeans.org/ns/nb-module-project/2"> |
||||
<attribute name="property"/> |
||||
<attribute name="value"/> |
||||
<sequential> |
||||
<property name="@{property}" value="@{value}"/> |
||||
</sequential> |
||||
</macrodef> |
||||
<property file="${user.properties.file}"/> |
||||
<nbmproject2:property name="harness.dir" value="nbplatform.${nbplatform.active}.harness.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/> |
||||
<nbmproject2:property name="nbplatform.active.dir" value="nbplatform.${nbplatform.active}.netbeans.dest.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/> |
||||
<nbmproject2:evalprops property="cluster.path.evaluated" value="${cluster.path}" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/> |
||||
<fail message="Path to 'platform' cluster missing in $${cluster.path} property or using corrupt Netbeans Platform (missing harness)."> |
||||
<condition> |
||||
<not> |
||||
<contains string="${cluster.path.evaluated}" substring="platform"/> |
||||
</not> |
||||
</condition> |
||||
</fail> |
||||
<import file="${harness.dir}/build.xml"/> |
||||
</project> |
@ -0,0 +1,8 @@ |
||||
build.xml.data.CRC32=8f3042a8 |
||||
build.xml.script.CRC32=c15f5ee0 |
||||
build.xml.stylesheet.CRC32=a56c6a5b@2.67.1 |
||||
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. |
||||
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. |
||||
nbproject/build-impl.xml.data.CRC32=8f3042a8 |
||||
nbproject/build-impl.xml.script.CRC32=4524e469 |
||||
nbproject/build-impl.xml.stylesheet.CRC32=238281d1@2.67.1 |
@ -0,0 +1,8 @@ |
||||
file.reference.nimrodlf.jar=release/modules/ext/nimrodlf.jar |
||||
javac.source=1.7 |
||||
javac.compilerargs=-Xlint -Xlint:-serial |
||||
license.file=../license-jme.txt |
||||
nbm.homepage=http://www.jmonkeyengine.org |
||||
nbm.module.author=Charles Anderson, R\u00e9my Bouquet |
||||
nbm.needs.restart=true |
||||
spec.version.base=3.1.0 |
@ -0,0 +1,49 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<project xmlns="http://www.netbeans.org/ns/project/1"> |
||||
<type>org.netbeans.modules.apisupport.project</type> |
||||
<configuration> |
||||
<data xmlns="http://www.netbeans.org/ns/nb-module-project/3"> |
||||
<code-name-base>org.jme3.netbeans.plaf.darkmonkey</code-name-base> |
||||
<suite-component/> |
||||
<module-dependencies> |
||||
<dependency> |
||||
<code-name-base>org.openide.awt</code-name-base> |
||||
<build-prerequisite/> |
||||
<compile-dependency/> |
||||
<run-dependency> |
||||
<specification-version>7.62.1</specification-version> |
||||
</run-dependency> |
||||
</dependency> |
||||
<dependency> |
||||
<code-name-base>org.openide.modules</code-name-base> |
||||
<build-prerequisite/> |
||||
<compile-dependency/> |
||||
<run-dependency> |
||||
<specification-version>7.43.1</specification-version> |
||||
</run-dependency> |
||||
</dependency> |
||||
<dependency> |
||||
<code-name-base>org.openide.util</code-name-base> |
||||
<build-prerequisite/> |
||||
<compile-dependency/> |
||||
<run-dependency> |
||||
<specification-version>8.39.1</specification-version> |
||||
</run-dependency> |
||||
</dependency> |
||||
<dependency> |
||||
<code-name-base>org.openide.windows</code-name-base> |
||||
<build-prerequisite/> |
||||
<compile-dependency/> |
||||
<run-dependency> |
||||
<specification-version>6.71.1</specification-version> |
||||
</run-dependency> |
||||
</dependency> |
||||
</module-dependencies> |
||||
<public-packages/> |
||||
<class-path-extension> |
||||
<runtime-relative-path>ext/nimrodlf.jar</runtime-relative-path> |
||||
<binary-origin>release/modules/ext/nimrodlf.jar</binary-origin> |
||||
</class-path-extension> |
||||
</data> |
||||
</configuration> |
||||
</project> |
@ -0,0 +1 @@ |
||||
suite.dir=${basedir}/.. |
Binary file not shown.
@ -0,0 +1,10 @@ |
||||
OpenIDE-Module-Name=DarkMonkey |
||||
OpenIDE-Module-Display-Category=Appearance |
||||
OpenIDE-Module-Short-Description=Contains DarkMonkey theme for the JME3.1 stable release |
||||
OpenIDE-Module-Long-Description=\ |
||||
<div style="background:#333333;color:#995500; font-family:'Kreon',serif;margin: 3px, #777777;"/> <img src="http://hub.jmonkeyengine.org/uploads/default/1252/91fcc91347189c84.png" style="margin-left:auto;margin-right:auto"/><br/><h1 style="font-weight:bold;text-align:center;">DarkMonkey Theme</h1> <p style="color:#aaaaaa;">This is a Fonts/Colors and LookAndFeel combo that utilizes <a style="color:#999900" href="http://jamesmcfadden.co.uk/netbeans-obsidian-theme/" target="new">James McFadden's Obsidian Fonts/Colors</a>and <a style="color:#999900" href="http://nilogonzalez.es/nimrodlf/download-en.html" target="new">Nilo Gonzalez's Nimrod LookAndFeel</a> which isbased on the Metal LookAndFeel. \ |
||||
This module just checks and sees if the user already has the components, and if not, installs the theme and activates a few options:\n</p><UL> <LI> under Tools - Options - Appearance - LookAndFeel it will have "DarkMonkey" , available.\ |
||||
</LI><LI> It also adds a Fonts/Colors Profile called "Dark Monkey".\ |
||||
</LI></UL> <p style="color:#aaaaaa;"> We hope you like it!\ |
||||
</p> For More Information visit: <a style="color:#999900" href="http://hub.jmonkeyengine.org/t/darkmonkey-dev-blog/31566" target="new"> DarkMonkey Development Thread </a> </div> |
||||
|
@ -0,0 +1,288 @@ |
||||
/* |
||||
* To change this license header, choose License Headers in Project Properties. |
||||
* To change this template file, choose Tools | Templates |
||||
* and open the template in the editor. |
||||
*/ |
||||
package org.jme3.netbeans.plaf.darkmonkey; |
||||
|
||||
import java.awt.Color; |
||||
import java.awt.Font; |
||||
import java.awt.FontFormatException; |
||||
import java.awt.GraphicsEnvironment; |
||||
import java.awt.image.BandedSampleModel; |
||||
import java.awt.image.BufferedImage; |
||||
import java.awt.image.DataBuffer; |
||||
import java.awt.image.DataBufferFloat; |
||||
import java.awt.image.Raster; |
||||
import java.awt.image.WritableRaster; |
||||
import java.io.File; |
||||
import java.io.IOException; |
||||
import java.io.InputStream; |
||||
import javax.imageio.ImageIO; |
||||
|
||||
/** |
||||
* I figured it would be best to have a Utilities type class to store the |
||||
* Methods I commonly use. Resources, registering stuff, resolving, transforming |
||||
* and so on... |
||||
* |
||||
* @author charles |
||||
*/ |
||||
public class DMUtils { |
||||
|
||||
/** |
||||
* <p> |
||||
* This method loads a picture from a relative path string. The relative |
||||
* path's root directory is understood to be inside of a jar... and in |
||||
* relation to the package of the referring Object instance. |
||||
* </p> |
||||
* <p> |
||||
* For example: if the object is an instance of |
||||
* org.jme3.netbeans.plaf.darkmonkey.DarkMonkeyIconFactory.class, and the |
||||
* string is "icons/MyCloseIcon.png", it will attempt to load |
||||
* org/jme3/netbeans/plaf/darkmonkey/icons/MyCloseIcon.png from |
||||
* DarkMonkeyIconFactory's jar file. |
||||
* </p> |
||||
* It will print a stack trace if you get the relative path wrong. |
||||
* |
||||
* @param refObj - Reference Object(Object) - meant for a standard 'this' |
||||
* call, though any Instantiated class can be used. This is part of a |
||||
* workaround for Netbean's multiple class loader system. |
||||
* @param fileName - File Name(String) - the path to an image relative to |
||||
* the Reference Object's location in a jar file. |
||||
* @return BufferedImage - Freshly converted from the image file found at |
||||
* the location. |
||||
*/ |
||||
public static BufferedImage loadImagefromJar(Object refObj, String fileName) { |
||||
BufferedImage bi = null; |
||||
try { |
||||
bi = ImageIO.read(refObj.getClass().getResourceAsStream(fileName)); |
||||
} catch (IOException e) { |
||||
// File is probably referenced wrong or "mispleled"... lol.
|
||||
e.printStackTrace(); |
||||
} |
||||
return bi; |
||||
} |
||||
|
||||
/**<p> |
||||
* This utility method is designed to Load OpenType/TrueType fonts into the |
||||
* current Runtime Environment without installing them to the OS. It takes |
||||
* the base path of the refObj and loads font files located relative to it. |
||||
* It checks to make sure that the fonts are not already installed in the system |
||||
* OS, first. If they are already installed, it does nothing more. |
||||
* </p><p> |
||||
* Typical Usage - DMUtils.loadFontsFromJar(this, someFontFiles);<br/> |
||||
* and then someFontFiles[0] would contain something like "myfonts/DisFontPlain.ttf" |
||||
* </p> |
||||
* @param refObj - Object - Usually just a *this*, but useful for a multiClassLoader |
||||
* type situation. |
||||
* @param fileNames - String[] - an array of {relative path + filename} strings for loading |
||||
* TrueType or OpenType fonts |
||||
*/ |
||||
public static void loadFontsFromJar(Object refObj, String[] fileNames) { |
||||
//first, we grab ahold of what all fonts are in the JRE's system
|
||||
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); |
||||
Font[] fontsListing = ge.getAllFonts(); |
||||
|
||||
/* // this can be uncommented if you want to see all the fonts in the JRE
|
||||
for (Font fontInListing : fontsListing) { |
||||
System.out.println(fontInListing.getFontName() + " : " + fontInListing.getFamily()); |
||||
} |
||||
*/ |
||||
|
||||
// Then we go and process the incoming streams
|
||||
InputStream inStream; |
||||
Font checkFont; |
||||
try { |
||||
toNextFileName: |
||||
for (String fileName : fileNames) {// load up the fileName to process...
|
||||
checkFont = Font.createFont(Font.TRUETYPE_FONT, refObj.getClass().getResourceAsStream(fileName)); |
||||
for (Font fontInListing : fontsListing) {// check if it's already on the list
|
||||
if (fontInListing.getFontName().equals(checkFont.getFontName())) { |
||||
continue toNextFileName; //head to the next file if we find it...
|
||||
} |
||||
} |
||||
ge.registerFont(checkFont);// and register it if we don't....
|
||||
} |
||||
} catch (FontFormatException | IOException e) { |
||||
// a File is probably referenced wrong or "mispleled"... lol.
|
||||
// you can alternativly send a single String for debugging purposes
|
||||
e.printStackTrace(); |
||||
} |
||||
|
||||
} |
||||
|
||||
/** |
||||
* This method transforms the inputed BufferedImage by the supplied Color[]. |
||||
* The behavior treats the Color[] as Ordered Passes A, R, G, B for .length |
||||
* 4 or more. It treats it as Ordered Passes R, G, B only for .length 3 or |
||||
* less. |
||||
* |
||||
* @param colorSet Color[] - that processes [1..4] up to four palette |
||||
* colors. 3 or less uses R,G,B passes only. 4 uses A,R,G,B and ignores |
||||
* anything more. |
||||
* @param clearToColorRequested - Color - A color to Blend with the First |
||||
* Translucent Pass - Optional |
||||
* @param argbMappedBufferedImage - BufferedImage - The image containing |
||||
* Channels as Alpha for the Palette |
||||
* @return BufferedImage - a new BufferedImage() transformed by the palette. |
||||
*/ |
||||
public static BufferedImage paletteSwapARGB8(Color[] colorSet, Color clearToColorRequested, BufferedImage argbMappedBufferedImage) { |
||||
if (argbMappedBufferedImage == null) { |
||||
return null; //S.E.P.
|
||||
} |
||||
final Color BLACK_NO_ALPHA = new Color(0x00000000); |
||||
final Color WHITE_NO_ALPHA = new Color(0x00FFFFFF); |
||||
final int ALPHA = 3; // this is some static mapping for...
|
||||
final int RED = 0; // readability in the following...
|
||||
final int GREEN = 1; // Magic code section of band processing.
|
||||
final int BLUE = 2; |
||||
final int[] orderedBands = {ALPHA, RED, GREEN, BLUE}; |
||||
//first we prep a cmap with blank passes and
|
||||
Color[] cMap = {BLACK_NO_ALPHA, BLACK_NO_ALPHA, BLACK_NO_ALPHA, BLACK_NO_ALPHA}; |
||||
boolean clearColorFound = false; |
||||
Color clearToColor = BLACK_NO_ALPHA; |
||||
if (colorSet != null) { //if we get a null colorSet... it's all mapped to clear.
|
||||
if (colorSet.length > cMap.length) { // if colorSet is more than 4, we only proces up to 4
|
||||
for (int i = 0; i < cMap.length; i++) { |
||||
if (colorSet[i] != null) { |
||||
if (!clearColorFound) { |
||||
clearColorFound = true; |
||||
clearToColor = colorSet[i]; |
||||
} |
||||
cMap[orderedBands[i]] = colorSet[i]; // and finally, if any of the Colors are null... invisible pass...
|
||||
} |
||||
} |
||||
} else { |
||||
int startOffset = 0; |
||||
if (colorSet.length < 4) // if less than standard size, assume RGB model
|
||||
{ |
||||
startOffset++; // and "blank" the alpha color pass.
|
||||
} |
||||
for (int i = 0; i < colorSet.length; i++) { |
||||
if (colorSet[i] != null) { |
||||
if (!clearColorFound) { |
||||
clearColorFound = true; |
||||
clearToColor = colorSet[i]; |
||||
} |
||||
cMap[orderedBands[i + startOffset]] = colorSet[i]; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
// finally adjust the clearToColor if one was requested
|
||||
if (clearToColorRequested != null) { |
||||
clearToColor = clearToColorRequested; |
||||
} |
||||
//Next we'll switch to Rasters to easily handle floating point precision
|
||||
// operations upon the individual channels.
|
||||
|
||||
WritableRaster outRaster, inRaster; |
||||
int w = argbMappedBufferedImage.getWidth(); |
||||
int h = argbMappedBufferedImage.getHeight(); |
||||
BandedSampleModel inSM = new BandedSampleModel(DataBuffer.TYPE_FLOAT, w, h, 4); |
||||
DataBufferFloat inDBF = new DataBufferFloat((w * h), 4);//4 banks, and total size
|
||||
inRaster = Raster.createWritableRaster(inSM, inDBF, null); // that null just means point 0, 0 (top/left)
|
||||
outRaster = inRaster.createCompatibleWritableRaster(w, h); |
||||
float[] cMaptoFlArray, outColortoFlArray, clearColortoFlArray; |
||||
float inBandAsAlpha; |
||||
Color paletteColor; |
||||
// now we convert from W/E the argbMappedBufferedImage's format to
|
||||
// our normalized [0f..1f] RGBA raster
|
||||
outColortoFlArray = new float[]{0f, 0f, 0f, 0f}; // or new float[4]... w/e
|
||||
clearColortoFlArray = clearToColor.getRGBComponents(new float[4]); |
||||
clearColortoFlArray[ALPHA] = 0f; |
||||
for (int y = 0; y < h; y++) { |
||||
for (int x = 0; x < w; x++) { |
||||
int packedPixel = argbMappedBufferedImage.getRGB(x, y); |
||||
int testing; |
||||
float ftesting; |
||||
//outColortoFlArray[ALPHA] = (((packedPixel >> 24) & 0xFF) / 255);
|
||||
testing = packedPixel; |
||||
testing = testing >> 24; |
||||
testing = testing & 0xFF; |
||||
ftesting = testing; |
||||
ftesting = ftesting / 255; |
||||
outColortoFlArray[ALPHA] = ftesting; |
||||
|
||||
//outColortoFlArray[RED] = (((packedPixel >> 16) & 0xFF) / 255);
|
||||
testing = packedPixel; |
||||
testing = testing >> 16; |
||||
testing = testing & 0xFF; |
||||
ftesting = testing; |
||||
ftesting = ftesting / 255; |
||||
outColortoFlArray[RED] = ftesting; |
||||
|
||||
//outColortoFlArray[GREEN] = (((packedPixel >> 8) & 0xFF) / 255);
|
||||
testing = packedPixel; |
||||
testing = testing >> 8; |
||||
testing = testing & 0xFF; |
||||
ftesting = testing; |
||||
ftesting = ftesting / 255; |
||||
outColortoFlArray[GREEN] = ftesting; |
||||
|
||||
//outColortoFlArray[BLUE] = ( (packedPixel & 0xFF) / 255);
|
||||
testing = packedPixel; |
||||
testing = testing & 0xFF; |
||||
ftesting = testing; |
||||
ftesting = ftesting / 255; |
||||
outColortoFlArray[BLUE] = ftesting; |
||||
|
||||
inRaster.setPixel(x, y, outColortoFlArray); |
||||
outRaster.setPixel(x, y, clearColortoFlArray); |
||||
} |
||||
} |
||||
// next, we process all bands in order - a "band" being one channel of A,R,G,B.
|
||||
// as each band is processed the outRaster keeps getting "resampled" to apply
|
||||
// the next band properly. all values are considered normalized [0f..1f]
|
||||
for (int band : orderedBands) { |
||||
paletteColor = cMap[band]; |
||||
cMaptoFlArray = paletteColor.getRGBComponents(new float[4]);// this nullifies translucency
|
||||
if (paletteColor != BLACK_NO_ALPHA) { |
||||
for (int y = 0; y < h; y++) { |
||||
for (int x = 0; x < w; x++) { |
||||
//inBandAsAlpha = inRaster.getSample(x, y, band);
|
||||
inBandAsAlpha = inRaster.getSampleFloat(x, y, band); |
||||
outColortoFlArray = outRaster.getPixel(x, y, new float[4]); |
||||
outColortoFlArray[RED] = (outColortoFlArray[RED] |
||||
* (1f - (inBandAsAlpha * cMaptoFlArray[ALPHA]))) |
||||
+ (cMaptoFlArray[RED] * (inBandAsAlpha * cMaptoFlArray[ALPHA])); |
||||
outColortoFlArray[GREEN] = (outColortoFlArray[GREEN] |
||||
* (1f - (inBandAsAlpha * cMaptoFlArray[ALPHA]))) |
||||
+ (cMaptoFlArray[GREEN] * (inBandAsAlpha * cMaptoFlArray[ALPHA])); |
||||
outColortoFlArray[BLUE] = (outColortoFlArray[BLUE] |
||||
* (1f - (inBandAsAlpha * cMaptoFlArray[ALPHA]))) |
||||
+ (cMaptoFlArray[BLUE] * (inBandAsAlpha * cMaptoFlArray[ALPHA])); |
||||
|
||||
outColortoFlArray[ALPHA] = (outColortoFlArray[ALPHA] |
||||
* (1f - (inBandAsAlpha * cMaptoFlArray[ALPHA]))) |
||||
+ (cMaptoFlArray[ALPHA] * (inBandAsAlpha * cMaptoFlArray[ALPHA])); |
||||
|
||||
outRaster.setPixel(x, y, outColortoFlArray); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
//then we convert n' ship
|
||||
BufferedImage returnBI = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB); |
||||
for (int y = 0; y < h; y++) { |
||||
for (int x = 0; x < w; x++) { |
||||
outColortoFlArray = outRaster.getPixel(x, y, new float[4]); |
||||
int packedColor = ((int) (outColortoFlArray[ALPHA] * 255f) << 24) |
||||
| ((int) (outColortoFlArray[RED] * 255f) << 16) |
||||
| ((int) (outColortoFlArray[GREEN] * 255f) << 8) |
||||
| ((int) (outColortoFlArray[BLUE] * 255f)); |
||||
returnBI.setRGB(x, y, packedColor); |
||||
} |
||||
} |
||||
|
||||
return returnBI; |
||||
} |
||||
|
||||
public static BufferedImage paletteSwapARGB8(Color[] colorSet, BufferedImage argbMappedBufferedImage) { |
||||
|
||||
return paletteSwapARGB8(colorSet, null, argbMappedBufferedImage); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,11 @@ |
||||
nimrodlf.p1=#77411D |
||||
nimrodlf.p2=#9E5F28 |
||||
nimrodlf.p3=#948519 |
||||
nimrodlf.s1=#303030 |
||||
nimrodlf.s2=#3A3A3A |
||||
nimrodlf.s3=#515151 |
||||
nimrodlf.w=#262626 |
||||
nimrodlf.b=#E8EAE0 |
||||
nimrodlf.menuOpacity=219 |
||||
nimrodlf.frameOpacity=180 |
||||
nimrodlf.font=DejaVu Sans Condensed-BOLD-12 |
@ -0,0 +1,153 @@ |
||||
/* |
||||
* To change this license header, choose License Headers in Project Properties. |
||||
* To change this template file, choose Tools | Templates |
||||
* and open the template in the editor. |
||||
*/ |
||||
package org.jme3.netbeans.plaf.darkmonkey; |
||||
|
||||
import com.nilo.plaf.nimrod.NimRODIconFactory; |
||||
import java.awt.Color; |
||||
import java.awt.Component; |
||||
import java.awt.Graphics; |
||||
import java.awt.Image; |
||||
import java.awt.image.BandedSampleModel; |
||||
import java.awt.image.BufferedImage; |
||||
import java.awt.image.DataBuffer; |
||||
import java.awt.image.DataBufferFloat; |
||||
import java.awt.image.Raster; |
||||
import java.awt.image.WritableRaster; |
||||
import java.io.Serializable; |
||||
import javax.swing.Icon; |
||||
import javax.swing.ImageIcon; |
||||
import javax.swing.plaf.UIResource; |
||||
|
||||
/** |
||||
* This class provides for overrides on the system Icons from the |
||||
* NimROD look and feel |
||||
* @author charles |
||||
*/ |
||||
public class DarkMonkeyIconFactory extends NimRODIconFactory{ |
||||
private static Icon treeCollapsedIcon; |
||||
private static Icon treeExpandedIcon; |
||||
|
||||
public static Icon getTreeCollapsedIcon(){ |
||||
if(treeCollapsedIcon == null){ |
||||
treeCollapsedIcon = new TreeCollapsedIcon(); |
||||
} |
||||
|
||||
return treeCollapsedIcon; |
||||
} |
||||
public static Icon getTreeExpandedIcon(){ |
||||
if(treeExpandedIcon == null){ |
||||
treeExpandedIcon = new TreeExpandedIcon(); |
||||
} |
||||
|
||||
return treeExpandedIcon; |
||||
} |
||||
|
||||
|
||||
private static class TreeCollapsedIcon implements Icon, UIResource, Serializable{ |
||||
private int w, h; |
||||
ImageIcon preProcessed; |
||||
{ |
||||
w = 18; |
||||
h = 18; |
||||
preProcessed = null; |
||||
} |
||||
|
||||
public TreeCollapsedIcon(){ //maybe THIS is all I need, eh?
|
||||
w = 18; |
||||
h = 18; |
||||
preProcessed = null; |
||||
} |
||||
|
||||
@Override |
||||
public void paintIcon(Component c, Graphics g, int x, int y) { |
||||
if(preProcessed != null){ |
||||
preProcessed.paintIcon(c, g, x, y); |
||||
return; |
||||
} |
||||
|
||||
//process for first time, unless this gets "uninitialized" by
|
||||
// UIResource calls;
|
||||
BufferedImage bi = DMUtils.loadImagefromJar(this, "icons/nehonC2.png"); |
||||
// start the experiments!
|
||||
|
||||
Color[] normColorSet = {null, DarkMonkeyLookAndFeel.getWhite(), |
||||
null, DarkMonkeyLookAndFeel.getPrimaryControl()}; |
||||
bi = DMUtils.paletteSwapARGB8(normColorSet, bi); |
||||
// end experiment, back to old code
|
||||
ImageIcon ii = new ImageIcon(bi); |
||||
Image scaled = ii.getImage(); |
||||
ImageIcon preProcess = new ImageIcon(scaled.getScaledInstance(w, h, Image.SCALE_SMOOTH)); |
||||
preProcess.paintIcon(c, g, x, y); |
||||
preProcessed = preProcess; |
||||
} |
||||
|
||||
@Override |
||||
public int getIconWidth() { |
||||
return w; |
||||
} |
||||
|
||||
@Override |
||||
public int getIconHeight() { |
||||
return h; |
||||
} |
||||
|
||||
} |
||||
|
||||
private static class TreeExpandedIcon implements Icon, UIResource, Serializable{ |
||||
private int w, h; |
||||
ImageIcon preProcessed; |
||||
{ |
||||
w = 18; |
||||
h = 18; |
||||
preProcessed = null; |
||||
} |
||||
|
||||
|
||||
public TreeExpandedIcon(){ //maybe THIS is all I need, eh?
|
||||
w = 18; |
||||
h = 18; |
||||
preProcessed = null; |
||||
} |
||||
|
||||
@Override |
||||
public void paintIcon(Component c, Graphics g, int x, int y) { |
||||
if(preProcessed != null){ |
||||
preProcessed.paintIcon(c, g, x, y); |
||||
return; |
||||
} |
||||
|
||||
//process for first time, unless this gets "uninitialized" by
|
||||
// UIResource calls;
|
||||
|
||||
BufferedImage bi = DMUtils.loadImagefromJar(this, "icons/nehonE2.png"); |
||||
Color[] normColorSet = { DarkMonkeyLookAndFeel.getWhite(), |
||||
null, DarkMonkeyLookAndFeel.getPrimaryControl()}; |
||||
bi = DMUtils.paletteSwapARGB8(normColorSet, bi); |
||||
|
||||
ImageIcon ii = new ImageIcon(bi); |
||||
Image scaled = ii.getImage(); |
||||
|
||||
ImageIcon preProcess = new ImageIcon(scaled.getScaledInstance(w, h, Image.SCALE_DEFAULT)); |
||||
|
||||
preProcess.paintIcon(c, g, x, y); |
||||
preProcessed = preProcess; |
||||
} |
||||
|
||||
@Override |
||||
public int getIconWidth() { |
||||
return w; |
||||
} |
||||
|
||||
@Override |
||||
public int getIconHeight() { |
||||
return h; |
||||
} |
||||
|
||||
} |
||||
|
||||
|
||||
|
||||
} |
@ -0,0 +1,111 @@ |
||||
/* |
||||
* To change this license header, choose License Headers in Project Properties. |
||||
* To change this template file, choose Tools | Templates |
||||
* and open the template in the editor. |
||||
*/ |
||||
package org.jme3.netbeans.plaf.darkmonkey; |
||||
|
||||
import com.nilo.plaf.nimrod.NimRODTheme; |
||||
import java.awt.Color; |
||||
import java.awt.Font; |
||||
import java.util.Enumeration; |
||||
import javax.swing.ImageIcon; |
||||
import javax.swing.UIDefaults; |
||||
|
||||
/** |
||||
* The DarkMonkey look and feel class Extends the Nimrod LAF, which in turn, |
||||
* extends Metal. The version of Nimrod used is 1.2b obtained from: <br/> |
||||
* <a src="http://nilogonzalez.es/nimrodlf/download-en.html"> |
||||
* http://nilogonzalez.es/nimrodlf/download-en.html</a>
|
||||
* <p> A copy of the jar and source used for this project is in the ext/ folder. |
||||
* </p> |
||||
* |
||||
* @author Charles Anderson |
||||
*/ |
||||
public class DarkMonkeyLookAndFeel extends com.nilo.plaf.nimrod.NimRODLookAndFeel{ |
||||
|
||||
public static final String dmLAFDefault = "DarkMonkey.theme"; |
||||
protected static NimRODTheme nrTheme = new NimRODTheme(); |
||||
|
||||
public DarkMonkeyLookAndFeel(){ |
||||
super(); |
||||
// Todo: replace following code with proper loading
|
||||
// From DarkMonkey.theme
|
||||
NimRODTheme nt = new NimRODTheme(); |
||||
|
||||
nt.setBlack(Color.decode("#E8EAE0")); |
||||
nt.setWhite(Color.decode("#262626")); |
||||
nt.setPrimary1(Color.decode("#77411D")); |
||||
nt.setPrimary2(Color.decode("#9E5F28")); |
||||
nt.setPrimary3(Color.decode("#948519")); |
||||
nt.setSecondary1(Color.decode("#303030")); |
||||
nt.setSecondary2(Color.decode("#3A3A3A")); |
||||
nt.setSecondary3(Color.decode("#515151")); |
||||
nt.setFrameOpacity(180); |
||||
nt.setMenuOpacity(219); |
||||
nt.setFont(Font.decode("DejaVu Sans Condensed-PLAIN-12")); |
||||
|
||||
setCurrentTheme(nt); |
||||
|
||||
} |
||||
|
||||
/** |
||||
* This method override, getID() returns the String "DarkMonkey" for |
||||
* registering this Look And Feel with the UImanager. |
||||
* @return String "DarkMonkey" |
||||
*/ |
||||
@Override |
||||
public String getID() { |
||||
return "DarkMonkey"; |
||||
} |
||||
|
||||
/** |
||||
* This method override, getName() returns the String "DarkMonkey" for |
||||
* its Look and Feel Name. I don't know that this is important, but is |
||||
* overridden anyway, for completion. |
||||
* @return String "DarkMonkey" |
||||
*/ |
||||
@Override |
||||
public String getName() { |
||||
return "DarkMonkey"; |
||||
} |
||||
|
||||
/** |
||||
* This method override, getDescription() returns the String |
||||
* "Look and Feel DarkMonkey - 2015, based on NimROD 2007" for |
||||
* instances of future programming that might use it as a tool tip or |
||||
* small descriptor in their Look and Feel modules. |
||||
* @return String "Look and Feel DarkMonkey - 2015, based on NimROD 2007" |
||||
*/ |
||||
@Override |
||||
public String getDescription() { |
||||
return "Look and Feel DarkMonkey - 2015, based on NimROD 2007"; |
||||
} |
||||
|
||||
|
||||
@Override |
||||
protected void initClassDefaults( UIDefaults table) { |
||||
super.initClassDefaults( table); |
||||
/* |
||||
for( Enumeration en = table.keys(); en.hasMoreElements(); ) { |
||||
System.out.println( "[" + en.nextElement() + "]"); |
||||
} |
||||
*/ |
||||
} |
||||
|
||||
@Override |
||||
protected void initComponentDefaults( UIDefaults table) { |
||||
super.initComponentDefaults( table); |
||||
|
||||
table.put("Tree.collapsedIcon", DarkMonkeyIconFactory.getTreeCollapsedIcon()); |
||||
table.put("Tree.expandedIcon", DarkMonkeyIconFactory.getTreeExpandedIcon()); |
||||
//
|
||||
/* |
||||
for( Enumeration en = table.keys(); en.hasMoreElements(); ) { |
||||
System.out.println( "[" + en.nextElement() + "]"); |
||||
} |
||||
*/ |
||||
|
||||
} |
||||
|
||||
} |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue