Skip to content
Open
Show file tree
Hide file tree
Changes from 5 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 @@ -10,4 +10,9 @@ public DMFAttachmentNode(@NotNull String name, @NotNull String boneName, @NotNul
this.boneName = boneName;
this.transform = transform;
}

@Override
public boolean isEmpty() {
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Up @@ -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;

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 {
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;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,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());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,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
Expand Up @@ -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 @@ -181,6 +181,19 @@ public static EnumSet<Channel> getChannels(int packedData, int packingInfo) {
public record TextureInfo(@NotNull RTTIObject texture, @Nullable EnumSet<Channel> channels) {}

private record MyImageProvider(@NotNull HwTextureHeader header, @NotNull HwTextureData data, @NotNull PackfileManager manager, @NotNull ImageReaderProvider readerProvider) implements ImageProvider {
@NotNull
private static Dimension getTextureDimension(@NotNull ImageReader reader, @NotNull Dimension dimension, int mip) {
return new Dimension(
Math.max(dimension.width >> mip, reader.getBlockSize()),
Math.max(dimension.height >> mip, reader.getBlockSize())
);
}

private static int getTextureSize(@NotNull ImageReader reader, @NotNull Dimension dimension, int mip) {
final Dimension scaled = getTextureDimension(reader, dimension, mip);
return scaled.width * scaled.height * reader.getPixelBits() / 8;
}

@NotNull
@Override
public BufferedImage getImage(int mip, int slice) {
Expand Down Expand Up @@ -311,17 +324,17 @@ public String getPixelFormat() {
return header.getPixelFormat();
}

@NotNull
private static Dimension getTextureDimension(@NotNull ImageReader reader, @NotNull Dimension dimension, int mip) {
return new Dimension(
Math.max(dimension.width >> mip, reader.getBlockSize()),
Math.max(dimension.height >> mip, reader.getBlockSize())
);
}

private static int getTextureSize(@NotNull ImageReader reader, @NotNull Dimension dimension, int mip) {
final Dimension scaled = getTextureDimension(reader, dimension, mip);
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" ->
1;
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" ->
2;
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" ->
4;
default -> 0;
};
}

private record ImageData(@NotNull ImageReader reader, @NotNull ByteBuffer buffer, int width, int height) {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,6 @@ enum Type {

@NotNull
String getPixelFormat();

int getBitsPerChannel();
}