Skip to content

Commit 9cf7dc4

Browse files
authored
Merge branch 'jMonkeyEngine:master' into master
2 parents 0f410c0 + a6809b8 commit 9cf7dc4

40 files changed

Lines changed: 1506 additions & 97 deletions

File tree

.github/workflows/main.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ on:
4646
push:
4747
branches:
4848
- master
49+
- v3.7
4950
- v3.6
5051
- v3.5
5152
- v3.4
@@ -69,7 +70,7 @@ jobs:
6970
with:
7071
fetch-depth: 1
7172
- name: Validate the Gradle wrapper
72-
uses: gradle/wrapper-validation-action@v2
73+
uses: gradle/actions/wrapper-validation@v3
7374
- name: Build
7475
run: |
7576
./gradlew -PuseCommitHashAsVersionName=true --no-daemon -PbuildNativeProjects=true \
@@ -90,7 +91,7 @@ jobs:
9091
fail-fast: false
9192
matrix:
9293
os: [ubuntu-latest,windows-2019,macOS-latest]
93-
jdk: [8, 11, 17]
94+
jdk: [11, 17]
9495
include:
9596
- os: ubuntu-latest
9697
osName: linux
@@ -101,8 +102,6 @@ jobs:
101102
- os: macOS-latest
102103
osName: mac
103104
deploy: false
104-
- jdk: 8
105-
deploy: false
106105
- jdk: 11
107106
deploy: false
108107

@@ -125,7 +124,7 @@ jobs:
125124
path: build/native
126125

127126
- name: Validate the Gradle wrapper
128-
uses: gradle/wrapper-validation-action@v2
127+
uses: gradle/actions/wrapper-validation@v3
129128
- name: Build Engine
130129
shell: bash
131130
run: |

build.gradle

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -282,11 +282,6 @@ if (skipPrebuildLibraries != "true" && buildNativeProjects != "true") {
282282
// }
283283
//}
284284

285-
wrapper {
286-
gradleVersion = '7.6.2'
287-
}
288-
289-
290285
retrolambda {
291286
javaVersion JavaVersion.VERSION_1_7
292287
incremental true

common.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ dependencies {
4343
// Adding dependencies here will add the dependencies to each subproject.
4444
testImplementation 'junit:junit:4.13.2'
4545
testImplementation 'org.mockito:mockito-core:3.12.4'
46-
testImplementation 'org.codehaus.groovy:groovy-test:3.0.19'
46+
testImplementation 'org.codehaus.groovy:groovy-test:3.0.21'
4747
}
4848

4949
// Uncomment if you want to see the status of every test that is run and

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Version number: Major.Minor.SubMinor (e.g. 3.3.0)
2-
jmeVersion = 3.7.0
2+
jmeVersion = 3.8.0
33

44
# Leave empty to autogenerate
55
# (use -PjmeVersionName="myVersion" from commandline to specify a custom version name )

jme3-core/src/main/java/com/jme3/asset/ImplHandler.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,7 @@ protected T initialValue() {
124124
} catch (InstantiationException | IllegalAccessException
125125
| IllegalArgumentException | InvocationTargetException
126126
| NoSuchMethodException | SecurityException ex) {
127-
logger.log(Level.SEVERE, "Cannot create locator of type {0}, does"
128-
+ " the class have an empty and publicly accessible"
129-
+ " constructor?", type.getName());
130-
logger.throwing(type.getName(), "<init>", ex);
127+
logger.log(Level.SEVERE, "An exception occurred while instantiating asset locator: " + type.getName(), ex);
131128
}
132129
return null;
133130
}

jme3-core/src/main/java/com/jme3/material/MatParamTexture.java

Lines changed: 40 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2009-2021 jMonkeyEngine
2+
* Copyright (c) 2009-2024 jMonkeyEngine
33
* All rights reserved.
44
*
55
* Redistribution and use in source and binary forms, with or without
@@ -40,51 +40,67 @@
4040
import com.jme3.texture.image.ColorSpace;
4141
import java.io.IOException;
4242

43+
/**
44+
* A material parameter that holds a reference to a texture and its required color space.
45+
* This class extends {@link MatParam} to provide texture specific functionalities.
46+
*/
4347
public class MatParamTexture extends MatParam {
4448

45-
private Texture texture;
4649
private ColorSpace colorSpace;
4750

51+
/**
52+
* Constructs a new MatParamTexture instance with the specified type, name,
53+
* texture, and color space.
54+
*
55+
* @param type the type of the material parameter
56+
* @param name the name of the parameter
57+
* @param texture the texture associated with this parameter
58+
* @param colorSpace the required color space for the texture
59+
*/
4860
public MatParamTexture(VarType type, String name, Texture texture, ColorSpace colorSpace) {
4961
super(type, name, texture);
50-
this.texture = texture;
5162
this.colorSpace = colorSpace;
5263
}
5364

65+
/**
66+
* Serialization only. Do not use.
67+
*/
5468
public MatParamTexture() {
5569
}
5670

71+
/**
72+
* Retrieves the texture associated with this material parameter.
73+
*
74+
* @return the texture object
75+
*/
5776
public Texture getTextureValue() {
58-
return texture;
77+
return (Texture) getValue();
5978
}
6079

80+
/**
81+
* Sets the texture associated with this material parameter.
82+
*
83+
* @param value the texture object to set
84+
* @throws RuntimeException if the provided value is not a {@link Texture}
85+
*/
6186
public void setTextureValue(Texture value) {
62-
this.value = value;
63-
this.texture = value;
64-
}
65-
66-
@Override
67-
public void setValue(Object value) {
68-
if (!(value instanceof Texture)) {
69-
throw new IllegalArgumentException("value must be a texture object");
70-
}
71-
this.value = value;
72-
this.texture = (Texture) value;
87+
setValue(value);
7388
}
7489

7590
/**
91+
* Gets the required color space for this texture parameter.
7692
*
77-
* @return the color space required by this texture param
93+
* @return the required color space ({@link ColorSpace})
7894
*/
7995
public ColorSpace getColorSpace() {
8096
return colorSpace;
8197
}
8298

8399
/**
84-
* Set to {@link ColorSpace#Linear} if the texture color space has to be forced to linear
85-
* instead of sRGB
100+
* Set to {@link ColorSpace#Linear} if the texture color space has to be forced
101+
* to linear instead of sRGB.
102+
*
86103
* @param colorSpace the desired color space
87-
* @see ColorSpace
88104
*/
89105
public void setColorSpace(ColorSpace colorSpace) {
90106
this.colorSpace = colorSpace;
@@ -94,17 +110,17 @@ public void setColorSpace(ColorSpace colorSpace) {
94110
public void write(JmeExporter ex) throws IOException {
95111
super.write(ex);
96112
OutputCapsule oc = ex.getCapsule(this);
97-
oc.write(0, "texture_unit", -1);
98-
oc.write(texture, "texture", null); // For backwards compatibility
99-
100113
oc.write(colorSpace, "colorSpace", null);
114+
// For backwards compatibility
115+
oc.write(0, "texture_unit", -1);
116+
oc.write((Texture) value, "texture", null);
101117
}
102118

103119
@Override
104120
public void read(JmeImporter im) throws IOException {
105121
super.read(im);
106122
InputCapsule ic = im.getCapsule(this);
107-
texture = (Texture) value;
108123
colorSpace = ic.readEnum("colorSpace", ColorSpace.class, null);
109124
}
110-
}
125+
126+
}

jme3-core/src/main/java/com/jme3/material/Material.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -907,22 +907,23 @@ private BindUnits updateShaderMaterialParameters(Renderer renderer, Shader shade
907907

908908

909909
private void updateRenderState(Geometry geometry, RenderManager renderManager, Renderer renderer, TechniqueDef techniqueDef) {
910+
RenderState finalRenderState;
910911
if (renderManager.getForcedRenderState() != null) {
911-
mergedRenderState.copyFrom(renderManager.getForcedRenderState());
912+
finalRenderState = mergedRenderState.copyFrom(renderManager.getForcedRenderState());
912913
} else if (techniqueDef.getRenderState() != null) {
913-
mergedRenderState.copyFrom(RenderState.DEFAULT);
914-
techniqueDef.getRenderState().copyMergedTo(additionalState, mergedRenderState);
914+
finalRenderState = mergedRenderState.copyFrom(RenderState.DEFAULT);
915+
finalRenderState = techniqueDef.getRenderState().copyMergedTo(additionalState, finalRenderState);
915916
} else {
916-
mergedRenderState.copyFrom(RenderState.DEFAULT);
917-
RenderState.DEFAULT.copyMergedTo(additionalState, mergedRenderState);
917+
finalRenderState = mergedRenderState.copyFrom(RenderState.DEFAULT);
918+
finalRenderState = RenderState.DEFAULT.copyMergedTo(additionalState, finalRenderState);
918919
}
919920
// test if the face cull mode should be flipped before render
920-
if (mergedRenderState.isFaceCullFlippable() && isNormalsBackward(geometry.getWorldScale())) {
921-
mergedRenderState.flipFaceCull();
921+
if (finalRenderState.isFaceCullFlippable() && isNormalsBackward(geometry.getWorldScale())) {
922+
finalRenderState.flipFaceCull();
922923
}
923-
renderer.applyRenderState(mergedRenderState);
924+
renderer.applyRenderState(finalRenderState);
924925
}
925-
926+
926927
/**
927928
* Returns true if the geometry world scale indicates that normals will be backward.
928929
* @param scalar geometry world scale

jme3-core/src/main/java/com/jme3/material/RenderState.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1692,7 +1692,7 @@ public void set(RenderState state) {
16921692
* This method is more precise than {@link #set(com.jme3.material.RenderState)}.
16931693
* @param state state to copy from
16941694
*/
1695-
public void copyFrom(RenderState state) {
1695+
public RenderState copyFrom(RenderState state) {
16961696
this.applyBlendMode = state.applyBlendMode;
16971697
this.applyColorWrite = state.applyColorWrite;
16981698
this.applyCullMode = state.applyCullMode;
@@ -1734,6 +1734,7 @@ public void copyFrom(RenderState state) {
17341734
this.sfactorRGB = state.sfactorRGB;
17351735
this.stencilTest = state.stencilTest;
17361736
this.wireframe = state.wireframe;
1737+
return this;
17371738
}
17381739

17391740
@Override

jme3-core/src/main/java/com/jme3/math/AbstractTriangle.java

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2009-2020 jMonkeyEngine
2+
* Copyright (c) 2009-2024 jMonkeyEngine
33
* All rights reserved.
44
*
55
* Redistribution and use in source and binary forms, with or without
@@ -79,4 +79,20 @@ public abstract class AbstractTriangle implements Collidable {
7979
public int collideWith(Collidable other, CollisionResults results) {
8080
return other.collideWith(this, results);
8181
}
82+
83+
/**
84+
* Returns a string representation of the triangle, which is unaffected. For
85+
* example, a {@link com.jme3.math.Triangle} joining (1,0,0) and (0,1,0)
86+
* with (0,0,1) is represented by:
87+
* <pre>
88+
* Triangle [V1: (1.0, 0.0, 0.0) V2: (0.0, 1.0, 0.0) V3: (0.0, 0.0, 1.0)]
89+
* </pre>
90+
*
91+
* @return the string representation (not null, not empty)
92+
*/
93+
@Override
94+
public String toString() {
95+
return getClass().getSimpleName() + " [V1: " + get1() + " V2: "
96+
+ get2() + " V3: " + get3() + "]";
97+
}
8298
}

jme3-core/src/main/java/com/jme3/math/Line.java

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2009-2020 jMonkeyEngine
2+
* Copyright (c) 2009-2024 jMonkeyEngine
33
* All rights reserved.
44
*
55
* Redistribution and use in source and binary forms, with or without
@@ -274,4 +274,20 @@ public Line clone() {
274274
throw new AssertionError();
275275
}
276276
}
277+
278+
/**
279+
* Returns a string representation of the Line, which is unaffected. For
280+
* example, a line with origin (1,0,0) and direction (0,1,0) is represented
281+
* by:
282+
* <pre>
283+
* Line [Origin: (1.0, 0.0, 0.0) Direction: (0.0, 1.0, 0.0)]
284+
* </pre>
285+
*
286+
* @return the string representation (not null, not empty)
287+
*/
288+
@Override
289+
public String toString() {
290+
return getClass().getSimpleName() + " [Origin: " + origin
291+
+ " Direction: " + direction + "]";
292+
}
277293
}

0 commit comments

Comments
 (0)