Skip to content
Open
Show file tree
Hide file tree
Changes from 10 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
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ protected static String uuidToString(@NotNull RTTIReference uuid) {
}
}

@NotNull
protected static String uuidToString(@NotNull RTTIObject uuid) {
return RTTIUtils.uuidToString(uuid);
}
Comment thread
REDxEYE marked this conversation as resolved.
Outdated

protected record DrawFlags(
@NotNull String renderType,
@NotNull String shadowCullMode,
Expand Down

This file was deleted.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.shade.decima.ui.data.viewer.model.dmf;

import com.shade.decima.ui.data.viewer.model.dmf.nodes.DMFNode;

public record DMFInstanceSource(String uuid, DMFNode rootNode) {
Comment thread
REDxEYE marked this conversation as resolved.
Outdated
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.shade.decima.ui.data.viewer.model.dmf;

import com.shade.decima.ui.data.viewer.model.dmf.nodes.DMFNode;
import com.shade.util.NotNull;
import com.shade.util.Nullable;

Expand All @@ -17,7 +18,7 @@ public class DMFSceneFile {
public final List<DMFBuffer> buffers;
public final List<DMFMaterial> materials;
public final List<DMFTexture> textures;
public final List<DMFNode> instances;
public final List<DMFInstanceSource> instances;

public DMFSceneFile(int version) {
metadata = new DMFSceneMetaData("%s (%s, %s)".formatted(APP_TITLE, APP_VERSION, BUILD_COMMIT), version);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.shade.decima.ui.data.viewer.model.dmf.nodes;

import com.shade.decima.ui.data.viewer.model.dmf.DMFTransform;
import com.shade.util.NotNull;

public class DMFAttachment extends DMFNode {
public final String boneName;

public DMFAttachment(@NotNull String name, @NotNull String boneName, @NotNull DMFTransform transform) {
super(name, DMFNodeType.ATTACHMENT);
this.boneName = boneName;
this.transform = transform;
}

@Override
public boolean isEmpty() {
return false;
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.shade.decima.ui.data.viewer.model.dmf;
package com.shade.decima.ui.data.viewer.model.dmf.nodes;

import com.shade.util.NotNull;

Expand All @@ -9,4 +9,9 @@ public DMFCompositeModel(@NotNull String name, int skeletonId) {
super(name, DMFNodeType.SKINNED_MODEL);
this.skeletonId = skeletonId;
}

@Override
public boolean isEmpty() {
return children.isEmpty();
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.shade.decima.ui.data.viewer.model.dmf;
package com.shade.decima.ui.data.viewer.model.dmf.nodes;


import com.shade.util.NotNull;
Expand All @@ -10,4 +10,9 @@ public DMFInstance(@NotNull String name, int instanceId) {
super(name, DMFNodeType.INSTANCE);
this.instanceId = instanceId;
}

@Override
public boolean isEmpty() {
return false;
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.shade.decima.ui.data.viewer.model.dmf;
package com.shade.decima.ui.data.viewer.model.dmf.nodes;

import com.shade.util.NotNull;

Expand All @@ -17,4 +17,9 @@ public void addLod(@NotNull DMFNode model, float distance) {
}

public record Lod(@NotNull DMFNode model, int id, float distance) {}

@Override
public boolean isEmpty() {
return children.isEmpty() && lods.isEmpty();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package com.shade.decima.ui.data.viewer.model.dmf.nodes;

import com.shade.util.NotNull;

import java.util.HashMap;
import java.util.Map;

public class DMFMapTile extends DMFNode {
public int[] gridCoordinate;
public float[] bboxMin;
public float[] bboxMax;
public Map<String, DMFMapTile.TileTextureInfo> textures = new HashMap<>();

public DMFMapTile(@NotNull String name) {
super(name, DMFNodeType.MAP_TILE);
}

public static final class TileTextureInfo {
Comment thread
REDxEYE marked this conversation as resolved.
Outdated
public final Map<String, TileTextureChannelInfo> channels = new HashMap<>();
public Integer textureId = null;

public static class TileTextureChannelInfo {
public String usage;
public float minRange;
public float maxRange;

public TileTextureChannelInfo(String usage, float minRange, float maxRange) {
this.usage = usage;
this.minRange = minRange;
this.maxRange = maxRange;
}
}
}
Comment thread
REDxEYE marked this conversation as resolved.
Outdated
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package com.shade.decima.ui.data.viewer.model.dmf;
package com.shade.decima.ui.data.viewer.model.dmf.nodes;


import com.shade.decima.ui.data.viewer.model.dmf.DMFMesh;
import com.shade.decima.ui.data.viewer.model.dmf.DMFSceneFile;
import com.shade.decima.ui.data.viewer.model.dmf.DMFSkeleton;
import com.shade.util.NotNull;

public class DMFModel extends DMFNode {
Expand All @@ -17,4 +20,9 @@ public void setSkeleton(@NotNull DMFSkeleton skeleton, @NotNull DMFSceneFile sce
scene.skeletons.add(skeleton);
skeletonId = scene.skeletons.indexOf(skeleton);
}

@Override
public boolean isEmpty() {
return children.isEmpty() && (mesh==null || mesh.primitives.isEmpty());
}
Comment thread
REDxEYE marked this conversation as resolved.
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.shade.decima.ui.data.viewer.model.dmf;
package com.shade.decima.ui.data.viewer.model.dmf.nodes;

import com.shade.util.NotNull;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package com.shade.decima.ui.data.viewer.model.dmf;
package com.shade.decima.ui.data.viewer.model.dmf.nodes;

import com.shade.decima.ui.data.viewer.model.dmf.DMFCollection;
import com.shade.decima.ui.data.viewer.model.dmf.DMFSceneFile;
import com.shade.decima.ui.data.viewer.model.dmf.DMFTransform;
import com.shade.util.NotNull;

import java.util.ArrayList;
Expand All @@ -25,4 +28,8 @@ protected DMFNode(@NotNull String name, @NotNull DMFNodeType type) {
public void addToCollection(@NotNull DMFCollection collection, @NotNull DMFSceneFile scene) {
collectionIds.add(scene.collections.indexOf(collection));
}

public boolean isEmpty() {
return children.isEmpty();
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.shade.decima.ui.data.viewer.model.dmf;
package com.shade.decima.ui.data.viewer.model.dmf.nodes;


public enum DMFNodeType {
Expand All @@ -9,4 +9,5 @@ public enum DMFNodeType {
MODEL,
SKINNED_MODEL,
ATTACHMENT,
MAP_TILE,
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ public Quaternion(@NotNull double[] xyzw) {
this(xyzw[0], xyzw[1], xyzw[2], xyzw[3]);
}

@NotNull
public static Quaternion identity() {
return new Quaternion(0, 0, 0, 1);
}

@NotNull
public Quaternion add(@NotNull Quaternion other) {
return new Quaternion(x() + other.x(), y() + other.y(), z() + other.y(), w() + other.w());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,18 @@ private static int getTextureSize(@NotNull ImageReader reader, @NotNull Dimensio
return scaled.width * scaled.height * reader.getPixelBits() / 8;
}

@Override
public int getBitsPerChannel() {
return switch (getPixelFormat()) {
case "RGBA_8888", "BC4U", "BC7", "BC5S", "BC5U", "BC4S", "BC3", "BC2", "BC1", "R_INT_8", "RG_INT_8", "RGBA_INT_8", "R_UINT_8", "RG_UINT_8", "RGBA_UINT_8", "R_NORM_8", "RG_NORM_8", "RGBA_NORM_8", "R_UNORM_8", "RG_UNORM_8", "RGBA_UNORM_8" ->
8;
case "RGBA_FLOAT_16", "RGB_FLOAT_16", "RG_FLOAT_16", "R_FLOAT_16", "BC6S", "BC6U", "RGBA_UNORM_10_10_10_2", "RGB_FLOAT_11_11_10", "R_INT_16", "RG_INT_16", "RGBA_INT_16", "R_UINT_16", "RG_UINT_16", "RGBA_UINT_16", "RG_NORM_16", "RGBA_NORM_16", "R_UNORM_16", "RG_UNORM_16", "RGBA_UNORM_16", "R_NORM_16" ->
16;
case "RGBA_FLOAT_32", "RGB_FLOAT_32", "RG_FLOAT_32", "R_FLOAT_32", "R_INT_32", "RG_INT_32", "RGBA_INT_32", "R_UINT_32", "RG_UINT_32", "RGBA_UINT_32", "RGBA_UNORM_32" ->
32;
default -> 0;
};
}
private record ImageData(@NotNull ImageReader reader, @NotNull ByteBuffer buffer, int width, int height) {}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,6 @@ enum Type {

@NotNull
String getPixelFormat();

int getBitsPerChannel();
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public void export(@NotNull ImageProvider provider, @NotNull Set<Option> options

@Override
public boolean supportsImage(@NotNull ImageProvider provider) {
return provider.getType() != ImageProvider.Type.CUBEMAP;
return provider.getType() != ImageProvider.Type.CUBEMAP && provider.getBitsPerChannel() == 8;
}

@Override
Expand Down