Code Monkey home page Code Monkey logo

studiomdl's Introduction

studiomdl

Overview

studiomdl compiles Studio Model Data from QC files to a model file.

This is a cross-platform compatible version of studiomdl for Half-Life (GoldSrc).

Prerequestites

  • gcc or clang

Installing & Building

Clone this project.

git clone https://github.com/fnky/studiomdl.git
cd studiomdl
make
make install # optional

You can set architecture (default -m32), compiler (default gcc) and install path (default /usr/local/bin) as well as user flags for custom C flags.

make CC=clang ARCH=-m64 INSTALL_PATH=/usr/bin USER_FLAGS="-O3 -march=native"

Note: 64-bit build currently doesn't work, due to structs not using compatible data types.

Usage

studiomdl [options] <QC file>

Options

-t
texture
-r
tag reversed
-n
tag bad normals
-f
flip all triangles
-a
normal blend angle
-h
dump hboxes
-i
ignore warnings
-g size
max sequencegroup size

Note: Your QC and SMD files has to use LF (Unix) line-endings in order to work.

Contribute

See the guidelines for contributing.

License

Half Life 1 SDK LICENSE

studiomdl's People

Contributors

fnky avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

studiomdl's Issues

Parse line endings based on system

Change the parser for QC and SMD files to be system specific for line endings. Currently only looks for CLRF (DOS) line endings \r\n, should look for LF (Unix) line endings on Unix systems \n.

For now, make sure to save QC and SMD files using LF line endings on when compiling on macOS/Linux.

Add 64-bit compatibility

Because of the data types used within the mstudio*_t types, running a 64-bit build is not possible. The data types should be changed to explicit types, such as int32_t.

Also the ALIGN(a) macro in should be updated to avoid casting—as that also can lead to indifferences between architectures.

Compile error on Ubuntu 18.04

I get an error when trying to compile the code as described on Ubuntu 18.04.

It appears to be an issue with linking the math libraries.

gcc -m32 -Wint-to-pointer-cast  -lm -pthread build/build-i386/bmpread.o build/build-i386/cmdlib.o build/build-i386/mathlib.o build/build-i386/scriplib.o build/build-i386/studiomdl.o build/build-i386/trilib.o build/build-i386/tristrip.o build/build-i386/write.o  -o build/bin-i386/studiomdl
build/build-i386/cmdlib.o: In function `Q_getwd':
cmdlib.c:(.text+0x488): warning: the `getwd' function is dangerous and should not be used.
build/build-i386/mathlib.o: In function `VectorLength':
mathlib.c:(.text+0x61): undefined reference to `sqrt'
build/build-i386/mathlib.o: In function `Q_rint':
mathlib.c:(.text+0x101): undefined reference to `floor'
build/build-i386/mathlib.o: In function `VectorNormalize':
mathlib.c:(.text+0x408): undefined reference to `sqrt'
build/build-i386/mathlib.o: In function `AngleMatrix':
mathlib.c:(.text+0x5cf): undefined reference to `sin'
mathlib.c:(.text+0x5e7): undefined reference to `cos'
mathlib.c:(.text+0x612): undefined reference to `sin'
mathlib.c:(.text+0x62a): undefined reference to `cos'
mathlib.c:(.text+0x652): undefined reference to `sin'
mathlib.c:(.text+0x66a): undefined reference to `cos'
build/build-i386/mathlib.o: In function `AngleIMatrix':
mathlib.c:(.text+0x775): undefined reference to `sin'
mathlib.c:(.text+0x78d): undefined reference to `cos'
mathlib.c:(.text+0x7b8): undefined reference to `sin'
mathlib.c:(.text+0x7d0): undefined reference to `cos'
mathlib.c:(.text+0x7f8): undefined reference to `sin'
mathlib.c:(.text+0x810): undefined reference to `cos'
build/build-i386/mathlib.o: In function `AngleQuaternion':
mathlib.c:(.text+0xebc): undefined reference to `sin'
mathlib.c:(.text+0xed4): undefined reference to `cos'
mathlib.c:(.text+0xeff): undefined reference to `sin'
mathlib.c:(.text+0xf17): undefined reference to `cos'
mathlib.c:(.text+0xf3f): undefined reference to `sin'
mathlib.c:(.text+0xf57): undefined reference to `cos'
build/build-i386/mathlib.o: In function `QuaternionSlerp':
mathlib.c:(.text+0x136e): undefined reference to `acos'
mathlib.c:(.text+0x1386): undefined reference to `sin'
mathlib.c:(.text+0x13a7): undefined reference to `sin'
mathlib.c:(.text+0x13c7): undefined reference to `sin'
mathlib.c:(.text+0x1497): undefined reference to `sin'
mathlib.c:(.text+0x14bf): undefined reference to `sin'
build/build-i386/studiomdl.o: In function `TextureCoordRanges':
studiomdl.c:(.text+0x57eb): undefined reference to `fmin'
studiomdl.c:(.text+0x581b): undefined reference to `fmin'
studiomdl.c:(.text+0x5866): undefined reference to `fmax'
studiomdl.c:(.text+0x5896): undefined reference to `fmax'
studiomdl.c:(.text+0x5a56): undefined reference to `fmin'
studiomdl.c:(.text+0x5a86): undefined reference to `fmin'
studiomdl.c:(.text+0x5ad1): undefined reference to `fmax'
studiomdl.c:(.text+0x5b01): undefined reference to `fmax'
studiomdl.c:(.text+0x5f88): undefined reference to `fmax'
studiomdl.c:(.text+0x5fe0): undefined reference to `fmin'
studiomdl.c:(.text+0x6038): undefined reference to `fmax'
studiomdl.c:(.text+0x6090): undefined reference to `fmin'
build/build-i386/studiomdl.o: In function `ResizeTexture':
studiomdl.c:(.text+0x65d9): undefined reference to `pow'
build/build-i386/studiomdl.o: In function `Grab_Animation':
studiomdl.c:(.text+0x8ce3): undefined reference to `cos'
studiomdl.c:(.text+0x8d03): undefined reference to `sin'
build/build-i386/studiomdl.o: In function `.L944':
studiomdl.c:(.text+0xc0c3): undefined reference to `cos'
collect2: error: ld returned 1 exit status
Makefile:97: recipe for target 'build/bin-i386/studiomdl' failed
make: *** [build/bin-i386/studiomdl] Error 1

I was able to get it compiling by moving to -ld flag in the compile line to come after the objects (as per this Stack Overflow issue answer.

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.