Skip to content
Draft

Vulkan #2545

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
d2315be
added AlertArmatureMask
codex128 Jul 24, 2023
2f1dae8
fixed docs and added another helper
codex128 Jul 24, 2023
a750f1c
made it easier to turn off priority checking
codex128 Jul 24, 2023
cd876d4
removed copy methods
codex128 Jul 25, 2023
9c9c2d8
updated license
codex128 Jan 19, 2024
83c95e5
updated javadoc
codex128 Jan 20, 2024
90e6cd8
renamed mask
codex128 Jan 21, 2024
0f410c0
Merge branch 'jMonkeyEngine:master' into master
codex128 Feb 29, 2024
9cf7dc4
Merge branch 'jMonkeyEngine:master' into master
codex128 Jun 7, 2024
7efa4c6
Merge remote-tracking branch 'origin/master'
codex128 Apr 26, 2025
0e25de2
Merge remote-tracking branch 'origin/master'
codex128 Jun 22, 2025
0c2d187
create vulkan context and prototyped vulkan instance creation in a te…
codex128 Jun 24, 2025
061a782
vulkan logical device
codex128 Jun 24, 2025
1b9f2e3
vulkan logical device
codex128 Jun 24, 2025
863e6a9
create interface over vulkan API
codex128 Jul 3, 2025
1b2ee3d
debug initial vulkan engine interface
codex128 Jul 27, 2025
e82ab06
debug initial vulkan engine interface
codex128 Jul 27, 2025
5aa391e
add shader attributes and gpu buffers
codex128 Jul 28, 2025
adb4e01
add uniforms; fix native crash and memory leaks
codex128 Aug 1, 2025
8e7ff36
added depth testing; added enums for image properties
codex128 Aug 1, 2025
beba5fe
added depth testing; added enums for image properties
codex128 Aug 1, 2025
4e31f0d
migrated instance, device, surface, and swapchain to new builder arc…
codex128 Aug 3, 2025
5f7d1ec
migrated instance, device, surface, and swapchain to new builder arc…
codex128 Aug 3, 2025
c4738ee
successfully abstracted all vulkan components
codex128 Aug 6, 2025
e0efc40
successfully abstracted all vulkan components
codex128 Aug 6, 2025
0c035ab
organized files
codex128 Aug 9, 2025
6a3171c
added MemorySize for clarity in allocating buffer sizes
codex128 Aug 9, 2025
bcb7014
managed to create acceptable prototype material system (still much to…
codex128 Aug 13, 2025
b168553
managed to create acceptable prototype material system (still much to…
codex128 Aug 13, 2025
6c0dbaf
altered material system slightly
codex128 Aug 13, 2025
f7d3679
basic material system is working
codex128 Aug 13, 2025
62882d4
basic material system is working
codex128 Aug 13, 2025
4a1970f
add device interfaces for different queue types
codex128 Aug 14, 2025
521c8a7
move pool management to logical device
codex128 Aug 14, 2025
a00411b
add stage mask to semaphores
codex128 Aug 15, 2025
d0340ab
figure out uniform details
codex128 Aug 16, 2025
ab0de0e
add Flag interface to handle bit flags
codex128 Aug 19, 2025
6657009
fix build error
codex128 Aug 19, 2025
72b0156
fix json error
codex128 Aug 19, 2025
ed6096e
extract GpuBuffer into an interface; create VersionedBuffer in prepar…
codex128 Aug 19, 2025
5587e17
fix build errors related to GpuBuffer interface extraction
codex128 Aug 19, 2025
6f97ff5
alter material system to support versions of resources per frame-in-f…
codex128 Aug 24, 2025
d4646f6
fix build and runtime errors (new material system is operational)
codex128 Aug 24, 2025
42a845a
fix warning on DescriptorSet destruction for DescriptorPools not crea…
codex128 Aug 24, 2025
ba4ea7f
use Flag for CommandPool creation instead of booleans
codex128 Aug 24, 2025
56a0a42
prototype meshes; improve usability; abstract images and buffers in p…
codex128 Aug 30, 2025
e29d2a9
fix image loader key type
codex128 Aug 30, 2025
85b3d95
mess around with meshes more
codex128 Sep 1, 2025
669ce8f
have uniforms use Resources/DataPipelines instead of VersionedResources
codex128 Sep 1, 2025
0fc9137
have uniforms use Resources/DataPipelines instead of VersionedResources
codex128 Sep 1, 2025
ab434fd
have uniforms use Resources/DataPipelines instead of VersionedResources
codex128 Sep 2, 2025
97750fd
simplified handling of DataPipe results by uniforms
codex128 Sep 2, 2025
bb7ab46
completed AdaptiveMesh; added CommandBatch system to properly update …
codex128 Sep 9, 2025
3099a26
fix vertex shader producing an unused varying
codex128 Sep 9, 2025
4756c04
rename updateStaticBuffers to updateSharedBuffers
codex128 Sep 9, 2025
519301e
add enum to represent common attribute names
codex128 Sep 9, 2025
20a2120
improve pipeline and sampler usability
codex128 Sep 9, 2025
2f3f8c5
improve pipeline and sampler usability
codex128 Sep 9, 2025
42d7525
preparing to alter Spatial
codex128 Sep 11, 2025
cb5c47a
move vulkan to core
codex128 Sep 12, 2025
29c1818
temporarily renamed Mesh to GLMesh to not conflict with the new Mesh …
codex128 Sep 12, 2025
1718bbf
Revert "temporarily renamed Mesh to GLMesh to not conflict with the n…
codex128 Sep 12, 2025
7fee9d2
temporarily renamed Mesh to GLMesh to not conflict with the new Mesh …
codex128 Sep 12, 2025
301b6bc
Revert "temporarily renamed Mesh to GLMesh to not conflict with the n…
codex128 Sep 12, 2025
e28d4df
Revert "Revert "temporarily renamed Mesh to GLMesh to not conflict wi…
codex128 Sep 12, 2025
d463d9c
Revert "temporarily renamed Mesh to GLMesh to not conflict with the n…
codex128 Sep 12, 2025
e3ee8be
Revert "Revert "temporarily renamed Mesh to GLMesh to not conflict wi…
codex128 Sep 12, 2025
65c076e
renamed new Mesh interface to NewMesh to not conflict with existing M…
codex128 Sep 12, 2025
115a985
renamed GLMesh back to Mesh
codex128 Sep 12, 2025
268988b
add BackedStaticBuffer
codex128 Sep 12, 2025
f23c5c8
make BIHTree compatible with NewMesh
codex128 Sep 12, 2025
c388da8
made BoundingVolume accept VertexReaders for computeFromPoints
codex128 Sep 13, 2025
e871c05
Geometry accepts NewMesh without errors
codex128 Sep 13, 2025
bc4ce97
Geometry accepts NewMesh without errors
codex128 Sep 13, 2025
d2e37e5
renamed vulkan material to NewMaterial
codex128 Sep 13, 2025
ef41a34
delete VertexModifier interface
codex128 Sep 13, 2025
1c45ac6
made Spatial iterable
codex128 Sep 13, 2025
49cc7f2
made Spatial iterable
codex128 Sep 13, 2025
1e2926d
setup vulkan test for rendering from the scene graph
codex128 Sep 13, 2025
a7c2f09
moved Mesh code to OldMesh; replaced NewMesh with Mesh, which has bee…
codex128 Sep 13, 2025
bd21a20
moved previous Mesh extensions to extend OldMesh
codex128 Sep 13, 2025
050e1df
moved Material to OldMaterial
codex128 Sep 13, 2025
93067db
renamed Texture to GlTexture and Image to GlImage, both implementing …
codex128 Sep 14, 2025
fe84d1e
added methods to Material interface for compatibility with old GlMate…
codex128 Sep 16, 2025
7e1f760
fix several incompatibilities
codex128 Sep 17, 2025
d3860c6
added GeometryBatch to cleanly and optimally handling renders; a lot …
codex128 Oct 10, 2025
ab514b7
added GeometryBatch to cleanly and optimally handling renders; a lot …
codex128 Oct 10, 2025
ebf9528
split Vulkan and OpenGL APIs on GeometryBatch
codex128 Oct 11, 2025
154d3ab
fixed build errors in GlVertexBuffer
codex128 Oct 11, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 5 additions & 0 deletions VulkanDesign.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

Problems:

1. VersionedResources are awkward to work through at times.

2 changes: 2 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ lwjgl3-opencl = { module = "org.lwjgl:lwjgl-opencl", version.ref = "lwjgl3"
lwjgl3-opengl = { module = "org.lwjgl:lwjgl-opengl", version.ref = "lwjgl3" }
lwjgl3-openvr = { module = "org.lwjgl:lwjgl-openvr", version.ref = "lwjgl3" }
lwjgl3-ovr = { module = "org.lwjgl:lwjgl-ovr", version.ref = "lwjgl3" }
lwjgl3-vulkan = { module = "org.lwjgl:lwjgl-vulkan", version.ref = "lwjgl3" }
lwjgl3-shaderc = { module = "org.lwjgl:lwjgl-shaderc", version.ref = "lwjgl3" }

mokito-core = "org.mockito:mockito-core:3.12.4"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
import com.jme3.system.JmeSystem;
import com.jme3.system.Timer;
import com.jme3.texture.FrameBuffer;
import com.jme3.texture.Image;
import com.jme3.texture.GlImage;
import com.jme3.util.AndroidScreenshots;
import com.jme3.util.BufferUtils;
import java.io.File;
Expand Down Expand Up @@ -241,7 +241,7 @@ public void addImage(Renderer renderer, FrameBuffer out) {
final WorkItem item = freeItems.take();
usedItems.add(item);
item.buffer.clear();
renderer.readFrameBufferWithFormat(out, item.buffer, Image.Format.BGRA8);
renderer.readFrameBufferWithFormat(out, item.buffer, GlImage.Format.BGRA8);
executor.submit(new Callable<Void>() {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
import com.jme3.asset.AssetInfo;
import com.jme3.asset.AssetLoader;
import com.jme3.asset.TextureKey;
import com.jme3.texture.Image;
import com.jme3.texture.GlImage;
import com.jme3.texture.image.ColorSpace;
import com.jme3.util.BufferUtils;
import java.io.IOException;
Expand Down Expand Up @@ -72,7 +72,7 @@ private static void convertARGBtoABGR(int[] src, int srcOff, int[] dst, int dstO
@Override
public Object load(AssetInfo assetInfo) throws IOException {
Bitmap bitmap;
Image.Format format;
GlImage.Format format;
int bpp;

BitmapFactory.Options options = new BitmapFactory.Options();
Expand Down Expand Up @@ -102,15 +102,15 @@ public Object load(AssetInfo assetInfo) throws IOException {

switch (bitmap.getConfig()) {
case ALPHA_8:
format = Image.Format.Alpha8;
format = GlImage.Format.Alpha8;
bpp = 1;
break;
case ARGB_8888:
format = Image.Format.RGBA8;
format = GlImage.Format.RGBA8;
bpp = 4;
break;
case RGB_565:
format = Image.Format.RGB565;
format = GlImage.Format.RGB565;
bpp = 2;
break;
default:
Expand All @@ -124,7 +124,7 @@ public Object load(AssetInfo assetInfo) throws IOException {

ByteBuffer data = BufferUtils.createByteBuffer(bitmap.getWidth() * bitmap.getHeight() * bpp);

if (format == Image.Format.RGBA8) {
if (format == GlImage.Format.RGBA8) {
int[] pixelData = new int[width * height];
bitmap.getPixels(pixelData, 0, width, 0, 0, width, height);

Expand Down Expand Up @@ -163,7 +163,7 @@ public Object load(AssetInfo assetInfo) throws IOException {

bitmap.recycle();

Image image = new Image(format, width, height, data, ColorSpace.sRGB);
GlImage image = new GlImage(format, width, height, data, ColorSpace.sRGB);

return image;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
import com.jme3.asset.AssetInfo;
import com.jme3.asset.AssetLoader;
import com.jme3.asset.TextureKey;
import com.jme3.texture.Image;
import com.jme3.texture.GlImage;
import java.io.IOException;
import java.io.InputStream;

Expand All @@ -52,10 +52,10 @@ public class AndroidNativeImageLoader implements AssetLoader {
System.loadLibrary("decodejme");
}

private static native Image load(InputStream in, boolean flipY, byte[] tmpArray) throws IOException;
private static native GlImage load(InputStream in, boolean flipY, byte[] tmpArray) throws IOException;

@Override
public Image load(AssetInfo info) throws IOException {
public GlImage load(AssetInfo info) throws IOException {
boolean flip = ((TextureKey) info.getKey()).isFlipY();
try (final InputStream in = info.openStream()) {
return load(in, flip, tmpArray);
Expand Down
52 changes: 52 additions & 0 deletions jme3-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,58 @@ dependencies {
testRuntimeOnly project(':jme3-testdata')
testImplementation project(':jme3-desktop')
testRuntimeOnly project(':jme3-plugins')

// Use LWJGL3 directly in core. This destroys LWJGL2 and JOGL compatibility.
api (libs.lwjgl3.awt) {
exclude group: 'org.lwjgl', module: 'lwjgl'
}
api libs.lwjgl3.base
api libs.lwjgl3.glfw
api libs.lwjgl3.jawt
api libs.lwjgl3.jemalloc
api libs.lwjgl3.openal
api libs.lwjgl3.opencl
api libs.lwjgl3.opengl
api libs.lwjgl3.vulkan
api libs.lwjgl3.shaderc

runtimeOnly(variantOf(libs.lwjgl3.base){ classifier('natives-windows') })
runtimeOnly(variantOf(libs.lwjgl3.base){ classifier('natives-windows-x86') })
runtimeOnly(variantOf(libs.lwjgl3.base){ classifier('natives-linux') })
runtimeOnly(variantOf(libs.lwjgl3.base){ classifier('natives-linux-arm32') })
runtimeOnly(variantOf(libs.lwjgl3.base){ classifier('natives-linux-arm64') })
runtimeOnly(variantOf(libs.lwjgl3.base){ classifier('natives-macos') })
runtimeOnly(variantOf(libs.lwjgl3.base){ classifier('natives-macos-arm64') })
runtimeOnly(variantOf(libs.lwjgl3.glfw){ classifier('natives-windows') })
runtimeOnly(variantOf(libs.lwjgl3.glfw){ classifier('natives-windows-x86') })
runtimeOnly(variantOf(libs.lwjgl3.glfw){ classifier('natives-linux') })
runtimeOnly(variantOf(libs.lwjgl3.glfw){ classifier('natives-linux-arm32') })
runtimeOnly(variantOf(libs.lwjgl3.glfw){ classifier('natives-linux-arm64') })
runtimeOnly(variantOf(libs.lwjgl3.glfw){ classifier('natives-macos') })
runtimeOnly(variantOf(libs.lwjgl3.glfw){ classifier('natives-macos-arm64') })
runtimeOnly(variantOf(libs.lwjgl3.jemalloc){ classifier('natives-windows') })
runtimeOnly(variantOf(libs.lwjgl3.jemalloc){ classifier('natives-windows-x86') })
runtimeOnly(variantOf(libs.lwjgl3.jemalloc){ classifier('natives-linux') })
runtimeOnly(variantOf(libs.lwjgl3.jemalloc){ classifier('natives-linux-arm32') })
runtimeOnly(variantOf(libs.lwjgl3.jemalloc){ classifier('natives-linux-arm64') })
runtimeOnly(variantOf(libs.lwjgl3.jemalloc){ classifier('natives-macos') })
runtimeOnly(variantOf(libs.lwjgl3.jemalloc){ classifier('natives-macos-arm64') })
runtimeOnly(variantOf(libs.lwjgl3.opengl){ classifier('natives-windows') })
runtimeOnly(variantOf(libs.lwjgl3.opengl){ classifier('natives-windows-x86') })
runtimeOnly(variantOf(libs.lwjgl3.opengl){ classifier('natives-linux') })
runtimeOnly(variantOf(libs.lwjgl3.opengl){ classifier('natives-linux-arm32') })
runtimeOnly(variantOf(libs.lwjgl3.opengl){ classifier('natives-linux-arm64') })
runtimeOnly(variantOf(libs.lwjgl3.opengl){ classifier('natives-macos') })
runtimeOnly(variantOf(libs.lwjgl3.opengl){ classifier('natives-macos-arm64') })
runtimeOnly(variantOf(libs.lwjgl3.openal){ classifier('natives-windows') })
runtimeOnly(variantOf(libs.lwjgl3.openal){ classifier('natives-windows-x86') })
runtimeOnly(variantOf(libs.lwjgl3.openal){ classifier('natives-linux') })
runtimeOnly(variantOf(libs.lwjgl3.openal){ classifier('natives-linux-arm32') })
runtimeOnly(variantOf(libs.lwjgl3.openal){ classifier('natives-linux-arm64') })
runtimeOnly(variantOf(libs.lwjgl3.openal){ classifier('natives-macos') })
runtimeOnly(variantOf(libs.lwjgl3.openal){ classifier('natives-macos-arm64') })
runtimeOnly(variantOf(libs.lwjgl3.shaderc) { classifier('natives-linux') })

}

task updateVersionPropertiesFile {
Expand Down
54 changes: 27 additions & 27 deletions jme3-core/src/main/java/com/jme3/anim/MorphControl.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public class MorphControl extends AbstractControl implements Savable {
private float[] tmpNormArray;
private float[] tmpTanArray;

private static final VertexBuffer.Type bufferTypes[] = VertexBuffer.Type.values();
private static final GlVertexBuffer.Type bufferTypes[] = GlVertexBuffer.Type.values();

@Override
public void setSpatial(Spatial spatial) {
Expand Down Expand Up @@ -237,49 +237,49 @@ private int getMaxGPUTargets(RenderManager rm, Geometry geom, Material mat, int
}

private int bindMorphTargetBuffer(Mesh mesh, int targetNumBuffers, int boundBufferIdx, MorphTarget t) {
int start = VertexBuffer.Type.MorphTarget0.ordinal();
int start = GlVertexBuffer.Type.MorphTarget0.ordinal();
if (targetNumBuffers >= 1) {
activateBuffer(mesh, boundBufferIdx, start, t.getBuffer(VertexBuffer.Type.Position));
activateBuffer(mesh, boundBufferIdx, start, t.getBuffer(GlVertexBuffer.Type.Position));
boundBufferIdx++;
}
if (targetNumBuffers >= 2) {
activateBuffer(mesh, boundBufferIdx, start, t.getBuffer(VertexBuffer.Type.Normal));
activateBuffer(mesh, boundBufferIdx, start, t.getBuffer(GlVertexBuffer.Type.Normal));
boundBufferIdx++;
}
if (!approximateTangents && targetNumBuffers == 3) {
activateBuffer(mesh, boundBufferIdx, start, t.getBuffer(VertexBuffer.Type.Tangent));
activateBuffer(mesh, boundBufferIdx, start, t.getBuffer(GlVertexBuffer.Type.Tangent));
boundBufferIdx++;
}
return boundBufferIdx;
}

private void writeCpuBuffer(int targetNumBuffers, MorphTarget mt) {
if (targetNumBuffers >= 1) {
FloatBuffer dest = mt.getBuffer(VertexBuffer.Type.Position);
FloatBuffer dest = mt.getBuffer(GlVertexBuffer.Type.Position);
dest.rewind();
dest.put(tmpPosArray, 0, dest.capacity());
}
if (targetNumBuffers >= 2) {
FloatBuffer dest = mt.getBuffer(VertexBuffer.Type.Normal);
FloatBuffer dest = mt.getBuffer(GlVertexBuffer.Type.Normal);
dest.rewind();
dest.put(tmpNormArray, 0, dest.capacity());
}
if (!approximateTangents && targetNumBuffers == 3) {
FloatBuffer dest = mt.getBuffer(VertexBuffer.Type.Tangent);
FloatBuffer dest = mt.getBuffer(GlVertexBuffer.Type.Tangent);
dest.rewind();
dest.put(tmpTanArray, 0, dest.capacity());
}
}

private void mergeMorphTargets(int targetNumBuffers, float weight, MorphTarget t, boolean init) {
if (targetNumBuffers >= 1) {
mergeTargetBuffer(tmpPosArray, weight, t.getBuffer(VertexBuffer.Type.Position), init);
mergeTargetBuffer(tmpPosArray, weight, t.getBuffer(GlVertexBuffer.Type.Position), init);
}
if (targetNumBuffers >= 2) {
mergeTargetBuffer(tmpNormArray, weight, t.getBuffer(VertexBuffer.Type.Normal), init);
mergeTargetBuffer(tmpNormArray, weight, t.getBuffer(GlVertexBuffer.Type.Normal), init);
}
if (!approximateTangents && targetNumBuffers == 3) {
mergeTargetBuffer(tmpTanArray, weight, t.getBuffer(VertexBuffer.Type.Tangent), init);
mergeTargetBuffer(tmpTanArray, weight, t.getBuffer(GlVertexBuffer.Type.Tangent), init);
}
}

Expand All @@ -306,8 +306,8 @@ private void mergeTargetBuffer(float[] array, float weight, FloatBuffer src, boo
}

private void activateBuffer(Mesh mesh, int idx, int start, FloatBuffer b) {
VertexBuffer.Type t = bufferTypes[start + idx];
VertexBuffer vb = mesh.getBuffer(t);
GlVertexBuffer.Type t = bufferTypes[start + idx];
GlVertexBuffer vb = mesh.getBuffer(t);
// only set the buffer if it's different
if (vb == null || vb.getData() != b) {
mesh.setBuffer(t, 3, b);
Expand All @@ -324,30 +324,30 @@ private float[] ensureCapacity(float[] tmpArray, int size) {
private MorphTarget initCpuMorphTarget(Geometry geom) {
MorphTarget res = new MorphTarget();
MorphTarget mt = geom.getMesh().getMorphTargets()[0];
FloatBuffer b = mt.getBuffer(VertexBuffer.Type.Position);
FloatBuffer b = mt.getBuffer(GlVertexBuffer.Type.Position);
if (b != null) {
res.setBuffer(VertexBuffer.Type.Position, BufferUtils.createFloatBuffer(b.capacity()));
res.setBuffer(GlVertexBuffer.Type.Position, BufferUtils.createFloatBuffer(b.capacity()));
}
b = mt.getBuffer(VertexBuffer.Type.Normal);
b = mt.getBuffer(GlVertexBuffer.Type.Normal);
if (b != null) {
res.setBuffer(VertexBuffer.Type.Normal, BufferUtils.createFloatBuffer(b.capacity()));
res.setBuffer(GlVertexBuffer.Type.Normal, BufferUtils.createFloatBuffer(b.capacity()));
}
if (!approximateTangents) {
b = mt.getBuffer(VertexBuffer.Type.Tangent);
b = mt.getBuffer(GlVertexBuffer.Type.Tangent);
if (b != null) {
res.setBuffer(VertexBuffer.Type.Tangent, BufferUtils.createFloatBuffer(b.capacity()));
res.setBuffer(GlVertexBuffer.Type.Tangent, BufferUtils.createFloatBuffer(b.capacity()));
}
}
return res;
}

private int getTargetNumBuffers(MorphTarget morphTarget) {
int num = 0;
if (morphTarget.getBuffer(VertexBuffer.Type.Position) != null) num++;
if (morphTarget.getBuffer(VertexBuffer.Type.Normal) != null) num++;
if (morphTarget.getBuffer(GlVertexBuffer.Type.Position) != null) num++;
if (morphTarget.getBuffer(GlVertexBuffer.Type.Normal) != null) num++;

// if tangents are not needed we don't count the tangent buffer
if (!approximateTangents && morphTarget.getBuffer(VertexBuffer.Type.Tangent) != null) {
if (!approximateTangents && morphTarget.getBuffer(GlVertexBuffer.Type.Tangent) != null) {
num++;
}
return num;
Expand All @@ -366,10 +366,10 @@ private int getTargetNumBuffers(MorphTarget morphTarget) {
*/
private int getRemainingBuffers(Mesh mesh, Renderer renderer) {
int nbUsedBuffers = 0;
for (VertexBuffer vb : mesh.getBufferList().getArray()) {
boolean isMorphBuffer = vb.getBufferType().ordinal() >= VertexBuffer.Type.MorphTarget0.ordinal() && vb.getBufferType().ordinal() <= VertexBuffer.Type.MorphTarget9.ordinal();
if (vb.getBufferType() == VertexBuffer.Type.Index || isMorphBuffer) continue;
if (vb.getUsage() != VertexBuffer.Usage.CpuOnly) {
for (GlVertexBuffer vb : mesh.getBufferList().getArray()) {
boolean isMorphBuffer = vb.getBufferType().ordinal() >= GlVertexBuffer.Type.MorphTarget0.ordinal() && vb.getBufferType().ordinal() <= GlVertexBuffer.Type.MorphTarget9.ordinal();
if (vb.getBufferType() == GlVertexBuffer.Type.Index || isMorphBuffer) continue;
if (vb.getUsage() != GlVertexBuffer.Usage.CpuOnly) {
nbUsedBuffers++;
}
}
Expand Down Expand Up @@ -478,7 +478,7 @@ public void visit(Geometry geom) {
// this code makes sure that if the mesh has no hardware skinning buffers hardware skinning won't be activated.
// this is important, because if HW skinning is activated the shader will declare 2 additional useless attributes,
// and we desperately need all the attributes we can find for Morph animation.
if (mesh.getBuffer(VertexBuffer.Type.HWBoneIndex) == null && !geom.getLocalMatParamOverrides().contains(nullNumberOfBones)) {
if (mesh.getBuffer(GlVertexBuffer.Type.HWBoneIndex) == null && !geom.getLocalMatParamOverrides().contains(nullNumberOfBones)) {
geom.addMatParamOverride(nullNumberOfBones);
}
}
Expand Down
Loading
Loading