Giter VIP home page Giter VIP logo

vtf's Introduction

GoDoc Go report card GolangCI Build Status codecov CircleCI

vtf

0 dependency parser for Valves own .vtf (Valve Texture Format) Source Engine textures.

Features

  • Supports versions 7.1-7.5
  • Full header data
  • Low resolution thumbnail loading
  • Complete mipmap + high-resolution texture loading

Usage

import (  
	"github.com/galaco/vtf"
	"log"
	"os"
)

func main() {
  file,_ := os.LoadFile("foo.vtf")
  texture,err := vtf.ReadFromStream(file)
	if err != nil {
		log.Println(err)
	} else {
    log.Println(texture.Header().Width)
  }
}

Whats missing

  • Resource data is ignored (besides mipmaps) in 7.3+
  • Texture with depth > 1 are unsupported. This is very rare
  • Textures with zslices > 1 are unsupported. This is very rare
  • Modify/export functionality

What won't this ever do?

  • Colour format transformation. Header properties LowResImageFormat and HighResImageFormat will provide the format.
  • (Probably) support depths or zslices > 1

Contributing

No where near all the possible texture configurations have been tested. It's possible some could cause issues. Any issues (including offending file) are greatly appreciated.

vtf's People

Contributors

galaco avatar renovate-bot avatar renovate[bot] avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar

vtf's Issues

Question about image data format table

I have a question about the values of some formats.

The fact is that for example the format UVLX8888 in total has 32 bits, but if you take your code, then there should be 16 in total, am i right? Is there a multiplication by two somewhere?

Source: https://developer.valvesoftware.com/wiki/Valve_Texture_Format


Format Red Bits Green Bits Blue Bits Alpha Bits Total Bits
UVLX8888 N/A N/A N/A N/A 32

vtf/internal/mipmaps.go

Lines 104 to 106 in 3f0c638

case format.UVLX8888:
return 4
}


Format Red Bits Green Bits Blue Bits Alpha Bits Total Bits
RGBA16161616F 16 16 16 16 64
RGBA16161616 16 16 16 16 64

vtf/internal/mipmaps.go

Lines 100 to 103 in 3f0c638

case format.RGBA16161616F:
return 8
case format.RGBA16161616:
return 8


Format Red Bits Green Bits Blue Bits Alpha Bits Total Bits
BGRX5551 5 5 5 1 16

vtf/internal/mipmaps.go

Lines 88 to 89 in 3f0c638

case format.BGRX5551:
return 2


And so on. Hope you get my point

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

Error type: Cannot find preset's package (github>whitesource/merge-confidence:beta)

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

  • 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.