GithubHelp home page GithubHelp logo

galaco / vmt Goto Github PK

View Code? Open in Web Editor NEW
6.0 3.0 0.0 20 KB

Golang package for parsing .vmt Valve Material files

License: The Unlicense

Go 100.00%
vmt material parser valve vtf source-engine counter-strike team-fortress-2

vmt's Introduction

GoDoc Go report card GolangCI CircleCI codecov

vmt

Vmt is a parser for Valve Material Format (.vmt) files.

Vmt's in Source can be a little painful; large number of possible parameters, many being specific to a particular shader. This package exists to reduce the pain of parsing materials.

You can use either the Properties struct provided, or a custom definition to only get the properties desired. Properties must be correctly typed in whatever definition is used.

If there are parameters missing from the standard Properties definition, please submit a PR to add them.

For now, nested properties are unsupported (e.g. Proxies).

Usage:

There are 3 ways to read material definitions using this package:

From a github.com/golang-source-engine/filesystem

This is the recommended solution, as it is the only method of resolving a material that uses the include property.

var fs *filesystem.Filesystem // create this elsewhere
result := vmt.NewProperties()
mat,err := vmt.FromFilesystem("metal/metal_01.vmt", fs, result)
From a stream
stream,_ := os.Open("metal/metal_01.vmt")
result := vmt.NewProperties()
mat,err := vmt.FromStream(stream, result)
From existing github.com/galaco/keyvalues
var kv *keyvalues.KeyValue // create this elsewhere
result := vmt.NewProperties()
mat,err := vmt.FromKeyValues(kv, result)
Material Definitions

If you've ever used the build-in json package, this should be familiar. See the Properties struct in this package for the default material. However, you can define your own definition below:

package foo

type CustomShader struct {
    MyProperty string `vmt:$myproperty`
}

vmt's People

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

vmt's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

This repository currently has no open or pending branches.

Detected dependencies

circleci
.circleci/config.yml
  • circleci/golang 1.17
gomod
go.mod
  • go 1.19
  • github.com/galaco/KeyValues v1.4.1

  • Check this box to trigger a request for Renovate to run again on this repository

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.