Merge branch 'master' of https://github.com/jMonkeyEngine/jmonkeyengine.git
commit
0a45432cea
@ -0,0 +1,29 @@ |
||||
// |
||||
// This file is to be applied to some subproject. |
||||
// |
||||
|
||||
apply plugin: 'com.jfrog.bintray' |
||||
|
||||
bintray { |
||||
user = bintray_user |
||||
key = bintray_api_key |
||||
configurations = ['archives'] |
||||
dryRun = false |
||||
pkg { |
||||
repo = 'org.jmonkeyengine' |
||||
userOrg = 'jmonkeyengine' |
||||
name = project.name |
||||
desc = POM_DESCRIPTION |
||||
websiteUrl = POM_URL |
||||
licenses = ['BSD New'] |
||||
vcsUrl = POM_SCM_URL |
||||
labels = ['jmonkeyengine'] |
||||
} |
||||
} |
||||
|
||||
bintrayUpload.dependsOn(writeFullPom) |
||||
|
||||
bintrayUpload.onlyIf { |
||||
(bintray_api_key.length() > 0) && |
||||
!(version ==~ /.*SNAPSHOT/) |
||||
} |
@ -0,0 +1,97 @@ |
||||
/* |
||||
* 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 com.jme3.util.mikktspace; |
||||
|
||||
/** |
||||
* |
||||
* @author Nehon |
||||
*/ |
||||
public interface MikkTSpaceContext { |
||||
|
||||
/** |
||||
* Returns the number of faces (triangles/quads) on the mesh to be |
||||
* processed. |
||||
* |
||||
* @return |
||||
*/ |
||||
public int getNumFaces(); |
||||
|
||||
/** |
||||
* Returns the number of vertices on face number iFace iFace is a number in |
||||
* the range {0, 1, ..., getNumFaces()-1} |
||||
* |
||||
* @param face |
||||
* @return |
||||
*/ |
||||
public int getNumVerticesOfFace(int face); |
||||
|
||||
/** |
||||
* returns the position/normal/texcoord of the referenced face of vertex |
||||
* number iVert. iVert is in the range {0,1,2} for triangles and {0,1,2,3} |
||||
* for quads. |
||||
* |
||||
* @param posOut |
||||
* @param face |
||||
* @param vert |
||||
*/ |
||||
public void getPosition(float posOut[], int face, int vert); |
||||
|
||||
public void getNormal(float normOut[], int face, int vert); |
||||
|
||||
public void getTexCoord(float texOut[], int face, int vert); |
||||
|
||||
/** |
||||
* The call-backsetTSpaceBasic() is sufficient for basic normal mapping. |
||||
* This function is used to return the tangent and sign to the application. |
||||
* tangent is a unit length vector. For normal maps it is sufficient to use |
||||
* the following simplified version of the bitangent which is generated at |
||||
* pixel/vertex level. |
||||
* |
||||
* bitangent = fSign * cross(vN, tangent); |
||||
* |
||||
* Note that the results are returned unindexed. It is possible to generate |
||||
* a new index list But averaging/overwriting tangent spaces by using an |
||||
* already existing index list WILL produce INCRORRECT results. DO NOT! use |
||||
* an already existing index list. |
||||
* |
||||
* @param tangent |
||||
* @param sign |
||||
* @param face |
||||
* @param vert |
||||
*/ |
||||
public void setTSpaceBasic(float tangent[], float sign, int face, int vert); |
||||
|
||||
/** |
||||
* This function is used to return tangent space results to the application. |
||||
* tangent and biTangent are unit length vectors and fMagS and fMagT are |
||||
* their true magnitudes which can be used for relief mapping effects. |
||||
* |
||||
* biTangent is the "real" bitangent and thus may not be perpendicular to |
||||
* tangent. However, both are perpendicular to the vertex normal. For normal |
||||
* maps it is sufficient to use the following simplified version of the |
||||
* bitangent which is generated at pixel/vertex level. |
||||
* |
||||
* <pre> |
||||
* fSign = bIsOrientationPreserving ? 1.0f : (-1.0f); |
||||
* bitangent = fSign * cross(vN, tangent); |
||||
* </pre> |
||||
* |
||||
* Note that the results are returned unindexed. It is possible to generate |
||||
* a new index list. But averaging/overwriting tangent spaces by using an |
||||
* already existing index list WILL produce INCRORRECT results. DO NOT! use |
||||
* an already existing index list. |
||||
* |
||||
* @param tangent |
||||
* @param biTangent |
||||
* @param magS |
||||
* @param magT |
||||
* @param isOrientationPreserving |
||||
* @param face |
||||
* @param vert |
||||
*/ |
||||
void setTSpace(float tangent[], float biTangent[], float magS, float magT, |
||||
boolean isOrientationPreserving, int face, int vert); |
||||
} |
@ -0,0 +1,100 @@ |
||||
/* |
||||
* 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 com.jme3.util.mikktspace; |
||||
|
||||
import com.jme3.scene.Mesh; |
||||
import com.jme3.scene.VertexBuffer; |
||||
import com.jme3.scene.mesh.IndexBuffer; |
||||
import com.jme3.util.BufferUtils; |
||||
import java.nio.FloatBuffer; |
||||
|
||||
/** |
||||
* |
||||
* @author Nehon |
||||
*/ |
||||
public class MikkTSpaceImpl implements MikkTSpaceContext { |
||||
|
||||
Mesh mesh; |
||||
|
||||
public MikkTSpaceImpl(Mesh mesh) { |
||||
this.mesh = mesh; |
||||
VertexBuffer tangentBuffer = mesh.getBuffer(VertexBuffer.Type.Tangent); |
||||
if(tangentBuffer == null){ |
||||
FloatBuffer fb = BufferUtils.createFloatBuffer(mesh.getVertexCount() * 4); |
||||
mesh.setBuffer(VertexBuffer.Type.Tangent, 4, fb); |
||||
} |
||||
|
||||
//TODO ensure the Tangent buffer exists, else create one.
|
||||
} |
||||
|
||||
@Override |
||||
public int getNumFaces() { |
||||
return mesh.getTriangleCount(); |
||||
} |
||||
|
||||
@Override |
||||
public int getNumVerticesOfFace(int face) { |
||||
return 3; |
||||
} |
||||
|
||||
@Override |
||||
public void getPosition(float[] posOut, int face, int vert) { |
||||
int vertIndex = getIndex(face, vert); |
||||
VertexBuffer position = mesh.getBuffer(VertexBuffer.Type.Position); |
||||
FloatBuffer pos = (FloatBuffer) position.getData(); |
||||
pos.position(vertIndex * 3); |
||||
posOut[0] = pos.get(); |
||||
posOut[1] = pos.get(); |
||||
posOut[2] = pos.get(); |
||||
} |
||||
|
||||
@Override |
||||
public void getNormal(float[] normOut, int face, int vert) { |
||||
int vertIndex = getIndex(face, vert); |
||||
VertexBuffer normal = mesh.getBuffer(VertexBuffer.Type.Normal); |
||||
FloatBuffer norm = (FloatBuffer) normal.getData(); |
||||
norm.position(vertIndex * 3); |
||||
normOut[0] = norm.get(); |
||||
normOut[1] = norm.get(); |
||||
normOut[2] = norm.get(); |
||||
} |
||||
|
||||
@Override |
||||
public void getTexCoord(float[] texOut, int face, int vert) { |
||||
int vertIndex = getIndex(face, vert); |
||||
VertexBuffer texCoord = mesh.getBuffer(VertexBuffer.Type.TexCoord); |
||||
FloatBuffer tex = (FloatBuffer) texCoord.getData(); |
||||
tex.position(vertIndex * 2); |
||||
texOut[0] = tex.get(); |
||||
texOut[1] = tex.get(); |
||||
} |
||||
|
||||
@Override |
||||
public void setTSpaceBasic(float[] tangent, float sign, int face, int vert) { |
||||
int vertIndex = getIndex(face, vert); |
||||
VertexBuffer tangentBuffer = mesh.getBuffer(VertexBuffer.Type.Tangent); |
||||
FloatBuffer tan = (FloatBuffer) tangentBuffer.getData(); |
||||
|
||||
tan.position(vertIndex * 4); |
||||
tan.put(tangent); |
||||
tan.put(sign); |
||||
|
||||
tan.rewind(); |
||||
tangentBuffer.setUpdateNeeded(); |
||||
} |
||||
|
||||
@Override |
||||
public void setTSpace(float[] tangent, float[] biTangent, float magS, float magT, boolean isOrientationPreserving, int face, int vert) { |
||||
//Do nothing
|
||||
} |
||||
|
||||
private int getIndex(int face, int vert) { |
||||
IndexBuffer index = mesh.getIndexBuffer(); |
||||
int vertIndex = index.get(face * 3 + vert); |
||||
return vertIndex; |
||||
} |
||||
|
||||
} |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,72 @@ |
||||
package jme3test.app; |
||||
|
||||
import com.jme3.app.SimpleApplication; |
||||
import com.jme3.material.Material; |
||||
import com.jme3.math.ColorRGBA; |
||||
import com.jme3.scene.Geometry; |
||||
import com.jme3.scene.shape.Box; |
||||
|
||||
/** |
||||
* @author john01dav |
||||
*/ |
||||
public class TestEnqueueRunnable extends SimpleApplication{ |
||||
private ExampleAsyncTask exampleAsyncTask; |
||||
|
||||
public static void main(String[] args){ |
||||
new TestEnqueueRunnable().start(); |
||||
} |
||||
|
||||
@Override |
||||
public void simpleInitApp(){ |
||||
Geometry geom = new Geometry("Box", new Box(1, 1, 1)); |
||||
Material material = new Material(getAssetManager(), "/Common/MatDefs/Misc/Unshaded.j3md"); |
||||
material.setColor("Color", ColorRGBA.Blue); //a color is needed to start with
|
||||
geom.setMaterial(material); |
||||
getRootNode().attachChild(geom); |
||||
|
||||
exampleAsyncTask = new ExampleAsyncTask(material); |
||||
exampleAsyncTask.getThread().start(); |
||||
} |
||||
|
||||
@Override |
||||
public void destroy(){ |
||||
exampleAsyncTask.endTask(); |
||||
super.destroy(); |
||||
} |
||||
|
||||
private class ExampleAsyncTask implements Runnable{ |
||||
private final Thread thread; |
||||
private final Material material; |
||||
private volatile boolean running = true; |
||||
|
||||
public ExampleAsyncTask(Material material){ |
||||
this.thread = new Thread(this); |
||||
this.material = material; |
||||
} |
||||
|
||||
public Thread getThread(){ |
||||
return thread; |
||||
} |
||||
|
||||
public void run(){ |
||||
while(running){ |
||||
enqueue(new Runnable(){ //primary usage of this in real applications would use lambda expressions which are unavailable at java 6
|
||||
public void run(){ |
||||
material.setColor("Color", ColorRGBA.randomColor()); |
||||
} |
||||
}); |
||||
|
||||
try{ |
||||
Thread.sleep(1000); |
||||
}catch(InterruptedException e){} |
||||
} |
||||
} |
||||
|
||||
public void endTask(){ |
||||
running = false; |
||||
thread.interrupt(); |
||||
} |
||||
|
||||
} |
||||
|
||||
} |
Binary file not shown.
Binary file not shown.
@ -0,0 +1,171 @@ |
||||
/* |
||||
* 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.input.lwjgl; |
||||
|
||||
import static org.lwjgl.glfw.GLFW.*; |
||||
import static com.jme3.input.KeyInput.*; |
||||
|
||||
public class GlfwKeyMap { |
||||
|
||||
private static final int[] glfwToJmeKeyMap = new int[GLFW_KEY_LAST + 1]; |
||||
|
||||
private static void reg(int jmeKey, int glfwKey) { |
||||
glfwToJmeKeyMap[glfwKey] = jmeKey; |
||||
} |
||||
|
||||
static { |
||||
reg(KEY_ESCAPE, GLFW_KEY_ESCAPE); |
||||
reg(KEY_1, GLFW_KEY_1); |
||||
reg(KEY_2, GLFW_KEY_2); |
||||
reg(KEY_3, GLFW_KEY_3); |
||||
reg(KEY_4, GLFW_KEY_4); |
||||
reg(KEY_5, GLFW_KEY_5); |
||||
reg(KEY_6, GLFW_KEY_6); |
||||
reg(KEY_7, GLFW_KEY_7); |
||||
reg(KEY_8, GLFW_KEY_8); |
||||
reg(KEY_9, GLFW_KEY_9); |
||||
reg(KEY_0, GLFW_KEY_0); |
||||
reg(KEY_MINUS, GLFW_KEY_MINUS); |
||||
reg(KEY_EQUALS, GLFW_KEY_EQUAL); |
||||
reg(KEY_BACK, GLFW_KEY_BACKSPACE); |
||||
reg(KEY_TAB, GLFW_KEY_TAB); |
||||
reg(KEY_Q, GLFW_KEY_Q); |
||||
reg(KEY_W, GLFW_KEY_W); |
||||
reg(KEY_E, GLFW_KEY_E); |
||||
reg(KEY_R, GLFW_KEY_R); |
||||
reg(KEY_T, GLFW_KEY_T); |
||||
reg(KEY_Y, GLFW_KEY_Y); |
||||
reg(KEY_U, GLFW_KEY_U); |
||||
reg(KEY_I, GLFW_KEY_I); |
||||
reg(KEY_O, GLFW_KEY_O); |
||||
reg(KEY_P, GLFW_KEY_P); |
||||
reg(KEY_LBRACKET, GLFW_KEY_LEFT_BRACKET); |
||||
reg(KEY_RBRACKET, GLFW_KEY_RIGHT_BRACKET); |
||||
reg(KEY_RETURN, GLFW_KEY_ENTER); |
||||
reg(KEY_LCONTROL, GLFW_KEY_LEFT_CONTROL); |
||||
reg(KEY_A, GLFW_KEY_A); |
||||
reg(KEY_S, GLFW_KEY_S); |
||||
reg(KEY_D, GLFW_KEY_D); |
||||
reg(KEY_F, GLFW_KEY_F); |
||||
reg(KEY_G, GLFW_KEY_G); |
||||
reg(KEY_H, GLFW_KEY_H); |
||||
reg(KEY_J, GLFW_KEY_J); |
||||
reg(KEY_K, GLFW_KEY_K); |
||||
reg(KEY_L, GLFW_KEY_L); |
||||
reg(KEY_SEMICOLON, GLFW_KEY_SEMICOLON); |
||||
reg(KEY_APOSTROPHE, GLFW_KEY_APOSTROPHE); |
||||
reg(KEY_GRAVE, GLFW_KEY_GRAVE_ACCENT); |
||||
reg(KEY_LSHIFT, GLFW_KEY_LEFT_SHIFT); |
||||
reg(KEY_BACKSLASH, GLFW_KEY_BACKSLASH); |
||||
reg(KEY_Z, GLFW_KEY_Z); |
||||
reg(KEY_X, GLFW_KEY_X); |
||||
reg(KEY_C, GLFW_KEY_C); |
||||
reg(KEY_V, GLFW_KEY_V); |
||||
reg(KEY_B, GLFW_KEY_B); |
||||
reg(KEY_N, GLFW_KEY_N); |
||||
reg(KEY_M, GLFW_KEY_M); |
||||
reg(KEY_COMMA, GLFW_KEY_COMMA); |
||||
reg(KEY_PERIOD, GLFW_KEY_PERIOD); |
||||
reg(KEY_SLASH, GLFW_KEY_SLASH); |
||||
reg(KEY_RSHIFT, GLFW_KEY_RIGHT_SHIFT); |
||||
reg(KEY_MULTIPLY, GLFW_KEY_KP_MULTIPLY); |
||||
reg(KEY_LMENU, GLFW_KEY_LEFT_ALT); |
||||
reg(KEY_SPACE, GLFW_KEY_SPACE); |
||||
reg(KEY_CAPITAL, GLFW_KEY_CAPS_LOCK); |
||||
reg(KEY_F1, GLFW_KEY_F1); |
||||
reg(KEY_F2, GLFW_KEY_F2); |
||||
reg(KEY_F3, GLFW_KEY_F3); |
||||
reg(KEY_F4, GLFW_KEY_F4); |
||||
reg(KEY_F5, GLFW_KEY_F5); |
||||
reg(KEY_F6, GLFW_KEY_F6); |
||||
reg(KEY_F7, GLFW_KEY_F7); |
||||
reg(KEY_F8, GLFW_KEY_F8); |
||||
reg(KEY_F9, GLFW_KEY_F9); |
||||
reg(KEY_F10, GLFW_KEY_F10); |
||||
reg(KEY_NUMLOCK, GLFW_KEY_NUM_LOCK); |
||||
reg(KEY_SCROLL, GLFW_KEY_SCROLL_LOCK); |
||||
reg(KEY_NUMPAD7, GLFW_KEY_KP_7); |
||||
reg(KEY_NUMPAD8, GLFW_KEY_KP_8); |
||||
reg(KEY_NUMPAD9, GLFW_KEY_KP_9); |
||||
reg(KEY_SUBTRACT, GLFW_KEY_KP_SUBTRACT); |
||||
reg(KEY_NUMPAD4, GLFW_KEY_KP_4); |
||||
reg(KEY_NUMPAD5, GLFW_KEY_KP_5); |
||||
reg(KEY_NUMPAD6, GLFW_KEY_KP_6); |
||||
reg(KEY_ADD, GLFW_KEY_KP_ADD); |
||||
reg(KEY_NUMPAD1, GLFW_KEY_KP_1); |
||||
reg(KEY_NUMPAD2, GLFW_KEY_KP_2); |
||||
reg(KEY_NUMPAD3, GLFW_KEY_KP_3); |
||||
reg(KEY_NUMPAD0, GLFW_KEY_KP_0); |
||||
reg(KEY_DECIMAL, GLFW_KEY_KP_DECIMAL); |
||||
reg(KEY_F11, GLFW_KEY_F11); |
||||
reg(KEY_F12, GLFW_KEY_F12); |
||||
reg(KEY_F13, GLFW_KEY_F13); |
||||
reg(KEY_F14, GLFW_KEY_F14); |
||||
reg(KEY_F15, GLFW_KEY_F15); |
||||
//reg(KEY_KANA, GLFW_KEY_);
|
||||
//reg(KEY_CONVERT, GLFW_KEY_);
|
||||
//reg(KEY_NOCONVERT, GLFW_KEY_);
|
||||
//reg(KEY_YEN, GLFW_KEY_);
|
||||
//reg(KEY_NUMPADEQUALS, GLFW_KEY_);
|
||||
//reg(KEY_CIRCUMFLEX, GLFW_KEY_);
|
||||
//reg(KEY_AT, GLFW_KEY_);
|
||||
//reg(KEY_COLON, GLFW_KEY_);
|
||||
//reg(KEY_UNDERLINE, GLFW_KEY_);
|
||||
//reg(KEY_KANJI, GLFW_KEY_);
|
||||
//reg(KEY_STOP, GLFW_KEY_);
|
||||
//reg(KEY_AX, GLFW_KEY_);
|
||||
//reg(KEY_UNLABELED, GLFW_KEY_);
|
||||
reg(KEY_NUMPADENTER, GLFW_KEY_KP_ENTER); |
||||
reg(KEY_RCONTROL, GLFW_KEY_RIGHT_CONTROL); |
||||
//reg(KEY_NUMPADCOMMA, GLFW_KEY_);
|
||||
reg(KEY_DIVIDE, GLFW_KEY_KP_DIVIDE); |
||||
reg(KEY_SYSRQ, GLFW_KEY_PRINT_SCREEN); |
||||
reg(KEY_RMENU, GLFW_KEY_RIGHT_ALT); |
||||
reg(KEY_PAUSE, GLFW_KEY_PAUSE); |
||||
reg(KEY_HOME, GLFW_KEY_HOME); |
||||
reg(KEY_UP, GLFW_KEY_UP); |
||||
reg(KEY_PRIOR, GLFW_KEY_PAGE_UP); |
||||
reg(KEY_LEFT, GLFW_KEY_LEFT); |
||||
reg(KEY_RIGHT, GLFW_KEY_RIGHT); |
||||
reg(KEY_END, GLFW_KEY_END); |
||||
reg(KEY_DOWN, GLFW_KEY_DOWN); |
||||
reg(KEY_NEXT, GLFW_KEY_PAGE_DOWN); |
||||
reg(KEY_INSERT, GLFW_KEY_INSERT); |
||||
reg(KEY_DELETE, GLFW_KEY_DELETE); |
||||
reg(KEY_LMETA, GLFW_KEY_LEFT_SUPER); |
||||
reg(KEY_RMETA, GLFW_KEY_RIGHT_SUPER); |
||||
} |
||||
|
||||
public static int toJmeKeyCode(int glfwKey) { |
||||
return glfwToJmeKeyMap[glfwKey]; |
||||
} |
||||
} |
@ -1,3 +1,3 @@ |
||||
CTL_FilterExplorerAction=FilterExplorer |
||||
CTL_FilterExplorerTopComponent=FilterExplorer Window |
||||
HINT_FilterExplorerTopComponent=This is a FilterExplorer window |
||||
CTL_FilterExplorerTopComponent=FilterExplorer |
||||
HINT_FilterExplorerTopComponent=The FilterExplorer provides an Overview over your current Filter |
||||
|
@ -1,4 +1,4 @@ |
||||
CTL_SceneExplorerAction=SceneExplorer |
||||
CTL_SceneExplorerTopComponent=SceneExplorer Window |
||||
HINT_SceneExplorerTopComponent=This is a SceneExplorer window |
||||
CTL_SceneExplorerTopComponent=SceneExplorer |
||||
HINT_SceneExplorerTopComponent=The SceneExplorer provides an Overview over the SceneGraph of your Scene. |
||||
SceneExplorerTopComponent.jButton1.text=update |
||||
|
Loading…
Reference in new issue