From c068f22329d5cc722622a2183bbb22eef2093df7 Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Mon, 24 Aug 2026 11:16:07 +0200 Subject: initial import --- tool_src/BspLib/Texture.cpp | 77 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 tool_src/BspLib/Texture.cpp (limited to 'tool_src/BspLib/Texture.cpp') 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::CHUNK_SIZE = 128; + + +BSPLIB_NAMESPACE_END + +//----------------------------------------------------------------------------- -- cgit v1.2.3