2007-11-04 03:51:54 +00:00
|
|
|
/*
|
2012-03-17 20:01:54 +00:00
|
|
|
Copyright (C) 1999-2007 id Software, Inc. and contributors.
|
|
|
|
For a list of contributors, see the accompanying CONTRIBUTORS file.
|
2007-11-04 03:51:54 +00:00
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
This file is part of GtkRadiant.
|
2007-11-04 03:51:54 +00:00
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
GtkRadiant is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
2007-11-04 03:51:54 +00:00
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
GtkRadiant is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
2007-11-04 03:51:54 +00:00
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with GtkRadiant; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
2007-11-04 03:51:54 +00:00
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// DESCRIPTION:
|
|
|
|
// Quick interface hack for selected face interface
|
|
|
|
// this one really needs more work, but I'm in a hurry with TexTool
|
|
|
|
|
|
|
|
#include "stdafx.h"
|
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
int WINAPI QERApp_GetSelectedFaceCount(){
|
|
|
|
return g_ptrSelectedFaces.GetSize();
|
2007-11-04 03:51:54 +00:00
|
|
|
}
|
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
face_t* WINAPI QERApp_GetSelectedFace( int iface ){
|
|
|
|
if ( iface >= g_ptrSelectedFaces.GetSize() ) {
|
|
|
|
Sys_FPrintf( SYS_ERR, "QERApp_GetFace: selected faces count exceeded\n" );
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
return reinterpret_cast<face_t*>( g_ptrSelectedFaces.GetAt( iface ) );
|
2007-11-04 03:51:54 +00:00
|
|
|
}
|
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
brush_t* WINAPI QERApp_GetSelectedFaceBrush( int iface ){
|
|
|
|
if ( iface >= g_ptrSelectedFaceBrushes.GetSize() ) {
|
|
|
|
Sys_FPrintf( SYS_ERR, "QERApp_GetFace: selected faces count exceeded\n" );
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
return reinterpret_cast<brush_t*>( g_ptrSelectedFaceBrushes.GetAt( iface ) );
|
2007-11-04 03:51:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// NOTE: we expect pWinding to have MAX_POINTS_ON_WINDING points ready for writing
|
2012-03-17 20:01:54 +00:00
|
|
|
int WINAPI QERApp_GetFaceInfo( int iface, _QERFaceData *pFaceData, winding_t *pWinding ){
|
|
|
|
size_t size;
|
2007-11-04 03:51:54 +00:00
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
if ( iface >= g_ptrSelectedFaces.GetSize() ) {
|
|
|
|
Sys_FPrintf( SYS_ERR, "QERApp_GetFaceInfo: selected faces count exceeded\n" );
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
if ( !g_qeglobals.m_bBrushPrimitMode ) {
|
2016-05-16 19:20:20 +00:00
|
|
|
Sys_FPrintf( SYS_WRN, "Warning: unexpected QERApp_GetFaceInfo out of brush primitive mode\n" );
|
2012-03-17 20:01:54 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
face_t *selFace = reinterpret_cast<face_t*>( g_ptrSelectedFaces.GetAt( iface ) );
|
|
|
|
strcpy( pFaceData->m_TextureName, selFace->texdef.GetName() );
|
|
|
|
VectorCopy( selFace->planepts[0], pFaceData->m_v1 );
|
|
|
|
VectorCopy( selFace->planepts[1], pFaceData->m_v2 );
|
|
|
|
VectorCopy( selFace->planepts[2], pFaceData->m_v3 );
|
|
|
|
pFaceData->m_bBPrimit = true;
|
|
|
|
memcpy( &pFaceData->brushprimit_texdef, &selFace->brushprimit_texdef, sizeof( brushprimit_texdef_t ) );
|
|
|
|
size = (size_t)( (winding_t *)0 )->points[selFace->face_winding->numpoints];
|
|
|
|
memcpy( pWinding, selFace->face_winding, size );
|
|
|
|
return 1;
|
2007-11-04 03:51:54 +00:00
|
|
|
}
|
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
int WINAPI QERApp_SetFaceInfo( int iface, _QERFaceData *pFaceData ){
|
|
|
|
if ( iface >= g_ptrSelectedFaces.GetSize() ) {
|
|
|
|
Sys_FPrintf( SYS_ERR, "QERApp_SetFaceInfo: selected faces count exceeded\n" );
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
if ( !g_qeglobals.m_bBrushPrimitMode ) {
|
2016-05-16 19:20:20 +00:00
|
|
|
Sys_FPrintf( SYS_WRN, "Warning: unexpected QERApp_SetFaceInfo out of brush primitive mode\n" );
|
2012-03-17 20:01:54 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
face_t *selFace = reinterpret_cast<face_t*>( g_ptrSelectedFaces.GetAt( iface ) );
|
|
|
|
brush_t *selBrush = reinterpret_cast<brush_t*>( g_ptrSelectedFaceBrushes.GetAt( iface ) );
|
|
|
|
//strcpy( selected_face->texdef.name, pFaceData->m_TextureName );
|
|
|
|
selFace->texdef.SetName( pFaceData->m_TextureName );
|
|
|
|
VectorCopy( pFaceData->m_v1, selFace->planepts[0] );
|
|
|
|
VectorCopy( pFaceData->m_v2, selFace->planepts[1] );
|
|
|
|
VectorCopy( pFaceData->m_v3, selFace->planepts[2] );
|
|
|
|
memcpy( &selFace->brushprimit_texdef, &pFaceData->brushprimit_texdef, sizeof( brushprimit_texdef_t ) );
|
|
|
|
Brush_Build( selBrush );
|
|
|
|
Sys_UpdateWindows( W_ALL );
|
|
|
|
return 1;
|
2007-11-04 03:51:54 +00:00
|
|
|
}
|
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
int WINAPI QERApp_ISelectedFace_GetTextureNumber( int iface ){
|
|
|
|
if ( iface >= g_ptrSelectedFaces.GetSize() ) {
|
|
|
|
Sys_FPrintf( SYS_ERR, "QERApp_ISelectedFace_GetTextureNumber: selected faces count exceeded\n" );
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
face_t *selFace = reinterpret_cast<face_t*>( g_ptrSelectedFaces.GetAt( iface ) );
|
|
|
|
return selFace->d_texture->texture_number;
|
2007-11-04 03:51:54 +00:00
|
|
|
}
|
|
|
|
|
2012-03-17 20:01:54 +00:00
|
|
|
void WINAPI QERApp_GetTextureSize( int iface, int Size[2] ){
|
|
|
|
if ( iface >= g_ptrSelectedFaces.GetSize() ) {
|
|
|
|
Sys_FPrintf( SYS_ERR, "QERApp_GetTextureSize: selected faces count exceeded\n" );
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
face_t *selFace = reinterpret_cast<face_t*>( g_ptrSelectedFaces.GetAt( iface ) );
|
|
|
|
Size[0] = selFace->d_texture->width;
|
|
|
|
Size[1] = selFace->d_texture->height;
|
2007-11-04 03:51:54 +00:00
|
|
|
}
|