diff options
| author | Felix Morgner <felix.morgner@gmail.com> | 2026-08-24 11:16:07 +0200 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@gmail.com> | 2026-08-24 11:16:07 +0200 |
| commit | c068f22329d5cc722622a2183bbb22eef2093df7 (patch) | |
| tree | 12d56c1aede67988a55e241364606bfbb4dba933 /tool_src/BspLib/Texture.cpp | |
| download | openparsec-main.tar.xz openparsec-main.zip | |
Diffstat (limited to 'tool_src/BspLib/Texture.cpp')
| -rw-r--r-- | tool_src/BspLib/Texture.cpp | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/tool_src/BspLib/Texture.cpp b/tool_src/BspLib/Texture.cpp new file mode 100644 index 0000000..16fc494 --- /dev/null +++ b/tool_src/BspLib/Texture.cpp @@ -0,0 +1,77 @@ +//----------------------------------------------------------------------------- +// BSPLIB MODULE: Texture.cpp +// +// Copyright (c) 1996-1997 by Markus Hadwiger +// All Rights Reserved. +//----------------------------------------------------------------------------- + +// bsplib headers +#include "Texture.h" +#include "Chunk.h" + + +BSPLIB_NAMESPACE_BEGIN + + +// write texture information to text file ------------------------------------- +// +void Texture::WriteInfo( FILE *fp ) +{ + fprintf( fp, "%d/%d\t\t\"%s\"\t\t%s\n", m_width, m_height, m_name, m_file ); +} + + +// constructor for Texture ---------------------------------------------------- +// +Texture::Texture( int w, int h, char *tname, char *fname ) +{ + *m_name = 0; + *m_file = 0; + + if ( tname != NULL ) { + setName( tname ); + } + + if ( fname != NULL ) { + setFile( fname ); + } + + m_width = w; + m_height = h; +} + + +// set name of texture -------------------------------------------------------- +// +void Texture::setName( const char *tname ) +{ + if ( tname != NULL ) { + strncpy( m_name, tname, MAX_TEXNAME ); + m_name[ MAX_TEXNAME ] = 0; + } else { + *m_name = 0; + } +} + + +// set filename of texture data file ------------------------------------------ +// +void Texture::setFile( const char *fname ) +{ + if ( fname != NULL ) { + strncpy( m_file, fname, PATH_MAX ); + m_file[ PATH_MAX ] = 0; + } else { + *m_file = 0; + } +} + + +// size of texture chunk ------------------------------------------------------ +// +template <> const int ChunkRep<Texture>::CHUNK_SIZE = 128; + + +BSPLIB_NAMESPACE_END + +//----------------------------------------------------------------------------- |
