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/Mapping.cpp | 63 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 tool_src/BspLib/Mapping.cpp (limited to 'tool_src/BspLib/Mapping.cpp') diff --git a/tool_src/BspLib/Mapping.cpp b/tool_src/BspLib/Mapping.cpp new file mode 100644 index 0000000..956d66c --- /dev/null +++ b/tool_src/BspLib/Mapping.cpp @@ -0,0 +1,63 @@ +//----------------------------------------------------------------------------- +// BSPLIB MODULE: Mapping.cpp +// +// Copyright (c) 1996-1998 by Markus Hadwiger +// All Rights Reserved. +//----------------------------------------------------------------------------- + +// bsplib headers +#include "Mapping.h" +#include "Chunk.h" + + +BSPLIB_NAMESPACE_BEGIN + + +// write mapping info in vertexindexes with mappings format ------------------- +// +void Mapping::WriteMappingInfo( FILE *fp ) const +{ + // write list of vertex indexes + int i = 0; + for ( i = 0; i < numvertexindxs; i++ ) { + fprintf( fp, ( i == numvertexindxs - 1 ) ? + "%d\n" : "%d, ", facevertexindxs[ i ] + 1 ); + } + + // write (u,v) coordinates + for ( i = 0; i < numvertexindxs; i++ ) { + fprintf( fp, "%f, \t%f\n", + mappingcoordinates[ i ].getX(), + mappingcoordinates[ i ].getY() ); + } + + fprintf( fp, "\n" ); +} + + +// error in search of vertices ------------------------------------------------ +// +void Mapping::Error( int vertindx ) +{ + char *line = new char[ 1024 ]; +// fprintf( stderr, "***ERROR*** Correspondence not found (%d)!\n", corrno + 1 ); + sprintf( line, "***ERROR*** Correspondence not found!\nsought vertex %d", vertindx + 1 ); + ErrorMessage( line ); + delete line; +/* + fprintf( stderr, "list of vertices:\n" ); + for ( int i = 0; i < numvertexindxs; i++ ) + fprintf( stderr, "vertex %d\n", facevertexindxs[ i ] + 1 ); +*/ + HandleCriticalError(); +} + + +// size of mapping chunk ------------------------------------------------------ +// +template <> const int ChunkRep::CHUNK_SIZE = 256; + + +BSPLIB_NAMESPACE_END + +//----------------------------------------------------------------------------- -- cgit v1.2.3