Skip to content

Commit

Permalink
Merge pull request #22 from haekb/20-jupiter-ltb-support
Browse files Browse the repository at this point in the history
Jupiter LTB Support
  • Loading branch information
haekb authored Jan 23, 2021
2 parents 937eff1 + 0a08a4a commit c18a98f
Show file tree
Hide file tree
Showing 9 changed files with 1,491 additions and 27 deletions.
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Download or clone the repository, and zip up the `src` folder. Go to `Edit -> Pr

To download the respository, click the green `Code -> Download ZIP` at the top of the main page.

I will eventually add releases.
...or grab a release zip if one is there!

## Supported Formats

Expand All @@ -19,12 +19,19 @@ Format | Import | Export
ABC | Rigid and Skeletal | Limited
LTA | No | Rigid and Skeletal
LTB (PS2) | Rigid and Skeletal | No
LTB (PC) | No | No
LTB (PC) | Rigid and Skeletal | No

The ABC file format description can be found on our wiki [here](https://github.com/cmbasnett/io_scene_abc/wiki/ABC).

Additional format information can be found in [here](https://github.com/haekb/io_scene_lithtech/tree/master/research)

## Known Issues
- In order to export you must have a mesh, a armature hooked up, and at least one animation action setup
- Socket locations are a tad off in Blender (They're fine in engine.)
- Imported skeletal meshes are mirrored on the X axis (They're flipped back on export!)
- Converters may not provide 1:1 source files
- Converters don't convert lods!

![](https://raw.githubusercontent.com/haekb/io_scene_lithtech/master/doc/readme/example.png)

## Credits
Expand Down
252 changes: 252 additions & 0 deletions research/pc_abc.bt
Original file line number Diff line number Diff line change
@@ -0,0 +1,252 @@
//------------------------------------------------
//--- 010 Editor v10.0.1 Binary Template
//
// File:
// Authors:
// Version:
// Purpose:
// Category:
// File Mask:
// ID Bytes:
// History:
//------------------------------------------------
typedef unsigned char uint8;

struct Section {
short stringLength;
char Type[stringLength] <optimize=false>;
uint32 NextSection;
};

struct LTString {
short stringLength;
char Type[stringLength] <optimize=false>;
};

struct LTTexCoord {
float u,v;
};

struct LTVector {
float x,y,z;
};

struct LTRotation {
float x,y,z,w;
};

struct LTMatrix {
LTRotation m[4];
};


struct Transform {
LTVector Location;
LTRotation Rotation;
};

//
// Header Data
//

struct Header {
uint32 Version;
uint32 KeyframeCount;
uint32 AnimationCount;
uint32 NodeCount;
uint32 PieceCount;
uint32 ChildModelCount;
uint32 FaceCount;
uint32 VertexCount;
uint32 WeightCount;
uint32 LODCount;
uint32 SocketCount;
uint32 WeightSetCount;
uint32 StringCount;
uint32 StringLengthTotal;
LTString CommandString;
float InternalRadius;
uint32 LODDistanceCount;
char Padding[60];
float LODDistances[LODDistanceCount] <optimize=false>;
};

//
// Piece Data
//

struct FaceVertex {
LTTexCoord TexCoord;
uint16 VertexIndex;
};

struct Face {
FaceVertex Vertices[3];
};

struct Weight {
uint32 NodeIndex;
LTVector Location; // This boy, right here!
float Bias;
};

struct Vertex {
uint16 WeightCount;
uint16 SubLODVertexIndex;
Weight Weights[WeightCount] <optimize=false>;
LTVector Location;
LTVector Normal;
};

struct LOD {
uint32 FaceCount;
Face Faces[FaceCount] <optimize=false>;
uint32 VertexCount;
Vertex Vertices[VertexCount] <optimize=false>;
};

struct Piece (uint32 LODCount) {
uint16 MaterialIndex;
float SpecularPower;
float SpecularScale;
//float LODWeight;
uint16 Unknown;
LTString Name;
LOD LODs[LODCount] <optimize=false>;
};

struct PieceHeader (uint32 LODCount) {
uint32 WeightCount;
uint32 PieceCount;
Piece Pieces(LODCount)[PieceCount] <optimize=false>;
};

//
// Node Data
//



struct Node {
LTString Name;
uint16 Index;
uint8 Flags;
LTMatrix BindMatrix;
uint32 ChildCount;
};

//
// Weight Data
//

struct WeightSet {
LTString Name;
uint32 NodeCount;
float NodeWeights[NodeCount] <optimize=false>;
};

struct WeightHeader {
uint32 WeightSetCount;
WeightSet WeightSets[WeightSetCount] <optimize=false>;
};

//
// Child Models
//


struct ChildModel (uint32 NodeCount) {
LTString Name;
uint32 BuildNumber;
Transform Transforms[NodeCount] <optimize=false>;
};

struct ChildModelHeader (uint32 NodeCount) {
uint16 ChildModelCount;
ChildModel ChildModels(NodeCount)[ChildModelCount] <optimize=false>;
};

//
// Animation Data
//

struct AnimationHeader {
int AnimCount;
};

struct KeyFrame {
int Time;
LTString Command;
};

struct KeyFrameTransform (uint32 KeyFrameCount) {
Transform Transforms[KeyFrameCount];
};

struct Animation (int NodeCount) {
LTVector Extents;
LTString Name;
int UnkInt;
int InterpolationTime;
int KeyFrameCount;
KeyFrame KeyFrames[KeyFrameCount] <optimize=false>;
KeyFrameTransform Transforms(KeyFrameCount)[NodeCount] <optimize=false>;
};

//
// Socket Data
//

struct Socket {
uint32 NodeIndex;
LTString Name;
LTRotation Rotation;
LTVector Location;
};

struct SocketHeader {
uint32 SocketCount;
Socket Sockets[SocketCount] <optimize=false>;
};

//
// AnimBinding Data
//

struct AnimBinding {
LTString Name;
LTVector Extents;
LTVector Origin;
};

struct AnimBindingHeader {
uint32 BindingCount;
AnimBinding AnimBindings[BindingCount];
};

//
// GO!
//

Section section;
Header hdr;

Section pieceSection;
PieceHeader piece(hdr.LODCount);

Section nodeSection;
Node nodes[hdr.NodeCount] <optimize=false>;
WeightHeader weightsets;

Section childSection;
ChildModelHeader ChildModels(hdr.NodeCount);

Section AnimSection;
AnimationHeader animHdr;
Animation anim(hdr.NodeCount)[animHdr.AnimCount] <optimize=false>;

Section SocketSection;
SocketHeader Sockets;

Section AnimBindingsSection;
AnimBindingHeader AnimBindings;
Loading

0 comments on commit c18a98f

Please sign in to comment.