Twilight Princess
Remastered version of the GameCube game
Loading...
Searching...
No Matches
KclLibrary.KCLFile Class Reference

Represents the header of a V2 KCL binary collision file. More...

Classes

class  ModelGroup
 

Public Member Functions

 KCLFile (List< Triangle > triangles, FileVersion version, bool isBigEndian, CollisionImportSettings settings=null)
 Initializes a new instance of the KclFile class, created from the given objModel .
 
 KCLFile (string fileName)
 Loads the data from the given file.
 
 KCLFile ()
 
 KCLFile (Stream stream)
 Loads the data from the given stream.
 
ObjModel CreateGenericModel ()
 Creates a generic model which can be exported into a .obj file format.
 
void Load (Stream stream, bool leaveOpen=false)
 Loads the data from the given stream .
 
void Save (string fileName)
 Saves the data in the given file.
 
void Save (Stream stream)
 Saves the data from the given stream .
 
void Replace (List< Triangle > triangles, CollisionImportSettings settings)
 Replaces the current collision model from the given objModel .
 
void ResetHits ()
 Resets the list of prisim and octree data for any that has been previously hit.
 
KCLHit CheckHit (Vector3 point)
 Checks if a prism gets hit from a given point and returns hit information.
 
void Read (BinaryDataReader reader)
 

Public Attributes

Matrix4x4 Transform = Matrix4x4.Identity
 The world transformation of the collision.
 

Properties

FileVersion Version [get, set]
 Represents the version of the KCL.
 
Vector3 MinCoordinate [get, private set]
 Gets the smallest coordinate spanned by the octree in this file.
 
Vector3 MaxCoordinate [get, private set]
 Gets the biggest coordinate spanned by the octree in this file.
 
Vector3U CoordinateShift [get, private set]
 Gets the coordinate shift required to compute indices into the octree.
 
int PrismCount [get, private set]
 Gets the total amount of prisms used in the KCL file.
 
ModelOctreeNode ModelOctreeRoot [get, private set]
 Gets the root node of the model octree.
 
List< KCLModelModels [get, private set]
 Gets the list of KCLModel instances referenced by the model octree.
 
ByteOrder ByteOrder [get, set]
 Gets or sets the byte order of the KCL file.
 

Private Member Functions

ModelOctreeNode SearchModelBlock (ModelOctreeNode[] children, Vector3 point, Vector3 position, Vector3 boxSize)
 
void PrintModelOctree (ModelOctreeNode[] children, string indent="")
 
void CreateModelOctree (List< ModelGroup > modelRoots, ModelOctreeNode[] nodes, CollisionImportSettings settings, uint baseTriCount, int level=0)
 
List< ModelGroupTryMergeModelGroups (List< ModelGroup > modelRoots)
 
List< ModelGroupCreateModelDivision (Vector3 position, List< Triangle > triangles, Vector3 boxSize, int level=0)
 
ByteOrder CheckByteOrder (BinaryDataReader reader)
 
void Write (BinaryDataWriter writer)
 
void WriteV1 (BinaryDataWriter writer)
 
void WriteV2 (BinaryDataWriter writer)
 

Static Private Attributes

const int _version2 = 0x02020000
 
static readonly int MaxModelPrismCount = 65535 / 4
 

Detailed Description

Represents the header of a V2 KCL binary collision file.

Constructor & Destructor Documentation

◆ KCLFile() [1/4]

KclLibrary.KCLFile.KCLFile ( List< Triangle > triangles,
FileVersion version,
bool isBigEndian,
CollisionImportSettings settings = null )

Initializes a new instance of the KclFile class, created from the given objModel .

◆ KCLFile() [2/4]

KclLibrary.KCLFile.KCLFile ( string fileName)

Loads the data from the given file.

Parameters
fileNameThe name of the file to load the data from.

◆ KCLFile() [3/4]

KclLibrary.KCLFile.KCLFile ( )

◆ KCLFile() [4/4]

KclLibrary.KCLFile.KCLFile ( Stream stream)

Loads the data from the given stream.

Parameters
fileNameThe name of the file to load the data from.

Member Function Documentation

◆ CheckByteOrder()

ByteOrder KclLibrary.KCLFile.CheckByteOrder ( BinaryDataReader reader)
private

◆ CheckHit()

KCLHit KclLibrary.KCLFile.CheckHit ( Vector3 point)

Checks if a prism gets hit from a given point and returns hit information.

Returns

◆ CreateGenericModel()

ObjModel KclLibrary.KCLFile.CreateGenericModel ( )

Creates a generic model which can be exported into a .obj file format.

Returns

◆ CreateModelDivision()

List< ModelGroup > KclLibrary.KCLFile.CreateModelDivision ( Vector3 position,
List< Triangle > triangles,
Vector3 boxSize,
int level = 0 )
private

◆ CreateModelOctree()

void KclLibrary.KCLFile.CreateModelOctree ( List< ModelGroup > modelRoots,
ModelOctreeNode[] nodes,
CollisionImportSettings settings,
uint baseTriCount,
int level = 0 )
private

◆ Load()

void KclLibrary.KCLFile.Load ( Stream stream,
bool leaveOpen = false )

Loads the data from the given stream .

Parameters
streamThe Stream to load the data from.
leaveOpentrue to leave stream open after loading the instance.

◆ PrintModelOctree()

void KclLibrary.KCLFile.PrintModelOctree ( ModelOctreeNode[] children,
string indent = "" )
private

◆ Read()

void KclLibrary.KCLFile.Read ( BinaryDataReader reader)

◆ Replace()

void KclLibrary.KCLFile.Replace ( List< Triangle > triangles,
CollisionImportSettings settings )

Replaces the current collision model from the given objModel .

Parameters
objModelThe ObjModel to create the collision data from.

◆ ResetHits()

void KclLibrary.KCLFile.ResetHits ( )

Resets the list of prisim and octree data for any that has been previously hit.

◆ Save() [1/2]

void KclLibrary.KCLFile.Save ( Stream stream)

Saves the data from the given stream .

Parameters
streamThe Stream to load the data from.

◆ Save() [2/2]

void KclLibrary.KCLFile.Save ( string fileName)

Saves the data in the given file.

Parameters
fileNameThe name of the file to save the data in.

◆ SearchModelBlock()

ModelOctreeNode KclLibrary.KCLFile.SearchModelBlock ( ModelOctreeNode[] children,
Vector3 point,
Vector3 position,
Vector3 boxSize )
private

◆ TryMergeModelGroups()

List< ModelGroup > KclLibrary.KCLFile.TryMergeModelGroups ( List< ModelGroup > modelRoots)
private

◆ Write()

void KclLibrary.KCLFile.Write ( BinaryDataWriter writer)
private

◆ WriteV1()

void KclLibrary.KCLFile.WriteV1 ( BinaryDataWriter writer)
private

◆ WriteV2()

void KclLibrary.KCLFile.WriteV2 ( BinaryDataWriter writer)
private

Member Data Documentation

◆ _version2

const int KclLibrary.KCLFile._version2 = 0x02020000
staticprivate

◆ MaxModelPrismCount

readonly int KclLibrary.KCLFile.MaxModelPrismCount = 65535 / 4
staticprivate

◆ Transform

Matrix4x4 KclLibrary.KCLFile.Transform = Matrix4x4.Identity

The world transformation of the collision.

Property Documentation

◆ ByteOrder

ByteOrder KclLibrary.KCLFile.ByteOrder
getset

Gets or sets the byte order of the KCL file.

◆ CoordinateShift

Vector3U KclLibrary.KCLFile.CoordinateShift
getprivate set

Gets the coordinate shift required to compute indices into the octree.

◆ MaxCoordinate

Vector3 KclLibrary.KCLFile.MaxCoordinate
getprivate set

Gets the biggest coordinate spanned by the octree in this file.

◆ MinCoordinate

Vector3 KclLibrary.KCLFile.MinCoordinate
getprivate set

Gets the smallest coordinate spanned by the octree in this file.

◆ ModelOctreeRoot

ModelOctreeNode KclLibrary.KCLFile.ModelOctreeRoot
getprivate set

Gets the root node of the model octree.

◆ Models

List<KCLModel> KclLibrary.KCLFile.Models
getprivate set

Gets the list of KCLModel instances referenced by the model octree.

◆ PrismCount

int KclLibrary.KCLFile.PrismCount
getprivate set

Gets the total amount of prisms used in the KCL file.

◆ Version

FileVersion KclLibrary.KCLFile.Version
getset

Represents the version of the KCL.


The documentation for this class was generated from the following file: