Giter Site home page Giter Site logo

errorflexxx / zenlib Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ataulien/zenlib

0.0 2.0 0.0 19.29 MB

Loading of proprietary formats used by the engine used by the games "Gothic" and "Gothic II"

License: MIT License

CMake 1.27% C++ 88.19% D 9.03% Python 0.49% Shell 1.02%

zenlib's Introduction

ZenLib Build status Build Status

Loading of proprietary formats used by the engine of the games "Gothic" and "Gothic II".

Features

Contains loaders for:

  • Zen-Archives (ASCII, BinSafe)
  • VDF-Archives
  • Compiled-Mesh formats (Static, Skeletal)
  • Skeleton-Hierarchy
  • Animation-Samples
  • Compiled textures

There is no possibility to write files at the moment. However, this is planned for a later release.

Building

ZenLib requires a compiler capable of the C++14-standard and at least CMake 3.9!

Linux and macOS

If your distribution's package manager has available packages for GLM, libsquish and PhysFS (>= 3.0.0) like Ubuntu 18.04+, then you can proceed like so:

$ # install dependencies, for example on Ubuntu:
$ sudo apt install libglm-dev libphysfs-dev libsquish-dev
$ git clone https://github.com/ataulien/ZenLib
$ cd ZenLib
$ mkdir build
$ cd build
$ cmake ..
$ cmake --build .

If the dependencies are not available from your package manager, you can either compile and install them from sources and then proceed as explained before, or use the instructions for vcpkg in common with Windows.

Windows, Linux and maxOS using vcpkg

You should follow the instructions for downloading, building and installing vcpkg from its official repository, then run the following commands:

$ path/to/vcpkg/vcpkg.exe install glm physfs libsquish # Omit .exe on Linux
$ git clone https://github.com/ataulien/ZenLib
$ cd ZenLib
$ mkdir build
$ cd build
$ cmake -DCMAKE_TOOLCHAIN_PATH=path/to/vcpkg/scripts/buildsystems/vcpkg.cmake ..
$ cmake --build .

Samples

There are some sample programs inside the /samples-folder, which can teach you how the library works and what you can do with it.

Basic usage

VDF-Archives

#include <vdfs/fileIndex.h>

/** ... **/

// Load all vdfs you need into a file-index
VDFS::FileIndex vdf;
vdf.loadVDF("Meshes.vdf");
vdf.loadVDF("MyMod.mod");

// Get file-data as byte-vector. Filename only, no folders.
std::vector<uint8_t> data;
vdf.getFileData("MyAsset.ext", data);

ZEN-Archives

#include <zenload/zenParser.h>

/** ... **/

 // Load ZEN from disk. There is also a constructor for byte-data, usefull if loading from a .vdf.
 ZenLoad::ZenParser parser("MyWorld.zen");
 
 // Do parsing
 parser.readHeader();
 ZenLoad::oCWorldData world = parser.readWorld();
 ZenLoad::zCMesh* mesh = parser.getWorldMesh();
 
 // Do something with 'world' or 'worldMesh'

Meshes/Animations

 // Load by filename + initialized VDFS::FileIndex
 ZenLoad::zCProgMeshProto mesh("MyMesh.MRM", vdfIndex);

 // Bring the loaded mesh in a more accessible format
 ZenLoad::PackedMesh packedMesh;
 mesh.packMesh(packedMesh);

This is mostly the same for all "zC***"-Classes in the ZenLib-Package.

See zenload/zTypes.h for more information about the packed data structs returned by the objects.

Textures

#include <zenload/ztex2dds.h>

/** ... **/
std::vector<uint8_t> zTexData = ...; // Get data from vdfs or something

// Convert the ZTex to a usual DDS-Texture
std::vector<uint8_t> ddsData;
ZenLoad::convertZTEX2DDS(zTexData, ddsData);

// ... do something with ddsData
// or...

// Convert the DDS-Texture to 32bpp RGBA-Data, if wanted
std::vector<uint8_t> rgbaData;
ZenLoad::convertDDSToRGBA8(ddsData, rgbaData);

// .. do something with rgbaData

Log-Callback

By default, the internal Logging-Class will output to stdout (and OutputDebugString on Windows).

You can define your own target by calling:

#include <utils/logger.h>

/** ... **/

Utils::Log::SetLogCallback([](const std::string& msg){
       // Do something with msg
   });

(Logging to file seems currently broken, sorry.)

License

MIT, see License-file.

zenlib's People

Contributors

aaeberharter avatar astillich avatar ataulien avatar commanderjax avatar errorflexxx avatar frabert avatar kapitaenzufall avatar markusobi avatar noahndertaler avatar ousnius avatar try avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.