Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reengineering efforts Kristín Fjóla Tómasdóttir & Joop Aué #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
112 changes: 112 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -146,4 +146,116 @@
/sdk/nbi/stub/ext/components/products/jdk/build/
/sdk/nbi/stub/ext/components/products/jdk/dist/
/sdk/jme3-dark-laf/nbproject/private/

jme3-lwjgl3/build/

### Intellij ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff:
.idea/workspace.xml
.idea/tasks.xml
.idea/dictionaries
.idea/vcs.xml
.idea/jsLibraryMappings.xml

# Sensitive or high-churn files:
.idea/dataSources.ids
.idea/dataSources.xml
.idea/dataSources.local.xml
.idea/sqlDataSources.xml
.idea/dynamic.xml
.idea/uiDesigner.xml

# Gradle:
.idea/gradle.xml
.idea/libraries

# Mongo Explorer plugin:
.idea/mongoSettings.xml

## File-based project format:
*.iws

## Plugin-specific files:

# IntelliJ
/out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties


### Eclipse ###

.metadata
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.settings/
.loadpath
.recommenders

# Eclipse Core
.project

# External tool builders
.externalToolBuilders/

# Locally stored "Eclipse launch configurations"
*.launch

# PyDev specific (Python IDE for Eclipse)
*.pydevproject

# CDT-specific (C/C++ Development Tooling)
.cproject

# JDT-specific (Eclipse Java Development Tools)
.classpath

# Java annotation processor (APT)
.factorypath

# PDT-specific (PHP Development Tools)
.buildpath

# sbteclipse plugin
.target

# Tern plugin
.tern-project

# TeXlipse plugin
.texlipse

# STS (Spring Tool Suite)
.springBeans

# Code Recommenders
.recommenders/


### Sonar ###
#Sonar generated dir
*.sonar/

*.jdproj

sonar-project.properties

*.properties
3 changes: 2 additions & 1 deletion common.gradle
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ configurations {
dependencies {
// Adding dependencies here will add the dependencies to each subproject.
testCompile group: 'junit', name: 'junit', version: '4.12'
testCompile group: 'org.mockito', name: 'mockito-core', version: '2.0.28-beta'
testCompile group: 'org.easytesting', name: 'fest-assert-core', version: '2.0M10'
testCompile group: 'org.mockito', name: 'mockito-core', version: '2.0.28-beta'
compile 'org.apache.commons:commons-lang3:3.0'
deployerJars "org.apache.maven.wagon:wagon-ssh:2.9"
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*___Generated_by_IDEA___*/

package com.jme3.android;

/* This stub is only used by the IDE. It is NOT the BuildConfig class actually packed into the APK */
public final class BuildConfig {
public final static boolean DEBUG = Boolean.parseBoolean(null);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/*___Generated_by_IDEA___*/

package com.jme3.android;

/* This stub is only used by the IDE. It is NOT the Manifest class actually packed into the APK */
public final class Manifest {
}
7 changes: 7 additions & 0 deletions jme3-android-examples/src/main/gen/com/jme3/android/R.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/*___Generated_by_IDEA___*/

package com.jme3.android;

/* This stub is only used by the IDE. It is NOT the R class actually packed into the APK */
public final class R {
}
18 changes: 18 additions & 0 deletions jme3-android/src/main/java/com/jme3/system/android/OGLESContext.java
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@
import com.jme3.renderer.opengl.GLFbo;
import com.jme3.renderer.opengl.GLRenderer;
import com.jme3.system.*;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.logging.Level;
import java.util.logging.Logger;
Expand Down Expand Up @@ -278,6 +282,20 @@ public TouchInput getTouchInput() {
return androidInput.getTouchInput();
}

@Override
public java.util.List<Input> getInput() {
List<Input> inputs = new ArrayList<>();

inputs.add(getKeyInput());
inputs.add(getMouseInput());
if(!settings.getBoolean("DisableJoysticks")) {
inputs.add(getJoyInput());
}
inputs.add(getTouchInput());
inputs.removeAll(Collections.singleton(null));

return inputs;
}
@Override
public Timer getTimer() {
return timer;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*___Generated_by_IDEA___*/

package com.jme3.androiddemo;

/* This stub is only used by the IDE. It is NOT the BuildConfig class actually packed into the APK */
public final class BuildConfig {
public final static boolean DEBUG = Boolean.parseBoolean(null);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/*___Generated_by_IDEA___*/

package com.jme3.androiddemo;

/* This stub is only used by the IDE. It is NOT the Manifest class actually packed into the APK */
public final class Manifest {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/*___Generated_by_IDEA___*/

package com.jme3.androiddemo;

/* This stub is only used by the IDE. It is NOT the R class actually packed into the APK */
public final class R {
}
26 changes: 13 additions & 13 deletions jme3-blender/src/main/java/com/jme3/scene/plugins/blender/textures/CombinedTexture.java
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import java.util.logging.Level;
import java.util.logging.Logger;

import com.jme3.texture.TextureDefault2D;
import jme3tools.converters.ImageToAwt;

import com.jme3.math.ColorRGBA;
Expand All @@ -33,7 +34,6 @@
import com.jme3.texture.Texture.MagFilter;
import com.jme3.texture.Texture.MinFilter;
import com.jme3.texture.Texture.WrapMode;
import com.jme3.texture.Texture2D;
import com.jme3.texture.TextureCubeMap;
import com.jme3.texture.image.ColorSpace;
import com.jme3.util.BufferUtils;
Expand Down Expand Up @@ -96,7 +96,7 @@ public CombinedTexture(int mappingType, boolean discardCoveredTextures) {
* the blender context
*/
public void add(Texture texture, TextureBlender textureBlender, int uvCoordinatesType, int projectionType, Structure textureStructure, String uvCoordinatesName, BlenderContext blenderContext) {
if (!(texture instanceof GeneratedTexture) && !(texture instanceof Texture2D)) {
if (!(texture instanceof GeneratedTexture) && !(texture instanceof TextureDefault2D)) {
throw new IllegalArgumentException("Unsupported texture type: " + (texture == null ? "null" : texture.getClass()));
}
if (!(texture instanceof GeneratedTexture) || blenderContext.getBlenderKey().isLoadGeneratedTextures()) {
Expand All @@ -120,7 +120,7 @@ public void add(Texture texture, TextureBlender textureBlender, int uvCoordinate
}

/**
* This method flattens the texture and creates a single result of Texture2D
* This method flattens the texture and creates a single result of TextureDefault2D
* type.
*
* @param geometry
Expand Down Expand Up @@ -149,7 +149,7 @@ public void flatten(Geometry geometry, Long geometriesOMA, Map<String, List<Vect
if (previousTexture == null) {// the first texture will lead the others to its shape
if (textureData.texture instanceof GeneratedTexture) {
resultTexture = ((GeneratedTexture) textureData.texture).triangulate(mesh, geometriesOMA, textureData.uvCoordinatesType, blenderContext);
} else if (textureData.texture instanceof Texture2D) {
} else if (textureData.texture instanceof TextureDefault2D) {
resultTexture = textureData.texture;

if (textureData.uvCoordinatesType == UVCoordinatesType.TEXCO_UV && userDefinedUVCoordinates != null && userDefinedUVCoordinates.size() > 0) {
Expand All @@ -174,7 +174,7 @@ public void flatten(Geometry geometry, Long geometriesOMA, Map<String, List<Vect
} else {
if (textureData.texture instanceof GeneratedTexture) {
if (!(resultTexture instanceof TriangulatedTexture)) {
resultTexture = new TriangulatedTexture((Texture2D) resultTexture, resultUVS, blenderContext);
resultTexture = new TriangulatedTexture((TextureDefault2D) resultTexture, resultUVS, blenderContext);
resultUVS = null;
previousTexture = resultTexture;
}
Expand All @@ -183,14 +183,14 @@ public void flatten(Geometry geometry, Long geometriesOMA, Map<String, List<Vect
triangulatedTexture.castToUVS((TriangulatedTexture) resultTexture, blenderContext);
triangulatedTexture.blend(textureData.textureBlender, (TriangulatedTexture) resultTexture, blenderContext);
resultTexture = previousTexture = triangulatedTexture;
} else if (textureData.texture instanceof Texture2D) {
if (this.isUVTypesMatch(masterUVCoordinatesType, masterUserUVSetName, textureData.uvCoordinatesType, textureData.uvCoordinatesName) && resultTexture instanceof Texture2D) {
this.scale((Texture2D) textureData.texture, resultTexture.getImage().getWidth(), resultTexture.getImage().getHeight());
} else if (textureData.texture instanceof TextureDefault2D) {
if (this.isUVTypesMatch(masterUVCoordinatesType, masterUserUVSetName, textureData.uvCoordinatesType, textureData.uvCoordinatesName) && resultTexture instanceof TextureDefault2D) {
this.scale((TextureDefault2D) textureData.texture, resultTexture.getImage().getWidth(), resultTexture.getImage().getHeight());
ImageUtils.merge(resultTexture.getImage(), textureData.texture.getImage());
previousTexture = resultTexture;
} else {
if (!(resultTexture instanceof TriangulatedTexture)) {
resultTexture = new TriangulatedTexture((Texture2D) resultTexture, resultUVS, blenderContext);
resultTexture = new TriangulatedTexture((TextureDefault2D) resultTexture, resultUVS, blenderContext);
resultUVS = null;
}
// first triangulate the current texture
Expand All @@ -205,7 +205,7 @@ public void flatten(Geometry geometry, Long geometriesOMA, Map<String, List<Vect
TemporalMesh geometries = (TemporalMesh) blenderContext.getLoadedFeature(geometriesOMA, LoadedDataType.TEMPORAL_MESH);
textureUVS = UVCoordinatesGenerator.generateUVCoordinatesFor2DTexture(mesh, textureData.uvCoordinatesType, textureData.projectionType, geometries);
}
TriangulatedTexture triangulatedTexture = new TriangulatedTexture((Texture2D) textureData.texture, textureUVS, blenderContext);
TriangulatedTexture triangulatedTexture = new TriangulatedTexture((TextureDefault2D) textureData.texture, textureUVS, blenderContext);
// then move the texture to different UV's
triangulatedTexture.castToUVS((TriangulatedTexture) resultTexture, blenderContext);
// merge triangulated textures
Expand Down Expand Up @@ -259,7 +259,7 @@ public TextureCubeMap generateSkyTexture(ColorRGBA horizontalColor, ColorRGBA ze
LOGGER.fine("Computing the texture size.");
int size = -1;
for (TextureData textureData : textureDatas) {
if (textureData.texture instanceof Texture2D) {
if (textureData.texture instanceof TextureDefault2D) {
size = Math.max(textureData.texture.getImage().getWidth(), size);
size = Math.max(textureData.texture.getImage().getHeight(), size);
}
Expand Down Expand Up @@ -354,7 +354,7 @@ private boolean isUVTypesMatch(UVCoordinatesType type1, String uvSetName1, UVCoo
private void blend(Texture texture, TextureBlender textureBlender, BlenderContext blenderContext) {
if (texture instanceof TriangulatedTexture) {
((TriangulatedTexture) texture).blend(textureBlender, null, blenderContext);
} else if (texture instanceof Texture2D) {
} else if (texture instanceof TextureDefault2D) {
Image blendedImage = textureBlender.blend(texture.getImage(), null, blenderContext);
texture.setImage(blendedImage);
} else {
Expand Down Expand Up @@ -490,7 +490,7 @@ private boolean isWithoutAlpha(TextureData textureData, BlenderContext blenderCo
* @param height
* new height of the texture
*/
private void scale(Texture2D texture, int width, int height) {
private void scale(TextureDefault2D texture, int width, int height) {
// first determine if scaling is required
boolean scaleRequired = texture.getImage().getWidth() != width || texture.getImage().getHeight() != height;

Expand Down
6 changes: 3 additions & 3 deletions jme3-blender/src/main/java/com/jme3/scene/plugins/blender/textures/TextureHelper.java
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
import com.jme3.texture.Texture;
import com.jme3.texture.Texture.MinFilter;
import com.jme3.texture.Texture.WrapMode;
import com.jme3.texture.Texture2D;
import com.jme3.texture.TextureDefault2D;
import com.jme3.texture.image.ColorSpace;
import com.jme3.util.BufferUtils;

Expand Down Expand Up @@ -250,11 +250,11 @@ public Texture loadImageAsTexture(Structure imageStructure, int imaflag, Blender
blenderContext.getInputStream().setPosition(dataFileBlock.getBlockPosition());

// Should the texture be flipped? It works for sinbad ..
result = new Texture2D(new ImageLoader().loadImage(blenderContext.getInputStream(), dataFileBlock.getBlockPosition(), true));
result = new TextureDefault2D(new ImageLoader().loadImage(blenderContext.getInputStream(), dataFileBlock.getBlockPosition(), true));
}
}
//} else {
// result = new Texture2D(im);
// result = new TextureDefault2D(im);
// }

if (result != null) {// render result is not being loaded
Expand Down
Loading