static int Main(string[] args) { { TestBench.StartLogging(ELogType.Warning); Level level = TestBench.LoadAndTrackLVL(args[0]); if (level == null) { TestBench.StopLogging(); return(-1); } var classes = level.GetEntityClasses(); int k = 0; foreach (var ec in classes) { Console.WriteLine("\n" + ec.name + " of base class: " + ec.GetBaseName()); ec.GetOverriddenProperties(out uint[] hashes, out string[] values); Console.WriteLine("Properties: "); for (int i = 0; i < values.Length; i++) { Console.WriteLine("\t0x{0:x}: {1}", hashes[i], values[i]); } } TestBench.StopLogging(); return(1); } }
static void Main(string[] args) { TestBench.StartLogging(ELogType.Warning); var lvls = TestBench.LoadAndTrackLVLs(new List <string>(args)); TestBench.StopLogging(); }
public static int Main(string[] args) { TestBench.StartLogging(ELogType.Warning); Level level = TestBench.LoadAndTrackLVL(args[0]); if (level == null) { return(-1); } Terrain terrain = level.GetTerrains()[0]; foreach (var str in terrain.layerTextures) { if (str == "") { continue; } Console.Write("Texture name: " + str); Texture tex = level.GetTexture(str); if (tex != null) { byte[] data = tex.GetBytesRGBA(); Console.WriteLine(" width: " + tex.width + " height: " + tex.height + " bytes length: " + data.Length); } else { Console.WriteLine(" lookup failed."); } } terrain.GetHeightMap(out uint dim, out uint dimScale, out float[] heightMapData); terrain.GetBlendMap(out dim, out uint numLayers, out byte[] blendMapData); uint[] iBuf = terrain.GetIndexBuffer(); Vector2[] uvBuf = terrain.GetUVBuffer <Vector2>(); Vector3[] vertBuf = terrain.GetPositionsBuffer <Vector3>(); Vector3[] normsBuf = terrain.GetNormalsBuffer <Vector3>(); Console.WriteLine("Num uvs: {0}, num normals: {1}, num verts: {2}, num indices: {3}", uvBuf.Length, normsBuf.Length, vertBuf.Length, iBuf.Length); TestBench.StopLogging(); return(1); }
static int Main(string[] args) { TestBench.StartLogging(ELogType.Warning); var lvls = TestBench.LoadAndTrackLVLs(new List <string>(args)); for (int i = 0; i < lvls.Count; i++) { Console.WriteLine("Level {0}'s collision meshes: ", i); var level = lvls[i]; Model[] models = level.GetModels(); foreach (Model model in models) { Console.WriteLine("\n\tModel: " + model.name); CollisionMesh mesh = model.GetCollisionMesh(); if (mesh == null) { continue; } Console.WriteLine("\t\tCollision mask flags: {0}", mesh.maskFlags); Console.WriteLine("\t\tNum collision indices: {0}", mesh.GetIndices().Length); Console.WriteLine("\t\tNum collision verticies: {0}", mesh.GetVertices <Vector3>().Length); CollisionPrimitive[] prims = model.GetPrimitivesMasked(16); Console.WriteLine("\t\t{0} Primitives: ", prims.Length); foreach (var prim in prims) { Console.WriteLine("\t\t\tName: {0} Parent: {1}", prim.name, prim.parentName); } } } TestBench.StopLogging(); return(0); }
static int Main(string[] args) { if (args.Length < 3) { return(-1); } TestBench.StartLogging(ELogType.Warning); Level level = TestBench.LoadAndTrackLVL(args[0]); if (level == null) { TestBench.StopLogging(); return(-1); } string animSetName = args[1]; string animationName = args[2]; List <uint> boneCRCs = new List <uint>(); for (int i = 0; i < args.Length - 3; i++) { boneCRCs.Add(HashUtils.GetCRC(args[3 + i])); } AnimationBank bank = level.GetAnimationBank(animSetName); if (bank == null) { Console.WriteLine("Animation bank not found!"); TestBench.StopLogging(); return(-1); } uint[] animHashes = bank.GetAnimationCRCs(); foreach (uint hash in animHashes) { if (hash == HashUtils.GetCRC(animationName)) { bank.GetAnimationMetadata(hash, out int numFrames, out int numBones); Console.WriteLine("Printing bone curves for {0}(0x{1:X})", animationName, hash); Console.WriteLine("{0} transforms {1} bones over {2} frames...", animationName, numBones, numFrames); for (int i = 0; i < boneCRCs.Count; i++) { string boneName = args[3 + i]; uint boneHash = boneCRCs[i]; Console.WriteLine("\tBone #{0}: {1} (0x{2:X})", i, boneName, boneHash); bool status = bank.GetCurve(hash, boneHash, 0, out ushort[] inds, out float[] values); if (!status) { Console.WriteLine("\t\tFailed to fetch curve!"); TestBench.StopLogging(); return(-1); } Console.WriteLine("\t\tRotation X component: "); for (int j = 0; j < inds.Length && j < 5; j++) { Console.WriteLine("\t\t\t{0}: {1}", inds[j], values[j]); } } TestBench.StopLogging(); return(0); } } Console.WriteLine("Animation not found!"); TestBench.StopLogging(); return(-1); }