2 Copyright (C) 1999-2007 id Software, Inc. and contributors.
3 For a list of contributors, see the accompanying CONTRIBUTORS file.
5 This file is part of GtkRadiant.
7 GtkRadiant is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 GtkRadiant is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GtkRadiant; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 //-----------------------------------------------------------------------------
25 // Quick interface hack for selected face interface
26 // this one really needs more work, but I'm in a hurry with TexTool
30 int WINAPI QERApp_GetSelectedFaceCount(){
31 return g_ptrSelectedFaces.GetSize();
34 face_t* WINAPI QERApp_GetSelectedFace( int iface ){
35 if ( iface >= g_ptrSelectedFaces.GetSize() ) {
36 Sys_FPrintf( SYS_ERR, "QERApp_GetFace: selected faces count exceeded\n" );
39 return reinterpret_cast<face_t*>( g_ptrSelectedFaces.GetAt( iface ) );
42 brush_t* WINAPI QERApp_GetSelectedFaceBrush( int iface ){
43 if ( iface >= g_ptrSelectedFaceBrushes.GetSize() ) {
44 Sys_FPrintf( SYS_ERR, "QERApp_GetFace: selected faces count exceeded\n" );
47 return reinterpret_cast<brush_t*>( g_ptrSelectedFaceBrushes.GetAt( iface ) );
50 // NOTE: we expect pWinding to have MAX_POINTS_ON_WINDING points ready for writing
51 int WINAPI QERApp_GetFaceInfo( int iface, _QERFaceData *pFaceData, winding_t *pWinding ){
54 if ( iface >= g_ptrSelectedFaces.GetSize() ) {
55 Sys_FPrintf( SYS_ERR, "QERApp_GetFaceInfo: selected faces count exceeded\n" );
58 if ( !g_qeglobals.m_bBrushPrimitMode ) {
59 Sys_Printf( "Warning: unexpected QERApp_GetFaceInfo out of brush primitive mode\n" );
62 face_t *selFace = reinterpret_cast<face_t*>( g_ptrSelectedFaces.GetAt( iface ) );
63 strcpy( pFaceData->m_TextureName, selFace->texdef.GetName() );
64 VectorCopy( selFace->planepts[0], pFaceData->m_v1 );
65 VectorCopy( selFace->planepts[1], pFaceData->m_v2 );
66 VectorCopy( selFace->planepts[2], pFaceData->m_v3 );
67 pFaceData->m_bBPrimit = true;
68 memcpy( &pFaceData->brushprimit_texdef, &selFace->brushprimit_texdef, sizeof( brushprimit_texdef_t ) );
69 size = (size_t)( (winding_t *)0 )->points[selFace->face_winding->numpoints];
70 memcpy( pWinding, selFace->face_winding, size );
74 int WINAPI QERApp_SetFaceInfo( int iface, _QERFaceData *pFaceData ){
75 if ( iface >= g_ptrSelectedFaces.GetSize() ) {
76 Sys_FPrintf( SYS_ERR, "QERApp_SetFaceInfo: selected faces count exceeded\n" );
79 if ( !g_qeglobals.m_bBrushPrimitMode ) {
80 Sys_Printf( "Warning: unexpected QERApp_SetFaceInfo out of brush primitive mode\n" );
83 face_t *selFace = reinterpret_cast<face_t*>( g_ptrSelectedFaces.GetAt( iface ) );
84 brush_t *selBrush = reinterpret_cast<brush_t*>( g_ptrSelectedFaceBrushes.GetAt( iface ) );
85 //strcpy( selected_face->texdef.name, pFaceData->m_TextureName );
86 selFace->texdef.SetName( pFaceData->m_TextureName );
87 VectorCopy( pFaceData->m_v1, selFace->planepts[0] );
88 VectorCopy( pFaceData->m_v2, selFace->planepts[1] );
89 VectorCopy( pFaceData->m_v3, selFace->planepts[2] );
90 memcpy( &selFace->brushprimit_texdef, &pFaceData->brushprimit_texdef, sizeof( brushprimit_texdef_t ) );
91 Brush_Build( selBrush );
92 Sys_UpdateWindows( W_ALL );
96 int WINAPI QERApp_ISelectedFace_GetTextureNumber( int iface ){
97 if ( iface >= g_ptrSelectedFaces.GetSize() ) {
98 Sys_FPrintf( SYS_ERR, "QERApp_ISelectedFace_GetTextureNumber: selected faces count exceeded\n" );
101 face_t *selFace = reinterpret_cast<face_t*>( g_ptrSelectedFaces.GetAt( iface ) );
102 return selFace->d_texture->texture_number;
105 void WINAPI QERApp_GetTextureSize( int iface, int Size[2] ){
106 if ( iface >= g_ptrSelectedFaces.GetSize() ) {
107 Sys_FPrintf( SYS_ERR, "QERApp_GetTextureSize: selected faces count exceeded\n" );
110 face_t *selFace = reinterpret_cast<face_t*>( g_ptrSelectedFaces.GetAt( iface ) );
111 Size[0] = selFace->d_texture->width;
112 Size[1] = selFace->d_texture->height;