mirror of
https://github.com/TTimo/GtkRadiant.git
synced 2025-01-10 03:51:18 +00:00
Merge remote-tracking branch 'refs/remotes/TTimo/master'
This commit is contained in:
commit
bbca1630f1
162 changed files with 3881 additions and 2661 deletions
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
[submodule "bspc"]
|
||||||
|
path = bspc
|
||||||
|
url = git@github.com:TTimo/bspc.git
|
|
@ -8,7 +8,7 @@ BINDIR = $(RESOURCES)/install
|
||||||
CONFDIR = $(RESOURCES)/etc
|
CONFDIR = $(RESOURCES)/etc
|
||||||
DATADIR = $(RESOURCES)/share
|
DATADIR = $(RESOURCES)/share
|
||||||
LIBDIR = $(RESOURCES)/lib
|
LIBDIR = $(RESOURCES)/lib
|
||||||
VERSION = 1.6.4
|
VERSION = 1.6.5
|
||||||
DMG = $(TARGET)/GtkRadiant-$(VERSION).dmg
|
DMG = $(TARGET)/GtkRadiant-$(VERSION).dmg
|
||||||
VOLUME_NAME = "GtkRadiant $(VERSION)"
|
VOLUME_NAME = "GtkRadiant $(VERSION)"
|
||||||
|
|
||||||
|
@ -32,14 +32,7 @@ all: install bundle
|
||||||
gdk-pixbuf-query-loaders | sed $(PREFIX_SED_EXPR) > \
|
gdk-pixbuf-query-loaders | sed $(PREFIX_SED_EXPR) > \
|
||||||
$(CONFDIR)/gtk-2.0/gdk-pixbuf.loaders
|
$(CONFDIR)/gtk-2.0/gdk-pixbuf.loaders
|
||||||
|
|
||||||
-gtk-runtime-pango:
|
-gtk-runtime: -gtk-runtime-gdk-pixbuf-2.0
|
||||||
cp -r $(MACPORTS_PREFIX)/lib/pango $(LIBDIR)
|
|
||||||
find $(LIBDIR)/pango -type f ! -name "*.so" -delete
|
|
||||||
|
|
||||||
pango-querymodules | sed $(PREFIX_SED_EXPR) > \
|
|
||||||
$(CONFDIR)/pango/pango.modules
|
|
||||||
|
|
||||||
-gtk-runtime: -gtk-runtime-gdk-pixbuf-2.0 -gtk-runtime-pango
|
|
||||||
cp -r $(MACPORTS_PREFIX)/lib/gtk-2.0 $(LIBDIR)
|
cp -r $(MACPORTS_PREFIX)/lib/gtk-2.0 $(LIBDIR)
|
||||||
find $(LIBDIR)/gtk-2.0 -type f ! -name "*.so" -delete
|
find $(LIBDIR)/gtk-2.0 -type f ! -name "*.so" -delete
|
||||||
|
|
||||||
|
@ -53,7 +46,7 @@ all: install bundle
|
||||||
|
|
||||||
install: -pre-install -gtk-runtime
|
install: -pre-install -gtk-runtime
|
||||||
cp -r $(INSTALL) $(RESOURCES)
|
cp -r $(INSTALL) $(RESOURCES)
|
||||||
rm -rf `find $(INSTDIR)/installs -type d -name .svn`
|
rm -rf `find $(INSTALL)/installs -type d -name .svn`
|
||||||
|
|
||||||
bundle:
|
bundle:
|
||||||
|
|
||||||
|
|
1
bspc
Submodule
1
bspc
Submodule
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit a1287590f17c35a612f33708aeec5815402866b8
|
|
@ -38,7 +38,7 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<PlatformToolset>v110_xp</PlatformToolset>
|
<PlatformToolset>v140</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
<ImportGroup Label="ExtensionSettings">
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
|
|
@ -83,7 +83,7 @@ int DBrush::BuildPoints(){
|
||||||
int pos = PointPosition( pnt );
|
int pos = PointPosition( pnt );
|
||||||
|
|
||||||
if ( pos == POINT_IN_BRUSH ) { // ???? shouldn't happen here
|
if ( pos == POINT_IN_BRUSH ) { // ???? shouldn't happen here
|
||||||
Sys_Printf( "ERROR:: Build Brush Points: Point IN brush!!!\n" );
|
Sys_FPrintf( SYS_ERR, "ERROR:: Build Brush Points: Point IN brush!!!\n" );
|
||||||
}
|
}
|
||||||
else if ( pos == POINT_ON_BRUSH ) { // normal point
|
else if ( pos == POINT_ON_BRUSH ) { // normal point
|
||||||
if ( !HasPoint( pnt ) ) {
|
if ( !HasPoint( pnt ) ) {
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<PlatformToolset>v110_xp</PlatformToolset>
|
<PlatformToolset>v140</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
<ImportGroup Label="ExtensionSettings">
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
|
|
@ -122,7 +122,7 @@ void CPortals::Load(){
|
||||||
in = fopen( fn, "rt" );
|
in = fopen( fn, "rt" );
|
||||||
|
|
||||||
if ( in == NULL ) {
|
if ( in == NULL ) {
|
||||||
Sys_Printf( " ERROR - could not open file.\n" );
|
Sys_FPrintf( SYS_ERR, "ERROR - could not open file.\n" );
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -130,7 +130,7 @@ void CPortals::Load(){
|
||||||
if ( !fgets( buf, LINE_BUF, in ) ) {
|
if ( !fgets( buf, LINE_BUF, in ) ) {
|
||||||
fclose( in );
|
fclose( in );
|
||||||
|
|
||||||
Sys_Printf( " ERROR - File ended prematurely.\n" );
|
Sys_FPrintf( SYS_ERR, "ERROR - File ended prematurely.\n" );
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -138,7 +138,7 @@ void CPortals::Load(){
|
||||||
if ( strncmp( "PRT1", buf, 4 ) != 0 ) {
|
if ( strncmp( "PRT1", buf, 4 ) != 0 ) {
|
||||||
fclose( in );
|
fclose( in );
|
||||||
|
|
||||||
Sys_Printf( " ERROR - File header indicates wrong file type (should be \"PRT1\").\n" );
|
Sys_FPrintf( SYS_ERR, "ERROR - File header indicates wrong file type (should be \"PRT1\").\n" );
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -146,7 +146,7 @@ void CPortals::Load(){
|
||||||
if ( !fgets( buf, LINE_BUF, in ) ) {
|
if ( !fgets( buf, LINE_BUF, in ) ) {
|
||||||
fclose( in );
|
fclose( in );
|
||||||
|
|
||||||
Sys_Printf( " ERROR - File ended prematurely.\n" );
|
Sys_FPrintf( SYS_ERR, "ERROR - File ended prematurely.\n" );
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -158,7 +158,7 @@ void CPortals::Load(){
|
||||||
|
|
||||||
node_count = 0;
|
node_count = 0;
|
||||||
|
|
||||||
Sys_Printf( " ERROR - Extreme number of nodes, aborting.\n" );
|
Sys_FPrintf( SYS_ERR, "ERROR - Extreme number of nodes, aborting.\n" );
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -168,7 +168,7 @@ void CPortals::Load(){
|
||||||
|
|
||||||
node_count = 0;
|
node_count = 0;
|
||||||
|
|
||||||
Sys_Printf( " ERROR - File ended prematurely.\n" );
|
Sys_FPrintf( SYS_ERR, "ERROR - File ended prematurely.\n" );
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -181,7 +181,7 @@ void CPortals::Load(){
|
||||||
|
|
||||||
node_count = 0;
|
node_count = 0;
|
||||||
|
|
||||||
Sys_Printf( " ERROR - File ended prematurely.\n" );
|
Sys_FPrintf( SYS_ERR, "ERROR - File ended prematurely.\n" );
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -199,7 +199,7 @@ void CPortals::Load(){
|
||||||
|
|
||||||
node_count = 0;
|
node_count = 0;
|
||||||
|
|
||||||
Sys_Printf( " ERROR - File ended prematurely.\n" );
|
Sys_FPrintf( SYS_ERR, "ERROR - File ended prematurely.\n" );
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -218,7 +218,7 @@ void CPortals::Load(){
|
||||||
|
|
||||||
node_count = 0;
|
node_count = 0;
|
||||||
|
|
||||||
Sys_Printf( " ERROR - File ended prematurely.\n" );
|
Sys_FPrintf( SYS_ERR, "ERROR - File ended prematurely.\n" );
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -249,7 +249,7 @@ void CPortals::Load(){
|
||||||
|
|
||||||
Purge();
|
Purge();
|
||||||
|
|
||||||
Sys_Printf( " ERROR - Could not find information for portal number %d of %d.\n", n + 1, p_count );
|
Sys_FPrintf( SYS_ERR, "ERROR - Could not find information for portal number %d of %d.\n", n + 1, p_count );
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -262,7 +262,7 @@ void CPortals::Load(){
|
||||||
|
|
||||||
Purge();
|
Purge();
|
||||||
|
|
||||||
Sys_Printf( " ERROR - Information for portal number %d of %d is not formatted correctly.\n", n + 1, p_count );
|
Sys_FPrintf( SYS_ERR, "ERROR - Information for portal number %d of %d is not formatted correctly.\n", n + 1, p_count );
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -272,7 +272,7 @@ void CPortals::Load(){
|
||||||
|
|
||||||
Purge();
|
Purge();
|
||||||
|
|
||||||
Sys_Printf( " ERROR - Information for portal number %d of %d is not formatted correctly.\n", n + 1, p_count );
|
Sys_FPrintf( SYS_ERR, "ERROR - Information for portal number %d of %d is not formatted correctly.\n", n + 1, p_count );
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -285,7 +285,7 @@ void CPortals::Load(){
|
||||||
|
|
||||||
Purge();
|
Purge();
|
||||||
|
|
||||||
Sys_Printf( " ERROR - Could not find information for portal number %d of %d.\n", n + 1, p_count );
|
Sys_FPrintf( SYS_ERR, "ERROR - Could not find information for portal number %d of %d.\n", n + 1, p_count );
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -298,7 +298,7 @@ void CPortals::Load(){
|
||||||
|
|
||||||
Purge();
|
Purge();
|
||||||
|
|
||||||
Sys_Printf( " ERROR - Information for portal number %d of %d is not formatted correctly.\n", n + 1, p_count );
|
Sys_FPrintf( SYS_ERR, "ERROR - Information for portal number %d of %d is not formatted correctly.\n", n + 1, p_count );
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -143,7 +143,7 @@ void Sys_ERROR( const char* text, ... ){
|
||||||
vsprintf( buf, text,argptr );
|
vsprintf( buf, text,argptr );
|
||||||
va_end( argptr );
|
va_end( argptr );
|
||||||
|
|
||||||
Sys_Printf( "BobToolz::ERROR->%s", buf );
|
Sys_FPrintf( SYS_ERR, "BobToolz::ERROR->%s", buf );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*void Sys_Printf (char *text, ...)
|
/*void Sys_Printf (char *text, ...)
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<PlatformToolset>v110_xp</PlatformToolset>
|
<PlatformToolset>v140</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
<ImportGroup Label="ExtensionSettings">
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
|
|
@ -34,7 +34,7 @@ void Sys_ERROR( char* text, ... ){
|
||||||
vsprintf( buf, text,argptr );
|
vsprintf( buf, text,argptr );
|
||||||
va_end( argptr );
|
va_end( argptr );
|
||||||
|
|
||||||
Sys_Printf( "Camera::ERROR->%s", buf );
|
Sys_FPrintf( SYS_ERR, "Camera::ERROR->%s", buf );
|
||||||
}
|
}
|
||||||
|
|
||||||
char* UnixToDosPath( char* path ){
|
char* UnixToDosPath( char* path ){
|
||||||
|
@ -117,7 +117,7 @@ void CDECL Com_Error( int level, const char *error, ... ){
|
||||||
vsprintf( buf, error,argptr );
|
vsprintf( buf, error,argptr );
|
||||||
va_end( argptr );
|
va_end( argptr );
|
||||||
|
|
||||||
Sys_Printf( "Camera::ERROR->%s", buf );
|
Sys_FPrintf( SYS_ERR, "Camera::ERROR->%s", buf );
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDECL Com_Printf( const char* msg, ... ){
|
void CDECL Com_Printf( const char* msg, ... ){
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<PlatformToolset>v110_xp</PlatformToolset>
|
<PlatformToolset>v140</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
<ImportGroup Label="ExtensionSettings">
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<PlatformToolset>v110_xp</PlatformToolset>
|
<PlatformToolset>v140</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
<ImportGroup Label="ExtensionSettings">
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
|
|
@ -305,7 +305,7 @@ void UpdateWadKeyPair( void ){
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Sys_Printf( "HydraToolz: WARNING: could not locate wad file %s\n",(char *)wadlist->data );
|
Sys_FPrintf( SYS_WRN, "WARNING: could not locate wad file %s\n",(char *)wadlist->data );
|
||||||
strcat( wads, (char *)wadlist->data );
|
strcat( wads, (char *)wadlist->data );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -166,7 +166,7 @@ void CPortals::Load(){
|
||||||
in = fopen( fn, "rt" );
|
in = fopen( fn, "rt" );
|
||||||
|
|
||||||
if ( in == NULL ) {
|
if ( in == NULL ) {
|
||||||
Sys_Printf( " ERROR - could not open file.\n" );
|
Sys_FPrintf( SYS_ERR, "ERROR - could not open file.\n" );
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -174,7 +174,7 @@ void CPortals::Load(){
|
||||||
if ( !fgets( buf, LINE_BUF, in ) ) {
|
if ( !fgets( buf, LINE_BUF, in ) ) {
|
||||||
fclose( in );
|
fclose( in );
|
||||||
|
|
||||||
Sys_Printf( " ERROR - File ended prematurely.\n" );
|
Sys_FPrintf( SYS_ERR, "ERROR - File ended prematurely.\n" );
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -182,7 +182,7 @@ void CPortals::Load(){
|
||||||
if ( strncmp( "PRT1", buf, 4 ) != 0 ) {
|
if ( strncmp( "PRT1", buf, 4 ) != 0 ) {
|
||||||
fclose( in );
|
fclose( in );
|
||||||
|
|
||||||
Sys_Printf( " ERROR - File header indicates wrong file type (should be \"PRT1\").\n" );
|
Sys_FPrintf( SYS_ERR, "ERROR - File header indicates wrong file type (should be \"PRT1\").\n" );
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -190,7 +190,7 @@ void CPortals::Load(){
|
||||||
if ( !fgets( buf, LINE_BUF, in ) ) {
|
if ( !fgets( buf, LINE_BUF, in ) ) {
|
||||||
fclose( in );
|
fclose( in );
|
||||||
|
|
||||||
Sys_Printf( " ERROR - File ended prematurely.\n" );
|
Sys_FPrintf( SYS_ERR, "ERROR - File ended prematurely.\n" );
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -203,7 +203,7 @@ void CPortals::Load(){
|
||||||
|
|
||||||
node_count = 0;
|
node_count = 0;
|
||||||
|
|
||||||
Sys_Printf(" ERROR - Extreme number of nodes, aborting.\n");
|
Sys_FPrintf( SYS_ERR, "ERROR - Extreme number of nodes, aborting.\n");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -214,7 +214,7 @@ void CPortals::Load(){
|
||||||
|
|
||||||
node_count = 0;
|
node_count = 0;
|
||||||
|
|
||||||
Sys_Printf( " ERROR - File ended prematurely.\n" );
|
Sys_FPrintf( SYS_ERR, "ERROR - File ended prematurely.\n" );
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -227,7 +227,7 @@ void CPortals::Load(){
|
||||||
portal_count = 0;
|
portal_count = 0;
|
||||||
node_count = 0;
|
node_count = 0;
|
||||||
|
|
||||||
Sys_Printf( " ERROR - Extreme number of portals, aborting.\n" );
|
Sys_FPrintf( SYS_ERR, "ERROR - Extreme number of portals, aborting.\n" );
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -238,7 +238,7 @@ void CPortals::Load(){
|
||||||
portal_count = 0;
|
portal_count = 0;
|
||||||
node_count = 0;
|
node_count = 0;
|
||||||
|
|
||||||
Sys_Printf( " ERROR - number of portals equals 0, aborting.\n" );
|
Sys_FPrintf( SYS_ERR, "ERROR - number of portals equals 0, aborting.\n" );
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -260,7 +260,7 @@ void CPortals::Load(){
|
||||||
|
|
||||||
Purge();
|
Purge();
|
||||||
|
|
||||||
Sys_Printf( " ERROR - Could not find information for portal number %d of %d.\n", n + 1, portal_count );
|
Sys_FPrintf( SYS_ERR, "ERROR - Could not find information for portal number %d of %d.\n", n + 1, portal_count );
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -278,7 +278,7 @@ void CPortals::Load(){
|
||||||
|
|
||||||
Purge();
|
Purge();
|
||||||
|
|
||||||
Sys_Printf( " ERROR - Information for portal number %d of %d is not formatted correctly.\n", n + 1, portal_count );
|
Sys_FPrintf( SYS_ERR, "ERROR - Information for portal number %d of %d is not formatted correctly.\n", n + 1, portal_count );
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<PlatformToolset>v110_xp</PlatformToolset>
|
<PlatformToolset>v140</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
<ImportGroup Label="ExtensionSettings">
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
|
|
@ -137,16 +137,6 @@ struct _QERModelLoad
|
||||||
|
|
||||||
//=========================================
|
//=========================================
|
||||||
// plugin functions
|
// plugin functions
|
||||||
#if 0
|
|
||||||
// NOTE TTimo: hack to make old plugin tech and new plugin tech live together
|
|
||||||
#ifndef _IPLUGIN_H_
|
|
||||||
// toolkit-independant interface, cast hwndMain to GtkWidget*
|
|
||||||
typedef const char* ( WINAPI * PFN_QERPLUG_INIT )( void* hApp, void* hwndMain );
|
|
||||||
typedef const char* ( WINAPI * PFN_QERPLUG_GETNAME )();
|
|
||||||
typedef const char* ( WINAPI * PFN_QERPLUG_GETCOMMANDLIST )();
|
|
||||||
typedef void ( WINAPI * PFN_QERPLUG_DISPATCH )( const char* p, vec3_t vMin, vec3_t vMax, bool bSingleBrush );
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef char* ( WINAPI * PFN_QERPLUG_GETFUNCTABLE )();
|
typedef char* ( WINAPI * PFN_QERPLUG_GETFUNCTABLE )();
|
||||||
|
|
||||||
|
@ -275,115 +265,6 @@ typedef char* ( WINAPI * PFN_QERAPP_PROFILE_LOADSTR )( const char *filename, con
|
||||||
// To use the active or selected brush lists, you must first allocate them (which returns a count) and then
|
// To use the active or selected brush lists, you must first allocate them (which returns a count) and then
|
||||||
// release them when you are finish manipulating brushes in one of those lists.
|
// release them when you are finish manipulating brushes in one of those lists.
|
||||||
|
|
||||||
//++timo NOTE : the #defines here are never used, but can help finding where things are done in the editor
|
|
||||||
#if 0
|
|
||||||
// brush manipulation routines
|
|
||||||
#define QERAPP_CREATEBRUSH "QERApp_CreateBrush"
|
|
||||||
#define QERAPP_CREATEBRUSHHANDLE "QERApp_CreateBrushHandle"
|
|
||||||
#define QERAPP_DELETEBRUSHHANDLE "QERApp_DeleteBrushHandle"
|
|
||||||
#define QERAPP_COMMITBRUSHHANDLETOMAP "QERApp_CommitBrushHandleToMap"
|
|
||||||
//++timo not implemented .. remove
|
|
||||||
// #define QERAPP_BINDHANDLESTOENTITY "QERApp_BindHandlesToEntity"
|
|
||||||
#define QERAPP_ADDFACE "QERApp_AddFace"
|
|
||||||
#define QERAPP_ADDFACEDATA "QERApp_AddFaceData"
|
|
||||||
#define QERAPP_GETFACECOUNT "QERApp_GetFaceCount"
|
|
||||||
#define QERAPP_GETFACEDATA "QERApp_GetFaceData"
|
|
||||||
#define QERAPP_SETFACEDATA "QERApp_SetFaceData"
|
|
||||||
#define QERAPP_DELETEFACE "QERApp_DeleteFace"
|
|
||||||
#define QERAPP_TEXTUREBRUSH "QERApp_TextureBrush"
|
|
||||||
#define QERAPP_BUILDBRUSH "QERApp_BuildBrush" // PGM
|
|
||||||
#define QERAPP_SELECTEDBRUSHCOUNT "QERApp_SelectedBrushCount"
|
|
||||||
#define QERAPP_ALLOCATESELECTEDBRUSHHANDLES "QERApp_AllocateSelectedBrushHandles"
|
|
||||||
#define QERAPP_RELEASESELECTEDBRUSHHANDLES "QERApp_ReleaseSelectedBrushHandles"
|
|
||||||
#define QERAPP_GETSELECTEDBRUSHHANDLE "QERApp_GetSelectedBrushHandle"
|
|
||||||
#define QERAPP_ACTIVEBRUSHCOUNT "QERApp_ActiveBrushCount"
|
|
||||||
#define QERAPP_ALLOCATEACTIVEBRUSHHANDLES "QERApp_AllocateActiveBrushHandles"
|
|
||||||
#define QERAPP_RELEASEACTIVEBRUSHHANDLES "QERApp_ReleaseActiveBrushHandles"
|
|
||||||
#define QERAPP_GETACTIVEBRUSHHANDLE "QERApp_GetActiveBrushHandle"
|
|
||||||
|
|
||||||
// texture stuff
|
|
||||||
#define QERAPP_TEXTURECOUNT "QERApp_TextureCount"
|
|
||||||
#define QERAPP_GETTEXTURE "QERApp_GetTexture"
|
|
||||||
#define QERAPP_GETCURRENTTEXTURE "QERApp_GetCurrentTexture"
|
|
||||||
#define QERAPP_SETCURRENTTEXTURE "QERApp_SetCurrentTexture"
|
|
||||||
|
|
||||||
// selection
|
|
||||||
#define QERAPP_DELETESELECTION "QERApp_DeleteSelection"
|
|
||||||
#define QERAPP_SELECTBRUSH "QERApp_SelectBrush" // PGM
|
|
||||||
#define QERAPP_DESELECTBRUSH "QERApp_DeselectBrush" // PGM
|
|
||||||
#define QERAPP_DESELECTALLBRUSHES "QERApp_DeselectAllBrushes" // PGM
|
|
||||||
|
|
||||||
// data gathering
|
|
||||||
#define QERAPP_GETPOINTS "QERApp_GetPoints"
|
|
||||||
#define QERAPP_SELECTBRUSHES "QERApp_GetBrushes"
|
|
||||||
|
|
||||||
// entity class stuff
|
|
||||||
// the entity handling is very basic for 1.0
|
|
||||||
#define QERAPP_GETECLASSCOUNT "QERApp_GetEClassCount"
|
|
||||||
#define QERAPP_GETECLASS "QERApp_GetEClass"
|
|
||||||
|
|
||||||
// misc
|
|
||||||
#define QERAPP_SYSMSG "QERApp_SysMsg"
|
|
||||||
#define QERAPP_INFOMSG "QERApp_InfoMsg"
|
|
||||||
#define QERAPP_HIDEINFOMSG "QERApp_HideInfoMsg"
|
|
||||||
#define QERAPP_RESET_PLUGINS "QERApp_ResetPlugins"
|
|
||||||
|
|
||||||
// texture loading
|
|
||||||
#define QERAPP_LOADTEXTURERGBA "QERApp_LoadTextureRGBA"
|
|
||||||
|
|
||||||
// FIXME: the following are not implemented yet
|
|
||||||
// hook registrations
|
|
||||||
#define QERAPP_REGISTER_MAPLOADFUNC "QERApp_Register_MapLoadFunc"
|
|
||||||
#define QERAPP_REGISTER_MAPSAVEFUNC "QERApp_Register_MapSaveFunc"
|
|
||||||
|
|
||||||
// FIXME: the following are not implemented yet
|
|
||||||
#define QERAPP_REGISTER_PROJECTLOADFUNC "QERApp_Register_ProjectLoadFunc"
|
|
||||||
#define QERAPP_REGISTER_MOUSEHANDLER "QERApp_Register_MouseHandler"
|
|
||||||
#define QERAPP_REGISTER_KEYHANDLER "QERApp_Register_KeyHandler"
|
|
||||||
|
|
||||||
// FIXME: new primtives do not work in v1.00
|
|
||||||
// primitives are new types of things in the map
|
|
||||||
// for instance, the Q3 curves could have been done as
|
|
||||||
// primitives instead of being built in
|
|
||||||
// it will be a plugins responsibility to hook the map load and save funcs to load
|
|
||||||
// and/or save any additional data (like new primitives of some type)
|
|
||||||
// the editor will call each registered renderer during the rendering process to repaint
|
|
||||||
// any primitives the plugin owns
|
|
||||||
// each primitive object has a temporary sibling brush that lives in the map
|
|
||||||
// FIXME: go backwards on this a bit.. orient it more towards the temp brush mode as it will be cleaner
|
|
||||||
// basically a plugin will hook the map load and save and will add the primitives to the map.. this will
|
|
||||||
// produce a temporary 'primitive' brush and the appropriate renderer will be called as well as the
|
|
||||||
// edit handler (for edge drags, sizes, rotates, etc.. ) and the vertex maker will be called when vertex
|
|
||||||
// mode is attemped on the brush.. there will need to be a GetPrimitiveBounds callback in the edit handler
|
|
||||||
// so the brush can resize appropriately as needed.. this might be the plugins responsibility to set the
|
|
||||||
// sibling brushes size.. it will then be the plugins responsibility to hook map save to save the primitives
|
|
||||||
// as the editor will discard any temp primitive brushes.. (there probably needs to be some kind of sanity check
|
|
||||||
// here as far as keeping the brushes and the plugin in sync.. i suppose the edit handler can deal with all of that
|
|
||||||
// crap but it looks like a nice place for a mess)
|
|
||||||
#define QERAPP_REGISTER_PRIMITIVE "QERApp_Register_Primitive"
|
|
||||||
#define QERAPP_REGISTER_RENDERER "QERApp_Register_Renderer"
|
|
||||||
#define QERAPP_REGISTER_EDITHANDLER "QERApp_Register_EditHandler"
|
|
||||||
#define QERAPP_REGISTER_VERTEXMAKER "QERApp_Register_VertexMaker"
|
|
||||||
#define QERAPP_ADDPRIMITIVE "QERApp_AddPrimitive"
|
|
||||||
|
|
||||||
// v1.70
|
|
||||||
#define QERAPP_GETENTITYCOUNT "QERApp_GetEntityCount"
|
|
||||||
#define QERAPP_GETENTITYHANDLE "QERApp_GetEntityHandle"
|
|
||||||
//++timo not implemented for the moment
|
|
||||||
// #define QERAPP_GETENTITYINFO "QERApp_GetEntityInfo"
|
|
||||||
//++timo does the keyval need some more funcs to add/remove ?
|
|
||||||
// get the pointer and do the changes yourself
|
|
||||||
#define QERAPP_ALLOCATEEPAIR "QERApp_AllocateEpair"
|
|
||||||
#define QERAPP_ALLOCATEENTITYBRUSHHANDLES "QERApp_AllocateEntityBrushHandles"
|
|
||||||
#define QERAPP_RELEASEENTITYBRUSHHANDLES "QERApp_ReleaseEntityBrushHandles"
|
|
||||||
#define QERAPP_GETENTITYBRUSHHANDLE "QERApp_GetEntityBrushHandle"
|
|
||||||
#define QERAPP_CREATEENTITYHANDLE "QERApp_CreateEntityHandle"
|
|
||||||
#define QERAPP_COMMITBRUSHHANDLETOENTITY "QERApp_CommitBrushHandleToEntity"
|
|
||||||
#define QERAPP_COMMITENTITYHANDLETOMAP "QERApp_CommitEntityHandleToMap"
|
|
||||||
#define QERAPP_SETSCREENUPDATE "QERApp_SetScreenUpdate"
|
|
||||||
#define QERAPP_BUILDBRUSH2 "QERApp_BuildBrush2"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// v1.80
|
// v1.80
|
||||||
#define QERAPP_GETDISPATCHPARAMS "QERApp_GetDispatchParams"
|
#define QERAPP_GETDISPATCHPARAMS "QERApp_GetDispatchParams"
|
||||||
|
|
||||||
|
|
7
install/.gitignore
vendored
Normal file
7
install/.gitignore
vendored
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
*.dll
|
||||||
|
*.pdb
|
||||||
|
*.exp
|
||||||
|
*.ilk
|
||||||
|
*.pdb
|
||||||
|
*.lib
|
||||||
|
*.exe
|
1
libs/.gitignore
vendored
Normal file
1
libs/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
x64
|
|
@ -38,7 +38,7 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
<PlatformToolset>v110_xp</PlatformToolset>
|
<PlatformToolset>v140</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
<ImportGroup Label="ExtensionSettings">
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
<PlatformToolset>v110_xp</PlatformToolset>
|
<PlatformToolset>v140</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
<ImportGroup Label="ExtensionSettings">
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
<PlatformToolset>v110_xp</PlatformToolset>
|
<PlatformToolset>v140</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
<ImportGroup Label="ExtensionSettings">
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
<PlatformToolset>v110_xp</PlatformToolset>
|
<PlatformToolset>v140</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
<ImportGroup Label="ExtensionSettings">
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
<PlatformToolset>v110_xp</PlatformToolset>
|
<PlatformToolset>v140</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
<ImportGroup Label="ExtensionSettings">
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
|
|
@ -1158,8 +1158,8 @@ int z_verbose = 0;
|
||||||
|
|
||||||
|
|
||||||
typedef uLong ( *check_func ) OF ( ( uLong check, const Byte * buf, uInt len ) );
|
typedef uLong ( *check_func ) OF ( ( uLong check, const Byte * buf, uInt len ) );
|
||||||
voidp zcalloc OF( ( voidp opaque, unsigned items, unsigned size ) );
|
static voidp zcalloc OF( ( voidp opaque, unsigned items, unsigned size ) );
|
||||||
void zcfree OF( ( voidp opaque, voidp ptr ) );
|
static void zcfree OF( ( voidp opaque, voidp ptr ) );
|
||||||
|
|
||||||
#define ZALLOC( strm, items, size ) \
|
#define ZALLOC( strm, items, size ) \
|
||||||
( *( ( strm )->zalloc ) )( ( strm )->opaque, ( items ), ( size ) )
|
( *( ( strm )->zalloc ) )( ( strm )->opaque, ( items ), ( size ) )
|
||||||
|
|
|
@ -105,6 +105,7 @@ struct picoSurface_s
|
||||||
int numVertexes, maxVertexes;
|
int numVertexes, maxVertexes;
|
||||||
picoVec3_t *xyz;
|
picoVec3_t *xyz;
|
||||||
picoVec3_t *normal;
|
picoVec3_t *normal;
|
||||||
|
picoIndex_t *smoothingGroup;
|
||||||
|
|
||||||
int numSTArrays, maxSTArrays;
|
int numSTArrays, maxSTArrays;
|
||||||
picoVec2_t **st;
|
picoVec2_t **st;
|
||||||
|
@ -216,6 +217,9 @@ const picoModule_t **PicoModuleList( int *numModules );
|
||||||
|
|
||||||
picoModel_t *PicoLoadModel( char *name, int frameNum );
|
picoModel_t *PicoLoadModel( char *name, int frameNum );
|
||||||
|
|
||||||
|
typedef size_t(*PicoInputStreamReadFunc)(void* inputStream, unsigned char* buffer, size_t length);
|
||||||
|
picoModel_t* PicoModuleLoadModelStream(const picoModule_t* module, void* inputStream, PicoInputStreamReadFunc inputStreamRead, size_t streamLength, int frameNum);
|
||||||
|
|
||||||
|
|
||||||
/* model functions */
|
/* model functions */
|
||||||
picoModel_t *PicoNewModel( void );
|
picoModel_t *PicoNewModel( void );
|
||||||
|
@ -330,12 +334,12 @@ picoVertexCombinationHash_t *PicoFindVertexCombinationInHashTable( picoVertexCom
|
||||||
picoVertexCombinationHash_t *PicoAddVertexCombinationToHashTable( picoVertexCombinationHash_t **hashTable, picoVec3_t xyz, picoVec3_t normal, picoVec3_t st, picoColor_t color, picoIndex_t index );
|
picoVertexCombinationHash_t *PicoAddVertexCombinationToHashTable( picoVertexCombinationHash_t **hashTable, picoVec3_t xyz, picoVec3_t normal, picoVec3_t st, picoColor_t color, picoIndex_t index );
|
||||||
|
|
||||||
/* specialized functions */
|
/* specialized functions */
|
||||||
int PicoFindSurfaceVertexNum( picoSurface_t *surface, picoVec3_t xyz, picoVec3_t normal, int numSTs, picoVec2_t *st, int numColors, picoColor_t *color );
|
int PicoFindSurfaceVertexNum( picoSurface_t *surface, picoVec3_t xyz, picoVec3_t normal, int numSTs, picoVec2_t *st, int numColors, picoColor_t *color, picoIndex_t smoothingGroup );
|
||||||
void PicoFixSurfaceNormals( picoSurface_t *surface );
|
void PicoFixSurfaceNormals( picoSurface_t *surface );
|
||||||
int PicoRemapModel( picoModel_t *model, char *remapFile );
|
int PicoRemapModel( picoModel_t *model, char *remapFile );
|
||||||
|
|
||||||
|
|
||||||
void PicoAddTriangleToModel( picoModel_t *model, picoVec3_t** xyz, picoVec3_t** normals, int numSTs, picoVec2_t **st, int numColors, picoColor_t **colors, picoShader_t* shader );
|
void PicoAddTriangleToModel( picoModel_t *model, picoVec3_t** xyz, picoVec3_t** normals, int numSTs, picoVec2_t **st, int numColors, picoColor_t **colors, picoShader_t* shader, picoIndex_t* smoothingGroup );
|
||||||
|
|
||||||
/* end marker */
|
/* end marker */
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -22,6 +22,35 @@ void lwFreeClip( lwClip *clip ){
|
||||||
if ( clip ) {
|
if ( clip ) {
|
||||||
lwListFree( (void*) clip->ifilter, (ListFreeFunc) lwFreePlugin );
|
lwListFree( (void*) clip->ifilter, (ListFreeFunc) lwFreePlugin );
|
||||||
lwListFree( (void*) clip->pfilter, (ListFreeFunc) lwFreePlugin );
|
lwListFree( (void*) clip->pfilter, (ListFreeFunc) lwFreePlugin );
|
||||||
|
|
||||||
|
switch ( clip->type ) {
|
||||||
|
case ID_STIL:
|
||||||
|
_pico_free( clip->source.still.name );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ID_ISEQ:
|
||||||
|
_pico_free( clip->source.seq.prefix );
|
||||||
|
_pico_free( clip->source.seq.suffix );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ID_ANIM:
|
||||||
|
_pico_free( clip->source.anim.name );
|
||||||
|
_pico_free( clip->source.anim.server );
|
||||||
|
_pico_free( clip->source.anim.data );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ID_XREF:
|
||||||
|
_pico_free( clip->source.xref.string );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ID_STCC:
|
||||||
|
_pico_free( clip->source.cycle.name );
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
_pico_free( clip );
|
_pico_free( clip );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -161,35 +161,23 @@ void *_pico_realloc( void **ptr, size_t oldSize, size_t newSize ){
|
||||||
* as custom clone size (the string is cropped to fit into mem
|
* as custom clone size (the string is cropped to fit into mem
|
||||||
* if needed). -sea
|
* if needed). -sea
|
||||||
*/
|
*/
|
||||||
char *_pico_clone_alloc( char *str, int size ){
|
char *_pico_clone_alloc( const char *str ) {
|
||||||
char* cloned;
|
char* cloned;
|
||||||
size_t cloneSize;
|
|
||||||
|
|
||||||
/* sanity check */
|
/* sanity check */
|
||||||
if ( str == NULL ) {
|
if ( str == NULL ) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set real size of cloned string */
|
|
||||||
cloneSize = ( size < 0 ) ? strlen( str ) : size;
|
|
||||||
|
|
||||||
/* allocate memory */
|
/* allocate memory */
|
||||||
cloned = _pico_alloc( cloneSize + 1 ); /* bugfix! */
|
cloned = _pico_alloc(strlen(str) + 1);
|
||||||
if ( cloned == NULL ) {
|
if ( cloned == NULL ) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* zero out memory allocated by cloned string */
|
|
||||||
memset( cloned,0,cloneSize );
|
|
||||||
|
|
||||||
/* copy input string to cloned string */
|
/* copy input string to cloned string */
|
||||||
if ( cloneSize < strlen( str ) ) {
|
|
||||||
memcpy( cloned,str,cloneSize );
|
|
||||||
cloned[ cloneSize ] = '\0';
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
strcpy(cloned, str);
|
strcpy(cloned, str);
|
||||||
}
|
|
||||||
/* return ptr to cloned string */
|
/* return ptr to cloned string */
|
||||||
return cloned;
|
return cloned;
|
||||||
}
|
}
|
||||||
|
@ -275,6 +263,19 @@ void _pico_printf( int level, const char *format, ... ){
|
||||||
_pico_ptr_print( level,str );
|
_pico_ptr_print( level,str );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* _pico_first_token:
|
||||||
|
* trims everything after the first whitespace-delimited token
|
||||||
|
*/
|
||||||
|
|
||||||
|
void _pico_first_token( char *str ) {
|
||||||
|
if ( !str || ! * str ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
while (*str && !isspace(*str))
|
||||||
|
*str++;
|
||||||
|
*str = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
/* _pico_strltrim:
|
/* _pico_strltrim:
|
||||||
* left trims the given string -sea
|
* left trims the given string -sea
|
||||||
*/
|
*/
|
||||||
|
@ -542,7 +543,7 @@ float _pico_big_float( float src ){
|
||||||
* case-insensitive strstr. -sea
|
* case-insensitive strstr. -sea
|
||||||
*/
|
*/
|
||||||
char *_pico_stristr( char *str, const char *substr ){
|
char *_pico_stristr( char *str, const char *substr ){
|
||||||
const int sublen = strlen( substr );
|
const size_t sublen = strlen( substr );
|
||||||
while ( *str )
|
while ( *str )
|
||||||
{
|
{
|
||||||
if ( !_pico_strnicmp( str,substr,sublen ) ) {
|
if ( !_pico_strnicmp( str,substr,sublen ) ) {
|
||||||
|
@ -604,24 +605,24 @@ int _pico_nofname( const char *path, char *dest, int destSize ){
|
||||||
* returns ptr to filename portion in given path or an empty
|
* returns ptr to filename portion in given path or an empty
|
||||||
* string otherwise. given 'path' is not altered. -sea
|
* string otherwise. given 'path' is not altered. -sea
|
||||||
*/
|
*/
|
||||||
char *_pico_nopath( const char *path ){
|
const char *_pico_nopath( const char *path ){
|
||||||
char *src;
|
const char *src;
|
||||||
src = (char *)path + ( strlen( path ) - 1 );
|
|
||||||
|
|
||||||
if ( path == NULL ) {
|
if ( path == NULL ) {
|
||||||
return (char *)"";
|
return "";
|
||||||
}
|
}
|
||||||
if ( !strchr( (char *)path,'/' ) && !strchr( (char *)path,'\\' ) ) {
|
if ( !strchr( path,'/' ) && !strchr( path,'\\' ) ) {
|
||||||
return ( (char *)path );
|
return ( path );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
src = path + ( strlen( path ) - 1 );
|
||||||
while ( ( src-- ) != path )
|
while ( ( src-- ) != path )
|
||||||
{
|
{
|
||||||
if ( *src == '/' || *src == '\\' ) {
|
if ( *src == '/' || *src == '\\' ) {
|
||||||
return ( ++src );
|
return ( ++src );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (char *)"";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
/* _pico_setfext:
|
/* _pico_setfext:
|
||||||
|
|
|
@ -116,7 +116,7 @@ extern void ( *_pico_ptr_print )( int, const char* );
|
||||||
void *_pico_alloc( size_t size );
|
void *_pico_alloc( size_t size );
|
||||||
void *_pico_calloc( size_t num, size_t size );
|
void *_pico_calloc( size_t num, size_t size );
|
||||||
void *_pico_realloc( void **ptr, size_t oldSize, size_t newSize );
|
void *_pico_realloc( void **ptr, size_t oldSize, size_t newSize );
|
||||||
char *_pico_clone_alloc( char *str, int size );
|
char *_pico_clone_alloc( const char *str );
|
||||||
void _pico_free( void *ptr );
|
void _pico_free( void *ptr );
|
||||||
|
|
||||||
/* files */
|
/* files */
|
||||||
|
@ -124,6 +124,7 @@ void _pico_load_file( char *name, unsigned char **buffer, int *bufSiz
|
||||||
void _pico_free_file( void *buffer );
|
void _pico_free_file( void *buffer );
|
||||||
|
|
||||||
/* strings */
|
/* strings */
|
||||||
|
void _pico_first_token(char *str);
|
||||||
char *_pico_strltrim( char *str );
|
char *_pico_strltrim( char *str );
|
||||||
char *_pico_strrtrim( char *str );
|
char *_pico_strrtrim( char *str );
|
||||||
int _pico_strchcount( char *str, int ch );
|
int _pico_strchcount( char *str, int ch );
|
||||||
|
|
|
@ -143,7 +143,46 @@ void PicoSetPrintFunc( void ( *func )( int, const char* ) ){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
picoModel_t *PicoModuleLoadModel( const picoModule_t* pm, char* fileName, picoByte_t* buffer, int bufSize, int frameNum ){
|
||||||
|
char *modelFileName, *remapFileName;
|
||||||
|
|
||||||
|
/* see whether this module can load the model file or not */
|
||||||
|
if ( pm->canload( fileName, buffer, bufSize ) == PICO_PMV_OK ) {
|
||||||
|
/* use loader provided by module to read the model data */
|
||||||
|
picoModel_t* model = pm->load( fileName, frameNum, buffer, bufSize );
|
||||||
|
if ( model == NULL ) {
|
||||||
|
_pico_free_file( buffer );
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* assign pointer to file format module */
|
||||||
|
model->module = pm;
|
||||||
|
|
||||||
|
/* get model file name */
|
||||||
|
modelFileName = PicoGetModelFileName( model );
|
||||||
|
|
||||||
|
/* apply model remappings from <model>.remap */
|
||||||
|
if ( strlen( modelFileName ) ) {
|
||||||
|
/* alloc copy of model file name */
|
||||||
|
remapFileName = _pico_alloc( strlen( modelFileName ) + 20 );
|
||||||
|
if ( remapFileName != NULL ) {
|
||||||
|
/* copy model file name and change extension */
|
||||||
|
strcpy( remapFileName, modelFileName );
|
||||||
|
_pico_setfext( remapFileName, "remap" );
|
||||||
|
|
||||||
|
/* try to remap model; we don't handle the result */
|
||||||
|
PicoRemapModel( model, remapFileName );
|
||||||
|
|
||||||
|
/* free the remap file name string */
|
||||||
|
_pico_free( remapFileName );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return model;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
PicoLoadModel()
|
PicoLoadModel()
|
||||||
|
@ -155,7 +194,6 @@ picoModel_t *PicoLoadModel( char *fileName, int frameNum ){
|
||||||
picoModel_t *model;
|
picoModel_t *model;
|
||||||
picoByte_t *buffer;
|
picoByte_t *buffer;
|
||||||
int bufSize;
|
int bufSize;
|
||||||
char *modelFileName, *remapFileName;
|
|
||||||
|
|
||||||
|
|
||||||
/* init */
|
/* init */
|
||||||
|
@ -194,38 +232,8 @@ picoModel_t *PicoLoadModel( char *fileName, int frameNum ){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* see whether this module can load the model file or not */
|
model = PicoModuleLoadModel( pm, fileName, buffer, bufSize, frameNum );
|
||||||
if ( pm->canload( fileName, buffer, bufSize ) == PICO_PMV_OK ) {
|
if ( model != NULL ) {
|
||||||
/* use loader provided by module to read the model data */
|
|
||||||
model = pm->load( fileName, frameNum, buffer, bufSize );
|
|
||||||
if ( model == NULL ) {
|
|
||||||
_pico_free_file( buffer );
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* assign pointer to file format module */
|
|
||||||
model->module = pm;
|
|
||||||
|
|
||||||
/* get model file name */
|
|
||||||
modelFileName = PicoGetModelFileName( model );
|
|
||||||
|
|
||||||
/* apply model remappings from <model>.remap */
|
|
||||||
if ( strlen( modelFileName ) ) {
|
|
||||||
/* alloc copy of model file name */
|
|
||||||
remapFileName = _pico_alloc( strlen( modelFileName ) + 20 );
|
|
||||||
if ( remapFileName != NULL ) {
|
|
||||||
/* copy model file name and change extension */
|
|
||||||
strcpy( remapFileName, modelFileName );
|
|
||||||
_pico_setfext( remapFileName, "remap" );
|
|
||||||
|
|
||||||
/* try to remap model; we don't handle the result */
|
|
||||||
PicoRemapModel( model, remapFileName );
|
|
||||||
|
|
||||||
/* free the remap file name string */
|
|
||||||
_pico_free( remapFileName );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* model was loaded, so break out of loop */
|
/* model was loaded, so break out of loop */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -236,7 +244,50 @@ picoModel_t *PicoLoadModel( char *fileName, int frameNum ){
|
||||||
_pico_free_file( buffer );
|
_pico_free_file( buffer );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* return */
|
return model;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
FIXME: From 1.5; Unused yet
|
||||||
|
*/
|
||||||
|
|
||||||
|
picoModel_t *PicoModuleLoadModelStream( const picoModule_t* module, void* inputStream, PicoInputStreamReadFunc inputStreamRead, size_t streamLength, int frameNum ) {
|
||||||
|
picoModel_t *model;
|
||||||
|
picoByte_t *buffer;
|
||||||
|
int bufSize;
|
||||||
|
|
||||||
|
/* init */
|
||||||
|
model = NULL;
|
||||||
|
|
||||||
|
if ( inputStream == NULL ) {
|
||||||
|
_pico_printf( PICO_ERROR, "PicoLoadModel: invalid input stream (inputStream == NULL)" );
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( inputStreamRead == NULL ) {
|
||||||
|
_pico_printf( PICO_ERROR, "PicoLoadModel: invalid input stream (inputStreamRead == NULL) ");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
buffer = _pico_alloc( streamLength + 1 );
|
||||||
|
|
||||||
|
bufSize = (int)inputStreamRead( inputStream, buffer, streamLength );
|
||||||
|
buffer[ bufSize ] = '\0';
|
||||||
|
|
||||||
|
{
|
||||||
|
// dummy filename
|
||||||
|
char fileName[128];
|
||||||
|
fileName[0] = '.';
|
||||||
|
strncpy( fileName + 1, module->defaultExts[ 0 ], 126 );
|
||||||
|
fileName[127] = '\0';
|
||||||
|
model = PicoModuleLoadModel( module, fileName, buffer, bufSize, frameNum );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* free memory used by file buffer */
|
||||||
|
if ( model != 0 ) {
|
||||||
|
_pico_free( buffer );
|
||||||
|
}
|
||||||
|
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -274,7 +325,6 @@ picoModel_t *PicoNewModel( void ){
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
PicoFreeModel()
|
PicoFreeModel()
|
||||||
frees a model and all associated data
|
frees a model and all associated data
|
||||||
|
@ -283,7 +333,6 @@ picoModel_t *PicoNewModel( void ){
|
||||||
void PicoFreeModel( picoModel_t *model ){
|
void PicoFreeModel( picoModel_t *model ){
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|
||||||
/* sanity check */
|
/* sanity check */
|
||||||
if ( model == NULL ) {
|
if ( model == NULL ) {
|
||||||
return;
|
return;
|
||||||
|
@ -294,6 +343,10 @@ void PicoFreeModel( picoModel_t *model ){
|
||||||
_pico_free( model->name );
|
_pico_free( model->name );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( model->fileName ) {
|
||||||
|
_pico_free( model->fileName );
|
||||||
|
}
|
||||||
|
|
||||||
/* free shaders */
|
/* free shaders */
|
||||||
for ( i = 0; i < model->numShaders; i++ )
|
for ( i = 0; i < model->numShaders; i++ )
|
||||||
PicoFreeShader( model->shader[ i ] );
|
PicoFreeShader( model->shader[ i ] );
|
||||||
|
@ -309,7 +362,6 @@ void PicoFreeModel( picoModel_t *model ){
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
PicoAdjustModel()
|
PicoAdjustModel()
|
||||||
adjusts a models's memory allocations to handle the requested sizes.
|
adjusts a models's memory allocations to handle the requested sizes.
|
||||||
|
@ -364,7 +416,6 @@ int PicoAdjustModel( picoModel_t *model, int numShaders, int numSurfaces ){
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------------
|
/* ----------------------------------------------------------------------------
|
||||||
shaders
|
shaders
|
||||||
---------------------------------------------------------------------------- */
|
---------------------------------------------------------------------------- */
|
||||||
|
@ -377,7 +428,6 @@ int PicoAdjustModel( picoModel_t *model, int numShaders, int numSurfaces ){
|
||||||
picoShader_t *PicoNewShader( picoModel_t *model ){
|
picoShader_t *PicoNewShader( picoModel_t *model ){
|
||||||
picoShader_t *shader;
|
picoShader_t *shader;
|
||||||
|
|
||||||
|
|
||||||
/* allocate and clear */
|
/* allocate and clear */
|
||||||
shader = _pico_alloc( sizeof( picoShader_t ) );
|
shader = _pico_alloc( sizeof( picoShader_t ) );
|
||||||
if ( shader == NULL ) {
|
if ( shader == NULL ) {
|
||||||
|
@ -410,7 +460,6 @@ picoShader_t *PicoNewShader( picoModel_t *model ){
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
PicoFreeShader()
|
PicoFreeShader()
|
||||||
frees a shader and all associated data -sea
|
frees a shader and all associated data -sea
|
||||||
|
@ -435,7 +484,6 @@ void PicoFreeShader( picoShader_t *shader ){
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
PicoFindShader()
|
PicoFindShader()
|
||||||
finds a named shader in a model
|
finds a named shader in a model
|
||||||
|
@ -444,7 +492,6 @@ void PicoFreeShader( picoShader_t *shader ){
|
||||||
picoShader_t *PicoFindShader( picoModel_t *model, char *name, int caseSensitive ){
|
picoShader_t *PicoFindShader( picoModel_t *model, char *name, int caseSensitive ){
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|
||||||
/* sanity checks */
|
/* sanity checks */
|
||||||
if ( model == NULL || name == NULL ) { /* sea: null name fix */
|
if ( model == NULL || name == NULL ) { /* sea: null name fix */
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -475,7 +522,6 @@ picoShader_t *PicoFindShader( picoModel_t *model, char *name, int caseSensitive
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------------
|
/* ----------------------------------------------------------------------------
|
||||||
surfaces
|
surfaces
|
||||||
---------------------------------------------------------------------------- */
|
---------------------------------------------------------------------------- */
|
||||||
|
@ -518,7 +564,6 @@ picoSurface_t *PicoNewSurface( picoModel_t *model ){
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
PicoFreeSurface()
|
PicoFreeSurface()
|
||||||
frees a surface and all associated data
|
frees a surface and all associated data
|
||||||
|
@ -526,7 +571,6 @@ picoSurface_t *PicoNewSurface( picoModel_t *model ){
|
||||||
void PicoFreeSurface( picoSurface_t *surface ){
|
void PicoFreeSurface( picoSurface_t *surface ){
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|
||||||
/* dummy check */
|
/* dummy check */
|
||||||
if ( surface == NULL ) {
|
if ( surface == NULL ) {
|
||||||
return;
|
return;
|
||||||
|
@ -535,9 +579,14 @@ void PicoFreeSurface( picoSurface_t *surface ){
|
||||||
/* free bits */
|
/* free bits */
|
||||||
_pico_free( surface->xyz );
|
_pico_free( surface->xyz );
|
||||||
_pico_free( surface->normal );
|
_pico_free( surface->normal );
|
||||||
|
_pico_free( surface->smoothingGroup );
|
||||||
_pico_free( surface->index );
|
_pico_free( surface->index );
|
||||||
_pico_free( surface->faceNormal );
|
_pico_free( surface->faceNormal );
|
||||||
|
|
||||||
|
if ( surface->name ) {
|
||||||
|
_pico_free( surface->name );
|
||||||
|
}
|
||||||
|
|
||||||
/* free arrays */
|
/* free arrays */
|
||||||
for ( i = 0; i < surface->numSTArrays; i++ )
|
for ( i = 0; i < surface->numSTArrays; i++ )
|
||||||
_pico_free( surface->st[ i ] );
|
_pico_free( surface->st[ i ] );
|
||||||
|
@ -551,7 +600,6 @@ void PicoFreeSurface( picoSurface_t *surface ){
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
PicoAdjustSurface()
|
PicoAdjustSurface()
|
||||||
adjusts a surface's memory allocations to handle the requested sizes.
|
adjusts a surface's memory allocations to handle the requested sizes.
|
||||||
|
@ -561,7 +609,6 @@ void PicoFreeSurface( picoSurface_t *surface ){
|
||||||
int PicoAdjustSurface( picoSurface_t *surface, int numVertexes, int numSTArrays, int numColorArrays, int numIndexes, int numFaceNormals ){
|
int PicoAdjustSurface( picoSurface_t *surface, int numVertexes, int numSTArrays, int numColorArrays, int numIndexes, int numFaceNormals ){
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|
||||||
/* dummy check */
|
/* dummy check */
|
||||||
if ( surface == NULL ) {
|
if ( surface == NULL ) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -591,6 +638,9 @@ int PicoAdjustSurface( picoSurface_t *surface, int numVertexes, int numSTArrays,
|
||||||
if ( !_pico_realloc( (void *) &surface->normal, surface->numVertexes * sizeof( *surface->normal ), surface->maxVertexes * sizeof( *surface->normal ) ) ) {
|
if ( !_pico_realloc( (void *) &surface->normal, surface->numVertexes * sizeof( *surface->normal ), surface->maxVertexes * sizeof( *surface->normal ) ) ) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
if ( !_pico_realloc( (void *) &surface->smoothingGroup, surface->numVertexes * sizeof( *surface->smoothingGroup ), surface->maxVertexes * sizeof( *surface->smoothingGroup ) ) ) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
for ( i = 0; i < surface->numSTArrays; i++ )
|
for ( i = 0; i < surface->numSTArrays; i++ )
|
||||||
if ( !_pico_realloc( (void*) &surface->st[ i ], surface->numVertexes * sizeof( *surface->st[ i ] ), surface->maxVertexes * sizeof( *surface->st[ i ] ) ) ) {
|
if ( !_pico_realloc( (void*) &surface->st[ i ], surface->numVertexes * sizeof( *surface->st[ i ] ), surface->maxVertexes * sizeof( *surface->st[ i ] ) ) ) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -720,7 +770,7 @@ void PicoSetModelName( picoModel_t *model, char *name ){
|
||||||
_pico_free( model->name );
|
_pico_free( model->name );
|
||||||
}
|
}
|
||||||
|
|
||||||
model->name = _pico_clone_alloc( name,-1 );
|
model->name = _pico_clone_alloc( name );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -733,7 +783,7 @@ void PicoSetModelFileName( picoModel_t *model, char *fileName ){
|
||||||
_pico_free( model->fileName );
|
_pico_free( model->fileName );
|
||||||
}
|
}
|
||||||
|
|
||||||
model->fileName = _pico_clone_alloc( fileName,-1 );
|
model->fileName = _pico_clone_alloc( fileName );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -773,7 +823,7 @@ void PicoSetShaderName( picoShader_t *shader, char *name ){
|
||||||
_pico_free( shader->name );
|
_pico_free( shader->name );
|
||||||
}
|
}
|
||||||
|
|
||||||
shader->name = _pico_clone_alloc( name,-1 );
|
shader->name = _pico_clone_alloc( name );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -786,7 +836,7 @@ void PicoSetShaderMapName( picoShader_t *shader, char *mapName ){
|
||||||
_pico_free( shader->mapName );
|
_pico_free( shader->mapName );
|
||||||
}
|
}
|
||||||
|
|
||||||
shader->mapName = _pico_clone_alloc( mapName,-1 );
|
shader->mapName = _pico_clone_alloc( mapName );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -887,7 +937,7 @@ void PicoSetSurfaceName( picoSurface_t *surface, char *name ){
|
||||||
_pico_free( surface->name );
|
_pico_free( surface->name );
|
||||||
}
|
}
|
||||||
|
|
||||||
surface->name = _pico_clone_alloc( name,-1 );
|
surface->name = _pico_clone_alloc( name );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -990,6 +1040,15 @@ void PicoSetFaceNormal( picoSurface_t *surface, int num, picoVec3_t normal ){
|
||||||
_pico_copy_vec( normal, surface->faceNormal[ num ] );
|
_pico_copy_vec( normal, surface->faceNormal[ num ] );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PicoSetSurfaceSmoothingGroup( picoSurface_t *surface, int num, picoIndex_t smoothingGroup ){
|
||||||
|
if ( num < 0 ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ( !PicoAdjustSurface( surface, num + 1, 0, 0, 0, 0 ) ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
surface->smoothingGroup[ num ] = smoothingGroup;
|
||||||
|
}
|
||||||
|
|
||||||
void PicoSetSurfaceSpecial( picoSurface_t *surface, int num, int special ){
|
void PicoSetSurfaceSpecial( picoSurface_t *surface, int num, int special ){
|
||||||
if ( surface == NULL || num < 0 || num >= PICO_MAX_SPECIAL ) {
|
if ( surface == NULL || num < 0 || num >= PICO_MAX_SPECIAL ) {
|
||||||
|
@ -1335,6 +1394,12 @@ picoVec_t *PicoGetFaceNormal( picoSurface_t *surface, int num ){
|
||||||
return surface->faceNormal[ num ];
|
return surface->faceNormal[ num ];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
picoIndex_t PicoGetSurfaceSmoothingGroup( picoSurface_t *surface, int num ){
|
||||||
|
if ( surface == NULL || num < 0 || num > surface->numVertexes ) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return surface->smoothingGroup[ num ];
|
||||||
|
}
|
||||||
|
|
||||||
int PicoGetSurfaceSpecial( picoSurface_t *surface, int num ){
|
int PicoGetSurfaceSpecial( picoSurface_t *surface, int num ){
|
||||||
if ( surface == NULL || num < 0 || num >= PICO_MAX_SPECIAL ) {
|
if ( surface == NULL || num < 0 || num >= PICO_MAX_SPECIAL ) {
|
||||||
|
@ -1535,7 +1600,7 @@ picoVertexCombinationHash_t *PicoAddVertexCombinationToHashTable( picoVertexComb
|
||||||
fixme: needs non-naive algorithm
|
fixme: needs non-naive algorithm
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int PicoFindSurfaceVertexNum( picoSurface_t *surface, picoVec3_t xyz, picoVec3_t normal, int numSTs, picoVec2_t *st, int numColors, picoColor_t *color ){
|
int PicoFindSurfaceVertexNum( picoSurface_t *surface, picoVec3_t xyz, picoVec3_t normal, int numSTs, picoVec2_t *st, int numColors, picoColor_t *color, picoIndex_t smoothingGroup ){
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
|
|
||||||
|
@ -1557,6 +1622,11 @@ int PicoFindSurfaceVertexNum( picoSurface_t *surface, picoVec3_t xyz, picoVec3_t
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* check normal */
|
||||||
|
if ( surface->smoothingGroup[ i ] != smoothingGroup ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
/* check st */
|
/* check st */
|
||||||
if ( numSTs > 0 && st != NULL ) {
|
if ( numSTs > 0 && st != NULL ) {
|
||||||
for ( j = 0; j < numSTs; j++ )
|
for ( j = 0; j < numSTs; j++ )
|
||||||
|
@ -1598,126 +1668,420 @@ int PicoFindSurfaceVertexNum( picoSurface_t *surface, picoVec3_t xyz, picoVec3_t
|
||||||
fixes broken normals (certain formats bork normals)
|
fixes broken normals (certain formats bork normals)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define MAX_NORMAL_VOTES 128
|
//#define MAX_NORMAL_VOTES 128
|
||||||
#define EQUAL_NORMAL_EPSILON 0.01
|
//#define EQUAL_NORMAL_EPSILON 0.01
|
||||||
#define BAD_NORMAL_EPSILON 0.5
|
//#define BAD_NORMAL_EPSILON 0.5
|
||||||
|
//
|
||||||
|
//void PicoFixSurfaceNormals( picoSurface_t *surface ){
|
||||||
|
// int i, j, k, a, b, c, numVotes, faceIndex;
|
||||||
|
// picoVec3_t votes[ MAX_NORMAL_VOTES ];
|
||||||
|
// picoVec3_t *normals, diff;
|
||||||
|
// picoVec4_t plane;
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// /* dummy check */
|
||||||
|
// if ( surface == NULL || surface->numVertexes == 0 ) {
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /* fixme: handle other surface types */
|
||||||
|
// if ( surface->type != PICO_TRIANGLES ) {
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /* allocate normal storage */
|
||||||
|
// normals = _pico_alloc( surface->numVertexes * sizeof( *normals ) );
|
||||||
|
// if ( normals == NULL ) {
|
||||||
|
// _pico_printf( PICO_ERROR, "PicoFixSurfaceNormals: Unable to allocate memory for temporary normal storage" );
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /* zero it out */
|
||||||
|
// memset( normals, 0, surface->numVertexes * sizeof( *normals ) );
|
||||||
|
//
|
||||||
|
// /* walk vertex list */
|
||||||
|
// for ( i = 0; i < surface->numVertexes; i++ )
|
||||||
|
// {
|
||||||
|
// /* zero out votes */
|
||||||
|
// numVotes = 0;
|
||||||
|
//
|
||||||
|
// /* find all the triangles that reference this vertex */
|
||||||
|
// for ( j = 0, faceIndex = 0; j < surface->numIndexes; j += 3, faceIndex++ )
|
||||||
|
// {
|
||||||
|
// /* get triangle */
|
||||||
|
// a = surface->index[ j ];
|
||||||
|
// b = surface->index[ j + 1 ];
|
||||||
|
// c = surface->index[ j + 2 ];
|
||||||
|
//
|
||||||
|
// /* ignore degenerate triangles */
|
||||||
|
// if ( a == b || b == c || c == a ) {
|
||||||
|
// continue;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /* ignore indexes out of range */
|
||||||
|
// if ( a < 0 || a >= surface->numVertexes ||
|
||||||
|
// b < 0 || b >= surface->numVertexes ||
|
||||||
|
// c < 0 || c >= surface->numVertexes ) {
|
||||||
|
// continue;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /* test triangle */
|
||||||
|
// if ( a == i || b == i || c == i ) {
|
||||||
|
// /* if this surface has face normals */
|
||||||
|
// if ( surface->numFaceNormals && faceIndex < surface->numFaceNormals ) {
|
||||||
|
// _pico_copy_vec( surface->faceNormal[ faceIndex ], plane );
|
||||||
|
// if ( plane[ 0 ] == 0.f && plane[ 1 ] == 0.f && plane[ 2 ] == 0.f ) {
|
||||||
|
// /* if null normal, make plane from the 3 points */
|
||||||
|
// if ( _pico_calc_plane( plane, surface->xyz[ a ], surface->xyz[ b ], surface->xyz[ c ] ) == 0 ) {
|
||||||
|
// continue;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// /* make a plane from the 3 points */
|
||||||
|
// else if ( _pico_calc_plane( plane, surface->xyz[ a ], surface->xyz[ b ], surface->xyz[ c ] ) == 0 ) {
|
||||||
|
// continue;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /* see if this normal has already been voted */
|
||||||
|
// for ( k = 0; k < numVotes; k++ )
|
||||||
|
// {
|
||||||
|
// _pico_subtract_vec( plane, votes[ k ], diff );
|
||||||
|
// if ( fabs( diff[ 0 ] ) < EQUAL_NORMAL_EPSILON &&
|
||||||
|
// fabs( diff[ 1 ] ) < EQUAL_NORMAL_EPSILON &&
|
||||||
|
// fabs( diff[ 2 ] ) < EQUAL_NORMAL_EPSILON ) {
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /* add a new vote? */
|
||||||
|
// if ( k == numVotes && numVotes < MAX_NORMAL_VOTES ) {
|
||||||
|
// _pico_copy_vec( plane, votes[ numVotes ] );
|
||||||
|
// numVotes++;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /* tally votes */
|
||||||
|
// if ( numVotes > 0 ) {
|
||||||
|
// /* create average normal */
|
||||||
|
// _pico_zero_vec( normals[ i ] );
|
||||||
|
// for ( k = 0; k < numVotes; k++ )
|
||||||
|
// _pico_add_vec( normals[ i ], votes[ k ], normals[ i ] );
|
||||||
|
//
|
||||||
|
// /* normalize it */
|
||||||
|
// if ( _pico_normalize_vec( normals[ i ] ) ) {
|
||||||
|
// /* test against actual normal */
|
||||||
|
// if ( fabs( _pico_dot_vec( normals[ i ], surface->normal[ i ] ) - 1 ) > BAD_NORMAL_EPSILON ) {
|
||||||
|
// //% printf( "Normal %8d: (%f %f %f) -> (%f %f %f)\n", i,
|
||||||
|
// //% surface->normal[ i ][ 0 ], surface->normal[ i ][ 1 ], surface->normal[ i ][ 2 ],
|
||||||
|
// //% normals[ i ][ 0 ], normals[ i ][ 1 ], normals[ i ][ 2 ] );
|
||||||
|
// _pico_copy_vec( normals[ i ], surface->normal[ i ] );
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /* free normal storage */
|
||||||
|
// _pico_free( normals );
|
||||||
|
//}
|
||||||
|
|
||||||
|
typedef struct _IndexArray IndexArray;
|
||||||
|
struct _IndexArray
|
||||||
|
{
|
||||||
|
picoIndex_t* data;
|
||||||
|
picoIndex_t* last;
|
||||||
|
};
|
||||||
|
|
||||||
|
void indexarray_push_back(IndexArray* self, picoIndex_t value) {
|
||||||
|
*self->last++ = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t indexarray_size(IndexArray* self) {
|
||||||
|
return self->last - self->data;
|
||||||
|
}
|
||||||
|
|
||||||
|
void indexarray_reserve(IndexArray* self, size_t size) {
|
||||||
|
self->data = self->last = _pico_calloc(size, sizeof(picoIndex_t));
|
||||||
|
}
|
||||||
|
|
||||||
|
void indexarray_clear(IndexArray* self) {
|
||||||
|
_pico_free(self->data);
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef struct _BinaryTreeNode BinaryTreeNode;
|
||||||
|
struct _BinaryTreeNode
|
||||||
|
{
|
||||||
|
picoIndex_t left;
|
||||||
|
picoIndex_t right;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct _BinaryTree BinaryTree;
|
||||||
|
struct _BinaryTree
|
||||||
|
{
|
||||||
|
BinaryTreeNode* data;
|
||||||
|
BinaryTreeNode* last;
|
||||||
|
};
|
||||||
|
|
||||||
|
void binarytree_extend(BinaryTree* self) {
|
||||||
|
self->last->left = 0;
|
||||||
|
self->last->right = 0;
|
||||||
|
++self->last;
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t binarytree_size(BinaryTree* self) {
|
||||||
|
return self->last - self->data;
|
||||||
|
}
|
||||||
|
|
||||||
|
void binarytree_reserve(BinaryTree* self, size_t size) {
|
||||||
|
self->data = self->last = _pico_calloc(size, sizeof(BinaryTreeNode));
|
||||||
|
}
|
||||||
|
|
||||||
|
void binarytree_clear(BinaryTree* self) {
|
||||||
|
_pico_free(self->data);
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef int(*LessFunc)(void*, picoIndex_t, picoIndex_t);
|
||||||
|
|
||||||
|
typedef struct _UniqueIndices UniqueIndices;
|
||||||
|
struct _UniqueIndices
|
||||||
|
{
|
||||||
|
BinaryTree tree;
|
||||||
|
IndexArray indices;
|
||||||
|
LessFunc lessFunc;
|
||||||
|
void* lessData;
|
||||||
|
};
|
||||||
|
|
||||||
|
size_t UniqueIndices_size(UniqueIndices* self) {
|
||||||
|
return binarytree_size(&self->tree);
|
||||||
|
}
|
||||||
|
|
||||||
|
void UniqueIndices_reserve(UniqueIndices* self, size_t size) {
|
||||||
|
binarytree_reserve(&self->tree, size);
|
||||||
|
indexarray_reserve(&self->indices, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
void UniqueIndices_init(UniqueIndices* self, LessFunc lessFunc, void* lessData) {
|
||||||
|
self->lessFunc = lessFunc;
|
||||||
|
self->lessData = lessData;
|
||||||
|
}
|
||||||
|
|
||||||
|
void UniqueIndices_destroy(UniqueIndices* self) {
|
||||||
|
binarytree_clear(&self->tree);
|
||||||
|
indexarray_clear(&self->indices);
|
||||||
|
}
|
||||||
|
|
||||||
|
picoIndex_t UniqueIndices_find_or_insert(UniqueIndices* self, picoIndex_t value) {
|
||||||
|
picoIndex_t index = 0;
|
||||||
|
|
||||||
|
for (;; )
|
||||||
|
{
|
||||||
|
if (self->lessFunc(self->lessData, value, self->indices.data[index])) {
|
||||||
|
BinaryTreeNode* node = self->tree.data + index;
|
||||||
|
if (node->left != 0) {
|
||||||
|
index = node->left;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
node->left = (picoIndex_t)binarytree_size(&self->tree);
|
||||||
|
binarytree_extend(&self->tree);
|
||||||
|
indexarray_push_back(&self->indices, value);
|
||||||
|
return node->left;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (self->lessFunc(self->lessData, self->indices.data[index], value)) {
|
||||||
|
BinaryTreeNode* node = self->tree.data + index;
|
||||||
|
if (node->right != 0) {
|
||||||
|
index = node->right;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
node->right = (picoIndex_t)binarytree_size(&self->tree);
|
||||||
|
binarytree_extend(&self->tree);
|
||||||
|
indexarray_push_back(&self->indices, value);
|
||||||
|
return node->right;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return index;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
picoIndex_t UniqueIndices_insert(UniqueIndices* self, picoIndex_t value) {
|
||||||
|
if (self->tree.data == self->tree.last) {
|
||||||
|
binarytree_extend(&self->tree);
|
||||||
|
indexarray_push_back(&self->indices, value);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return UniqueIndices_find_or_insert(self, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef struct picoSmoothVertices_s picoSmoothVertices_t;
|
||||||
|
struct picoSmoothVertices_s
|
||||||
|
{
|
||||||
|
picoVec3_t* xyz;
|
||||||
|
picoIndex_t* smoothingGroups;
|
||||||
|
};
|
||||||
|
|
||||||
|
int lessSmoothVertex(void* data, picoIndex_t first, picoIndex_t second) {
|
||||||
|
picoSmoothVertices_t* smoothVertices = data;
|
||||||
|
|
||||||
|
if (smoothVertices->xyz[first][0] != smoothVertices->xyz[second][0]) {
|
||||||
|
return smoothVertices->xyz[first][0] < smoothVertices->xyz[second][0];
|
||||||
|
}
|
||||||
|
if (smoothVertices->xyz[first][1] != smoothVertices->xyz[second][1]) {
|
||||||
|
return smoothVertices->xyz[first][1] < smoothVertices->xyz[second][1];
|
||||||
|
}
|
||||||
|
if (smoothVertices->xyz[first][2] != smoothVertices->xyz[second][2]) {
|
||||||
|
return smoothVertices->xyz[first][2] < smoothVertices->xyz[second][2];
|
||||||
|
}
|
||||||
|
if (smoothVertices->smoothingGroups[first] != smoothVertices->smoothingGroups[second]) {
|
||||||
|
return smoothVertices->smoothingGroups[first] < smoothVertices->smoothingGroups[second];
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void _pico_vertices_combine_shared_normals(picoVec3_t* xyz, picoIndex_t* smoothingGroups, picoVec3_t* normals, picoIndex_t numVertices) {
|
||||||
|
UniqueIndices vertices;
|
||||||
|
IndexArray indices;
|
||||||
|
picoSmoothVertices_t smoothVertices = { xyz, smoothingGroups };
|
||||||
|
UniqueIndices_init(&vertices, lessSmoothVertex, &smoothVertices);
|
||||||
|
UniqueIndices_reserve(&vertices, numVertices);
|
||||||
|
indexarray_reserve(&indices, numVertices);
|
||||||
|
|
||||||
|
{
|
||||||
|
picoIndex_t i = 0;
|
||||||
|
for (; i < numVertices; ++i)
|
||||||
|
{
|
||||||
|
size_t size = UniqueIndices_size(&vertices);
|
||||||
|
picoIndex_t index = UniqueIndices_insert(&vertices, i);
|
||||||
|
if ((size_t)index != size) {
|
||||||
|
float* normal = normals[vertices.indices.data[index]];
|
||||||
|
_pico_add_vec(normal, normals[i], normal);
|
||||||
|
}
|
||||||
|
indexarray_push_back(&indices, index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
picoIndex_t maxIndex = 0;
|
||||||
|
picoIndex_t* i = indices.data;
|
||||||
|
for (; i != indices.last; ++i)
|
||||||
|
{
|
||||||
|
if (*i <= maxIndex) {
|
||||||
|
_pico_copy_vec(normals[vertices.indices.data[*i]], normals[i - indices.data]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
maxIndex = *i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
UniqueIndices_destroy(&vertices);
|
||||||
|
indexarray_clear(&indices);
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef picoVec3_t* picoNormalIter_t;
|
||||||
|
typedef picoIndex_t* picoIndexIter_t;
|
||||||
|
|
||||||
|
#define THE_CROSSPRODUCTS_OF_ANY_PAIR_OF_EDGES_OF_A_GIVEN_TRIANGLE_ARE_EQUAL 1
|
||||||
|
|
||||||
|
void _pico_triangles_generate_weighted_normals(picoIndexIter_t first, picoIndexIter_t end, picoVec3_t* xyz, picoVec3_t* normals) {
|
||||||
|
for (; first != end; first += 3)
|
||||||
|
{
|
||||||
|
#if (THE_CROSSPRODUCTS_OF_ANY_PAIR_OF_EDGES_OF_A_GIVEN_TRIANGLE_ARE_EQUAL)
|
||||||
|
picoVec3_t weightedNormal;
|
||||||
|
{
|
||||||
|
float* a = xyz[*(first + 0)];
|
||||||
|
float* b = xyz[*(first + 1)];
|
||||||
|
float* c = xyz[*(first + 2)];
|
||||||
|
picoVec3_t ba, ca;
|
||||||
|
_pico_subtract_vec(b, a, ba);
|
||||||
|
_pico_subtract_vec(c, a, ca);
|
||||||
|
_pico_cross_vec(ca, ba, weightedNormal);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
int j = 0;
|
||||||
|
for (; j < 3; ++j)
|
||||||
|
{
|
||||||
|
float* normal = normals[*(first + j)];
|
||||||
|
#if ( !THE_CROSSPRODUCTS_OF_ANY_PAIR_OF_EDGES_OF_A_GIVEN_TRIANGLE_ARE_EQUAL )
|
||||||
|
picoVec3_t weightedNormal;
|
||||||
|
{
|
||||||
|
float* a = xyz[*(first + ((j + 0) % 3))];
|
||||||
|
float* b = xyz[*(first + ((j + 1) % 3))];
|
||||||
|
float* c = xyz[*(first + ((j + 2) % 3))];
|
||||||
|
picoVec3_t ba, ca;
|
||||||
|
_pico_subtract_vec(b, a, ba);
|
||||||
|
_pico_subtract_vec(c, a, ca);
|
||||||
|
_pico_cross_vec(ca, ba, weightedNormal);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
_pico_add_vec(weightedNormal, normal, normal);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void _pico_normals_zero(picoNormalIter_t first, picoNormalIter_t last) {
|
||||||
|
for (; first != last; ++first)
|
||||||
|
{
|
||||||
|
_pico_zero_vec(*first);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void _pico_normals_normalize(picoNormalIter_t first, picoNormalIter_t last) {
|
||||||
|
for (; first != last; ++first)
|
||||||
|
{
|
||||||
|
_pico_normalize_vec(*first);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
double _pico_length_vec(picoVec3_t vec) {
|
||||||
|
return sqrt(vec[0] * vec[0] + vec[1] * vec[1] + vec[2] * vec[2]);
|
||||||
|
}
|
||||||
|
|
||||||
|
#define NORMAL_UNIT_LENGTH_EPSILON 0.01
|
||||||
|
#define FLOAT_EQUAL_EPSILON( f, other, epsilon ) ( fabs( f - other ) < epsilon )
|
||||||
|
|
||||||
|
int _pico_normal_is_unit_length(picoVec3_t normal) {
|
||||||
|
return FLOAT_EQUAL_EPSILON(_pico_length_vec(normal), 1.0, NORMAL_UNIT_LENGTH_EPSILON);
|
||||||
|
}
|
||||||
|
|
||||||
|
int _pico_normal_within_tolerance(picoVec3_t normal, picoVec3_t other) {
|
||||||
|
return _pico_dot_vec(normal, other) > 0.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
void _pico_normals_assign_generated_normals(picoNormalIter_t first, picoNormalIter_t last, picoNormalIter_t generated) {
|
||||||
|
for (; first != last; ++first, ++generated)
|
||||||
|
{
|
||||||
|
if (!_pico_normal_is_unit_length(*first) || !_pico_normal_within_tolerance(*first, *generated)) {
|
||||||
|
_pico_copy_vec(*generated, *first);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void PicoFixSurfaceNormals(picoSurface_t* surface) {
|
void PicoFixSurfaceNormals(picoSurface_t* surface) {
|
||||||
int i, j, k, a, b, c, numVotes, faceIndex;
|
picoVec3_t* normals = (picoVec3_t*)_pico_calloc(surface->numVertexes, sizeof(picoVec3_t));
|
||||||
picoVec3_t votes[ MAX_NORMAL_VOTES ];
|
|
||||||
picoVec3_t *normals, diff;
|
|
||||||
picoVec4_t plane;
|
|
||||||
|
|
||||||
|
_pico_normals_zero(normals, normals + surface->numVertexes);
|
||||||
|
|
||||||
/* dummy check */
|
_pico_triangles_generate_weighted_normals(surface->index, surface->index + surface->numIndexes, surface->xyz, normals);
|
||||||
if ( surface == NULL || surface->numVertexes == 0 ) {
|
_pico_vertices_combine_shared_normals(surface->xyz, surface->smoothingGroup, normals, surface->numVertexes);
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* fixme: handle other surface types */
|
_pico_normals_normalize(normals, normals + surface->numVertexes);
|
||||||
if ( surface->type != PICO_TRIANGLES ) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* allocate normal storage */
|
_pico_normals_assign_generated_normals(surface->normal, surface->normal + surface->numVertexes, normals);
|
||||||
normals = _pico_alloc( surface->numVertexes * sizeof( *normals ) );
|
|
||||||
if ( normals == NULL ) {
|
|
||||||
_pico_printf( PICO_ERROR, "PicoFixSurfaceNormals: Unable to allocate memory for temporary normal storage" );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* zero it out */
|
|
||||||
memset( normals, 0, surface->numVertexes * sizeof( *normals ) );
|
|
||||||
|
|
||||||
/* walk vertex list */
|
|
||||||
for ( i = 0; i < surface->numVertexes; i++ )
|
|
||||||
{
|
|
||||||
/* zero out votes */
|
|
||||||
numVotes = 0;
|
|
||||||
|
|
||||||
/* find all the triangles that reference this vertex */
|
|
||||||
for ( j = 0, faceIndex = 0; j < surface->numIndexes; j += 3, faceIndex++ )
|
|
||||||
{
|
|
||||||
/* get triangle */
|
|
||||||
a = surface->index[ j ];
|
|
||||||
b = surface->index[ j + 1 ];
|
|
||||||
c = surface->index[ j + 2 ];
|
|
||||||
|
|
||||||
/* ignore degenerate triangles */
|
|
||||||
if ( a == b || b == c || c == a ) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ignore indexes out of range */
|
|
||||||
if ( a < 0 || a >= surface->numVertexes ||
|
|
||||||
b < 0 || b >= surface->numVertexes ||
|
|
||||||
c < 0 || c >= surface->numVertexes ) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* test triangle */
|
|
||||||
if ( a == i || b == i || c == i ) {
|
|
||||||
/* if this surface has face normals */
|
|
||||||
if ( surface->numFaceNormals && faceIndex < surface->numFaceNormals ) {
|
|
||||||
_pico_copy_vec( surface->faceNormal[ faceIndex ], plane );
|
|
||||||
if ( plane[ 0 ] == 0.f && plane[ 1 ] == 0.f && plane[ 2 ] == 0.f ) {
|
|
||||||
/* if null normal, make plane from the 3 points */
|
|
||||||
if ( _pico_calc_plane( plane, surface->xyz[ a ], surface->xyz[ b ], surface->xyz[ c ] ) == 0 ) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* make a plane from the 3 points */
|
|
||||||
else if ( _pico_calc_plane( plane, surface->xyz[ a ], surface->xyz[ b ], surface->xyz[ c ] ) == 0 ) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* see if this normal has already been voted */
|
|
||||||
for ( k = 0; k < numVotes; k++ )
|
|
||||||
{
|
|
||||||
_pico_subtract_vec( plane, votes[ k ], diff );
|
|
||||||
if ( fabs( diff[ 0 ] ) < EQUAL_NORMAL_EPSILON &&
|
|
||||||
fabs( diff[ 1 ] ) < EQUAL_NORMAL_EPSILON &&
|
|
||||||
fabs( diff[ 2 ] ) < EQUAL_NORMAL_EPSILON ) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* add a new vote? */
|
|
||||||
if ( k == numVotes && numVotes < MAX_NORMAL_VOTES ) {
|
|
||||||
_pico_copy_vec( plane, votes[ numVotes ] );
|
|
||||||
numVotes++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* tally votes */
|
|
||||||
if ( numVotes > 0 ) {
|
|
||||||
/* create average normal */
|
|
||||||
_pico_zero_vec( normals[ i ] );
|
|
||||||
for ( k = 0; k < numVotes; k++ )
|
|
||||||
_pico_add_vec( normals[ i ], votes[ k ], normals[ i ] );
|
|
||||||
|
|
||||||
/* normalize it */
|
|
||||||
if ( _pico_normalize_vec( normals[ i ] ) ) {
|
|
||||||
/* test against actual normal */
|
|
||||||
if ( fabs( _pico_dot_vec( normals[ i ], surface->normal[ i ] ) - 1 ) > BAD_NORMAL_EPSILON ) {
|
|
||||||
//% printf( "Normal %8d: (%f %f %f) -> (%f %f %f)\n", i,
|
|
||||||
//% surface->normal[ i ][ 0 ], surface->normal[ i ][ 1 ], surface->normal[ i ][ 2 ],
|
|
||||||
//% normals[ i ][ 0 ], normals[ i ][ 1 ], normals[ i ][ 2 ] );
|
|
||||||
_pico_copy_vec( normals[ i ], surface->normal[ i ] );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* free normal storage */
|
|
||||||
_pico_free(normals);
|
_pico_free(normals);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
PicoRemapModel() - sea
|
PicoRemapModel() - sea
|
||||||
remaps model material/etc. information using the remappings
|
remaps model material/etc. information using the remappings
|
||||||
|
@ -1791,7 +2155,6 @@ int PicoRemapModel( picoModel_t *model, char *remapFile ){
|
||||||
picoShader_t *shader;
|
picoShader_t *shader;
|
||||||
char *materialName;
|
char *materialName;
|
||||||
|
|
||||||
|
|
||||||
/* get material name */
|
/* get material name */
|
||||||
if ( _pico_parse( p, 1 ) == NULL ) {
|
if ( _pico_parse( p, 1 ) == NULL ) {
|
||||||
break;
|
break;
|
||||||
|
@ -1799,7 +2162,7 @@ int PicoRemapModel( picoModel_t *model, char *remapFile ){
|
||||||
if ( !strlen( p->token ) ) {
|
if ( !strlen( p->token ) ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
materialName = _pico_clone_alloc( p->token,-1 );
|
materialName = _pico_clone_alloc( p->token );
|
||||||
if ( materialName == NULL ) {
|
if ( materialName == NULL ) {
|
||||||
_prm_error_return;
|
_prm_error_return;
|
||||||
}
|
}
|
||||||
|
@ -1857,7 +2220,7 @@ int PicoRemapModel( picoModel_t *model, char *remapFile ){
|
||||||
}
|
}
|
||||||
|
|
||||||
/* temporary copy of material name */
|
/* temporary copy of material name */
|
||||||
tempMaterialName = _pico_clone_alloc( p->token,-1 );
|
tempMaterialName = _pico_clone_alloc( p->token );
|
||||||
if ( tempMaterialName == NULL ) {
|
if ( tempMaterialName == NULL ) {
|
||||||
_prm_error_return;
|
_prm_error_return;
|
||||||
}
|
}
|
||||||
|
@ -2002,7 +2365,7 @@ int PicoRemapModel( picoModel_t *model, char *remapFile ){
|
||||||
|
|
||||||
void PicoAddTriangleToModel( picoModel_t *model, picoVec3_t** xyz, picoVec3_t** normals,
|
void PicoAddTriangleToModel( picoModel_t *model, picoVec3_t** xyz, picoVec3_t** normals,
|
||||||
int numSTs, picoVec2_t **st, int numColors, picoColor_t **colors,
|
int numSTs, picoVec2_t **st, int numColors, picoColor_t **colors,
|
||||||
picoShader_t* shader ){
|
picoShader_t* shader, picoIndex_t* smoothingGroup ){
|
||||||
int i, j;
|
int i, j;
|
||||||
int vertDataIndex;
|
int vertDataIndex;
|
||||||
picoSurface_t* workSurface = NULL;
|
picoSurface_t* workSurface = NULL;
|
||||||
|
@ -2038,7 +2401,7 @@ void PicoAddTriangleToModel( picoModel_t *model, picoVec3_t** xyz, picoVec3_t**
|
||||||
int newVertIndex = PicoGetSurfaceNumIndexes( workSurface );
|
int newVertIndex = PicoGetSurfaceNumIndexes( workSurface );
|
||||||
|
|
||||||
/* get the index of the vertex that we're going to store at newVertIndex */
|
/* get the index of the vertex that we're going to store at newVertIndex */
|
||||||
vertDataIndex = PicoFindSurfaceVertexNum( workSurface, *xyz[i], *normals[i], numSTs, st[i], numColors, colors[i] );
|
vertDataIndex = PicoFindSurfaceVertexNum( workSurface, *xyz[i], *normals[i], numSTs, st[i], numColors, colors[i], smoothingGroup[i] );
|
||||||
|
|
||||||
/* the vertex wasn't found, so create a new vertex in the pool from the data we have */
|
/* the vertex wasn't found, so create a new vertex in the pool from the data we have */
|
||||||
if ( vertDataIndex == -1 ) {
|
if ( vertDataIndex == -1 ) {
|
||||||
|
@ -2058,6 +2421,8 @@ void PicoAddTriangleToModel( picoModel_t *model, picoVec3_t** xyz, picoVec3_t**
|
||||||
{
|
{
|
||||||
PicoSetSurfaceST( workSurface, j, vertDataIndex, st[i][j] );
|
PicoSetSurfaceST( workSurface, j, vertDataIndex, st[i][j] );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PicoSetSurfaceSmoothingGroup( workSurface, vertDataIndex, smoothingGroup[ i ] );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* add this vertex to the triangle */
|
/* add this vertex to the triangle */
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
<PlatformToolset>v110_xp</PlatformToolset>
|
<PlatformToolset>v140</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
<ImportGroup Label="ExtensionSettings">
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
|
|
@ -54,6 +54,7 @@ extern const picoModule_t picoModuleMDC;
|
||||||
extern const picoModule_t picoModuleMD2;
|
extern const picoModule_t picoModuleMD2;
|
||||||
extern const picoModule_t picoModuleFM;
|
extern const picoModule_t picoModuleFM;
|
||||||
extern const picoModule_t picoModuleLWO;
|
extern const picoModule_t picoModuleLWO;
|
||||||
|
extern const picoModule_t picoModuleTerrain;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -68,6 +69,7 @@ const picoModule_t *picoModules[] =
|
||||||
&picoModuleMD2, /* quake2 md2 */
|
&picoModuleMD2, /* quake2 md2 */
|
||||||
&picoModuleFM, /* heretic2 fm */
|
&picoModuleFM, /* heretic2 fm */
|
||||||
&picoModuleLWO, /* lightwave object */
|
&picoModuleLWO, /* lightwave object */
|
||||||
|
&picoModuleTerrain, /* picoterrain object */
|
||||||
&picoModuleOBJ, /* wavefront object */
|
&picoModuleOBJ, /* wavefront object */
|
||||||
NULL /* arnold */
|
NULL /* arnold */
|
||||||
};
|
};
|
||||||
|
|
|
@ -397,6 +397,9 @@ static int GetMeshShader( T3dsLoaderPers *pers ){
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ydnar: trim to first whitespace */
|
||||||
|
_pico_first_token( shaderName );
|
||||||
|
|
||||||
/* now that we have the shader name we need to go through all of */
|
/* now that we have the shader name we need to go through all of */
|
||||||
/* the shaders and check the name against each shader. when we */
|
/* the shaders and check the name against each shader. when we */
|
||||||
/* find a shader in our shader list that matches this name we */
|
/* find a shader in our shader list that matches this name we */
|
||||||
|
@ -418,7 +421,7 @@ static int GetMeshShader( T3dsLoaderPers *pers ){
|
||||||
/* we have a valid map name ptr */
|
/* we have a valid map name ptr */
|
||||||
if ( mapNamePtr != NULL ) {
|
if ( mapNamePtr != NULL ) {
|
||||||
char temp[128];
|
char temp[128];
|
||||||
char *name;
|
const char *name;
|
||||||
|
|
||||||
/* copy map name to local buffer */
|
/* copy map name to local buffer */
|
||||||
strcpy( mapName,mapNamePtr );
|
strcpy( mapName,mapNamePtr );
|
||||||
|
@ -523,7 +526,6 @@ static int DoNextEditorDataChunk( T3dsLoaderPers *pers, long endofs ){
|
||||||
/* read in surface name */
|
/* read in surface name */
|
||||||
if ( !GetASCIIZ( pers,surfaceName,sizeof( surfaceName ) ) ) {
|
if ( !GetASCIIZ( pers,surfaceName,sizeof( surfaceName ) ) ) {
|
||||||
return 0; /* this is bad */
|
return 0; /* this is bad */
|
||||||
|
|
||||||
}
|
}
|
||||||
//PicoGetSurfaceName
|
//PicoGetSurfaceName
|
||||||
/* ignore NULL name surfaces */
|
/* ignore NULL name surfaces */
|
||||||
|
@ -606,10 +608,13 @@ static int DoNextEditorDataChunk( T3dsLoaderPers *pers, long endofs ){
|
||||||
/* but for now we skip the new material's name ... */
|
/* but for now we skip the new material's name ... */
|
||||||
if ( pers->shader ) {
|
if ( pers->shader ) {
|
||||||
char *name = (char *)( pers->bufptr + pers->cofs );
|
char *name = (char *)( pers->bufptr + pers->cofs );
|
||||||
PicoSetShaderName( pers->shader,name );
|
char *cleanedName = _pico_clone_alloc( name );
|
||||||
|
_pico_first_token( cleanedName );
|
||||||
|
PicoSetShaderName( pers->shader, cleanedName );
|
||||||
#ifdef DEBUG_PM_3DS
|
#ifdef DEBUG_PM_3DS
|
||||||
printf( "NewShader: '%s'\n",name );
|
printf( "NewShader: '%s'\n", cleanedName );
|
||||||
#endif
|
#endif
|
||||||
|
_pico_free( cleanedName );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( chunk->id == CHUNK_MATDIFFUSE ) {
|
if ( chunk->id == CHUNK_MATDIFFUSE ) {
|
||||||
|
|
|
@ -105,6 +105,25 @@ static aseSubMaterial_t* _ase_get_submaterial( aseMaterial_t* list, int mtlIdPar
|
||||||
return subMtl;
|
return subMtl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
aseSubMaterial_t* _ase_get_submaterial_or_default( aseMaterial_t* materials, int mtlIdParent, int subMtlId ){
|
||||||
|
aseSubMaterial_t* subMtl = _ase_get_submaterial( materials, mtlIdParent, subMtlId );
|
||||||
|
if ( subMtl != NULL ) {
|
||||||
|
return subMtl;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ydnar: trying default submaterial */
|
||||||
|
subMtl = _ase_get_submaterial( materials, mtlIdParent, 0 );
|
||||||
|
if ( subMtl != NULL ) {
|
||||||
|
return subMtl;
|
||||||
|
}
|
||||||
|
|
||||||
|
_pico_printf( PICO_ERROR, "Could not find material/submaterial for id %d/%d\n", mtlIdParent, subMtlId );
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static aseMaterial_t* _ase_add_material( aseMaterial_t **list, int mtlIdParent ){
|
static aseMaterial_t* _ase_add_material( aseMaterial_t **list, int mtlIdParent ){
|
||||||
aseMaterial_t *mtl = _pico_calloc( 1, sizeof( aseMaterial_t ) );
|
aseMaterial_t *mtl = _pico_calloc( 1, sizeof( aseMaterial_t ) );
|
||||||
mtl->mtlId = mtlIdParent;
|
mtl->mtlId = mtlIdParent;
|
||||||
|
@ -173,64 +192,6 @@ static void _ase_print_materials( aseMaterial_t *list ){
|
||||||
}
|
}
|
||||||
#endif //DEBUG_PM_ASE
|
#endif //DEBUG_PM_ASE
|
||||||
|
|
||||||
/* ASE Face management */
|
|
||||||
/* These are used to keep an association between a submaterial and a face definition */
|
|
||||||
/* They are kept in parallel with the current picoSurface, */
|
|
||||||
/* and are used by _ase_submit_triangles to lookup the proper material/submaterial IDs */
|
|
||||||
typedef struct aseFace_s
|
|
||||||
{
|
|
||||||
struct aseFace_s* next;
|
|
||||||
int mtlId;
|
|
||||||
int subMtlId;
|
|
||||||
int index[9];
|
|
||||||
} aseFace_t;
|
|
||||||
|
|
||||||
/* ASE Face management functions */
|
|
||||||
void _ase_add_face( aseFace_t **list, aseFace_t **tail, aseFace_t *newFace ){
|
|
||||||
/* insert as head of list */
|
|
||||||
if ( !( *list ) ) {
|
|
||||||
*list = newFace;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
( *tail )->next = newFace;
|
|
||||||
}
|
|
||||||
|
|
||||||
*tail = newFace;
|
|
||||||
newFace->next = NULL;
|
|
||||||
|
|
||||||
//tag the color indices so we can detect them and apply the default color to them
|
|
||||||
newFace->index[6] = -1;
|
|
||||||
newFace->index[7] = -1;
|
|
||||||
newFace->index[8] = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
aseFace_t* _ase_get_face_for_index( aseFace_t *list, int index ){
|
|
||||||
int counter = 0;
|
|
||||||
aseFace_t* face = list;
|
|
||||||
|
|
||||||
while ( counter < index )
|
|
||||||
{
|
|
||||||
face = face->next;
|
|
||||||
counter++;
|
|
||||||
}
|
|
||||||
return face;
|
|
||||||
}
|
|
||||||
static void _ase_free_faces( aseFace_t** list, aseFace_t** tail ){
|
|
||||||
aseFace_t* face = *list;
|
|
||||||
aseFace_t* tempFace = NULL;
|
|
||||||
|
|
||||||
while ( face )
|
|
||||||
{
|
|
||||||
tempFace = face->next;
|
|
||||||
_pico_free( face );
|
|
||||||
face = tempFace;
|
|
||||||
}
|
|
||||||
|
|
||||||
( *list ) = NULL;
|
|
||||||
( *tail ) = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* todo:
|
/* todo:
|
||||||
* - apply material specific uv offsets to uv coordinates
|
* - apply material specific uv offsets to uv coordinates
|
||||||
*/
|
*/
|
||||||
|
@ -274,7 +235,65 @@ static int _ase_canload( PM_PARAMS_CANLOAD ){
|
||||||
return PICO_PMV_OK;
|
return PICO_PMV_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
typedef struct aseVertex_s aseVertex_t;
|
||||||
|
struct aseVertex_s
|
||||||
|
{
|
||||||
|
picoVec3_t xyz;
|
||||||
|
picoVec3_t normal;
|
||||||
|
picoIndex_t id;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct aseTexCoord_s aseTexCoord_t;
|
||||||
|
struct aseTexCoord_s
|
||||||
|
{
|
||||||
|
picoVec2_t texcoord;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct aseColor_s aseColor_t;
|
||||||
|
struct aseColor_s
|
||||||
|
{
|
||||||
|
picoColor_t color;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct aseFace_s aseFace_t;
|
||||||
|
struct aseFace_s
|
||||||
|
{
|
||||||
|
picoIndex_t indices[9];
|
||||||
|
picoIndex_t smoothingGroup;
|
||||||
|
picoIndex_t materialId;
|
||||||
|
picoIndex_t subMaterialId;
|
||||||
|
};
|
||||||
|
typedef aseFace_t* aseFacesIter_t;
|
||||||
|
|
||||||
|
picoSurface_t* PicoModelFindOrAddSurface( picoModel_t *model, picoShader_t* shader ){
|
||||||
|
/* see if a surface already has the shader */
|
||||||
|
int i = 0;
|
||||||
|
for ( ; i < model->numSurfaces ; i++ )
|
||||||
|
{
|
||||||
|
picoSurface_t* workSurface = model->surface[i];
|
||||||
|
if ( workSurface->shader == shader ) {
|
||||||
|
return workSurface;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* no surface uses this shader yet, so create a new surface */
|
||||||
|
|
||||||
|
{
|
||||||
|
/* create a new surface in the model for the unique shader */
|
||||||
|
picoSurface_t* workSurface = PicoNewSurface( model );
|
||||||
|
if ( !workSurface ) {
|
||||||
|
_pico_printf( PICO_ERROR, "Could not allocate a new surface!\n" );
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* do surface setup */
|
||||||
|
PicoSetSurfaceType( workSurface, PICO_TRIANGLES );
|
||||||
|
PicoSetSurfaceName( workSurface, shader->name );
|
||||||
|
PicoSetSurfaceShader( workSurface, shader );
|
||||||
|
|
||||||
|
return workSurface;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* _ase_submit_triangles - jhefty
|
/* _ase_submit_triangles - jhefty
|
||||||
use the surface and the current face list to look up material/submaterial IDs
|
use the surface and the current face list to look up material/submaterial IDs
|
||||||
|
@ -286,65 +305,199 @@ static int _ase_canload( PM_PARAMS_CANLOAD ){
|
||||||
indexes 6 7 8 = color indexes (new)
|
indexes 6 7 8 = color indexes (new)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void _ase_submit_triangles( picoSurface_t* surface, picoModel_t* model, aseMaterial_t* materials, aseFace_t* faces ){
|
#if 0
|
||||||
aseFace_t* face;
|
typedef picoIndex_t* picoIndexIter_t;
|
||||||
aseSubMaterial_t* subMtl;
|
|
||||||
|
typedef struct aseUniqueIndices_s aseUniqueIndices_t;
|
||||||
|
struct aseUniqueIndices_s
|
||||||
|
{
|
||||||
|
picoIndex_t* data;
|
||||||
|
picoIndex_t* last;
|
||||||
|
|
||||||
|
aseFace_t* faces;
|
||||||
|
};
|
||||||
|
|
||||||
|
size_t aseUniqueIndices_size( aseUniqueIndices_t* self ) {
|
||||||
|
return self->last - self->data;
|
||||||
|
}
|
||||||
|
|
||||||
|
void aseUniqueIndices_reserve( aseUniqueIndices_t* self, picoIndex_t size ) {
|
||||||
|
self->data = self->last = (picoIndex_t*)_pico_calloc( size, sizeof( picoIndex_t ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
void aseUniqueIndices_clear( aseUniqueIndices_t* self ) {
|
||||||
|
_pico_free( self->data );
|
||||||
|
}
|
||||||
|
|
||||||
|
void aseUniqueIndices_pushBack( aseUniqueIndices_t* self, picoIndex_t index ) {
|
||||||
|
*self->last++ = index;
|
||||||
|
}
|
||||||
|
|
||||||
|
picoIndex_t aseFaces_getVertexIndex( aseFace_t* faces, picoIndex_t index ) {
|
||||||
|
return faces[index / 3].indices[index % 3];
|
||||||
|
}
|
||||||
|
|
||||||
|
picoIndex_t aseFaces_getTexCoordIndex( aseFace_t* faces, picoIndex_t index ) {
|
||||||
|
return faces[index / 3].indices[( index % 3 ) + 3];
|
||||||
|
}
|
||||||
|
|
||||||
|
picoIndex_t aseFaces_getColorIndex( aseFace_t* faces, picoIndex_t index ) {
|
||||||
|
return faces[index / 3].indices[( index % 3 ) + 6];
|
||||||
|
}
|
||||||
|
|
||||||
|
int aseUniqueIndex_equal( aseFace_t* faces, picoIndex_t index, picoIndex_t other ) {
|
||||||
|
return aseFaces_getVertexIndex( faces, index ) == aseFaces_getVertexIndex( faces, other )
|
||||||
|
&& aseFaces_getTexCoordIndex( faces, index ) == aseFaces_getTexCoordIndex( faces, other )
|
||||||
|
&& aseFaces_getColorIndex( faces, index ) == aseFaces_getColorIndex( faces, other );
|
||||||
|
}
|
||||||
|
|
||||||
|
picoIndex_t aseUniqueIndices_insertUniqueVertex( aseUniqueIndices_t* self, picoIndex_t index ) {
|
||||||
|
picoIndexIter_t i = self->data;
|
||||||
|
for (; i != self->last; ++i )
|
||||||
|
{
|
||||||
|
picoIndex_t other = (picoIndex_t)( i - self->data );
|
||||||
|
if ( aseUniqueIndex_equal( self->faces, index, other ) ) {
|
||||||
|
return other;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
aseUniqueIndices_pushBack( self, index );
|
||||||
|
return (picoIndex_t)( aseUniqueIndices_size( self ) - 1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
static void _ase_submit_triangles_unshared( picoModel_t* model, aseMaterial_t* materials, aseVertex_t* vertices, aseTexCoord_t* texcoords, aseColor_t* colors, aseFace_t* faces, int numFaces, int meshHasNormals ) {
|
||||||
|
aseFacesIter_t i = faces, end = faces + numFaces;
|
||||||
|
|
||||||
|
aseUniqueIndices_t indices;
|
||||||
|
aseUniqueIndices_t remap;
|
||||||
|
aseUniqueIndices_reserve( &indices, numFaces * 3 );
|
||||||
|
aseUniqueIndices_reserve( &remap, numFaces * 3 );
|
||||||
|
indices.faces = faces;
|
||||||
|
|
||||||
|
for (; i != end; ++i )
|
||||||
|
{
|
||||||
|
/* look up the shader for the material/submaterial pair */
|
||||||
|
aseSubMaterial_t* subMtl = _ase_get_submaterial_or_default( materials, ( *i ).materialId, ( *i ).subMaterialId );
|
||||||
|
if ( subMtl == NULL ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
picoSurface_t* surface = PicoModelFindOrAddSurface( model, subMtl->shader );
|
||||||
|
int j;
|
||||||
|
/* we pull the data from the vertex, color and texcoord arrays using the face index data */
|
||||||
|
for ( j = 0 ; j < 3 ; j++ )
|
||||||
|
{
|
||||||
|
picoIndex_t index = (picoIndex_t)( ( ( i - faces ) * 3 ) + j );
|
||||||
|
picoIndex_t size = (picoIndex_t)aseUniqueIndices_size( &indices );
|
||||||
|
picoIndex_t unique = aseUniqueIndices_insertUniqueVertex( &indices, index );
|
||||||
|
|
||||||
|
picoIndex_t numVertexes = PicoGetSurfaceNumVertexes( surface );
|
||||||
|
picoIndex_t numIndexes = PicoGetSurfaceNumIndexes( surface );
|
||||||
|
|
||||||
|
aseUniqueIndices_pushBack( &remap, numIndexes );
|
||||||
|
|
||||||
|
PicoSetSurfaceIndex( surface, numIndexes, remap.data[unique] );
|
||||||
|
|
||||||
|
if ( unique == size ) {
|
||||||
|
PicoSetSurfaceXYZ( surface, numVertexes, vertices[( *i ).indices[j]].xyz );
|
||||||
|
PicoSetSurfaceNormal( surface, numVertexes, vertices[( *i ).indices[j]].normal );
|
||||||
|
PicoSetSurfaceST( surface, 0, numVertexes, texcoords[( *i ).indices[j + 3]].texcoord );
|
||||||
|
|
||||||
|
if ( ( *i ).indices[j + 6] >= 0 ) {
|
||||||
|
PicoSetSurfaceColor( surface, 0, numVertexes, colors[( *i ).indices[j + 6]].color );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
PicoSetSurfaceColor( surface, 0, numVertexes, white );
|
||||||
|
}
|
||||||
|
|
||||||
|
PicoSetSurfaceSmoothingGroup( surface, numVertexes, ( vertices[( *i ).indices[j]].id * ( 1 << 16 ) ) + ( *i ).smoothingGroup );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
aseUniqueIndices_clear( &indices );
|
||||||
|
aseUniqueIndices_clear( &remap );
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static void _ase_submit_triangles( picoModel_t* model, aseMaterial_t* materials, aseVertex_t* vertices, aseTexCoord_t* texcoords, aseColor_t* colors, aseFace_t* faces, int numFaces ){
|
||||||
|
aseFacesIter_t i = faces, end = faces + numFaces;
|
||||||
|
for (; i != end; ++i )
|
||||||
|
{
|
||||||
|
/* look up the shader for the material/submaterial pair */
|
||||||
|
aseSubMaterial_t* subMtl = _ase_get_submaterial_or_default( materials, ( *i ).materialId, ( *i ).subMaterialId );
|
||||||
|
if ( subMtl == NULL ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
picoVec3_t* xyz[3];
|
picoVec3_t* xyz[3];
|
||||||
picoVec3_t* normal[3];
|
picoVec3_t* normal[3];
|
||||||
picoVec2_t* st[3];
|
picoVec2_t* st[3];
|
||||||
picoColor_t* color[3];
|
picoColor_t* color[3];
|
||||||
int i;
|
picoIndex_t smooth[3];
|
||||||
|
int j;
|
||||||
face = faces;
|
/* we pull the data from the vertex, color and texcoord arrays using the face index data */
|
||||||
while ( face != NULL )
|
for ( j = 0 ; j < 3 ; j++ )
|
||||||
{
|
{
|
||||||
/* look up the shader for the material/submaterial pair */
|
xyz[j] = &vertices[( *i ).indices[j]].xyz;
|
||||||
subMtl = _ase_get_submaterial( materials, face->mtlId, face->subMtlId );
|
normal[j] = &vertices[( *i ).indices[j]].normal;
|
||||||
if ( subMtl == NULL ) {
|
st[j] = &texcoords[( *i ).indices[j + 3]].texcoord;
|
||||||
/* ydnar: trying default submaterial */
|
|
||||||
subMtl = _ase_get_submaterial( materials, face->mtlId, 0 );
|
|
||||||
if ( subMtl == NULL ) {
|
|
||||||
_pico_printf( PICO_ERROR, "Could not find material/submaterial for id %d/%d\n", face->mtlId, face->subMtlId );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* we pull the data from the surface using the facelist data */
|
if ( colors != NULL && ( *i ).indices[j + 6] >= 0 ) {
|
||||||
for ( i = 0 ; i < 3 ; i++ )
|
color[j] = &colors[( *i ).indices[j + 6]].color;
|
||||||
{
|
|
||||||
xyz[i] = (picoVec3_t*) PicoGetSurfaceXYZ( surface, face->index[ i ] );
|
|
||||||
normal[i] = (picoVec3_t*) PicoGetSurfaceNormal( surface, face->index[ i ] );
|
|
||||||
st[i] = (picoVec2_t*) PicoGetSurfaceST( surface, 0, face->index[ i + 3 ] );
|
|
||||||
|
|
||||||
if ( face->index [ i + 6] >= 0 ) {
|
|
||||||
color[i] = (picoColor_t*)PicoGetSurfaceColor( surface, 0, face->index[ i + 6 ] );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
color[i] = &white;
|
color[j] = &white;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
smooth[j] = ( vertices[( *i ).indices[j]].id * ( 1 << 16 ) ) + ( *i ).smoothingGroup; /* don't merge vertices */
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* submit the triangle to the model */
|
/* submit the triangle to the model */
|
||||||
PicoAddTriangleToModel( model, xyz, normal, 1, st, 1, color, subMtl->shader );
|
PicoAddTriangleToModel( model, xyz, normal, 1, st, 1, color, subMtl->shader, smooth );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* advance to the next face */
|
static void shadername_convert( char* shaderName ){
|
||||||
face = face->next;
|
/* unix-style path separators */
|
||||||
|
char* s = shaderName;
|
||||||
|
for (; *s != '\0'; ++s )
|
||||||
|
{
|
||||||
|
if ( *s == '\\' ) {
|
||||||
|
*s = '/';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* _ase_load:
|
/* _ase_load:
|
||||||
* loads a 3dsmax ase model file.
|
* loads a 3dsmax ase model file.
|
||||||
*/
|
*/
|
||||||
static picoModel_t *_ase_load( PM_PARAMS_LOAD ){
|
static picoModel_t *_ase_load( PM_PARAMS_LOAD ){
|
||||||
picoModel_t *model;
|
picoModel_t *model;
|
||||||
picoSurface_t *surface = NULL;
|
|
||||||
picoParser_t *p;
|
picoParser_t *p;
|
||||||
char lastNodeName[ 1024 ];
|
char lastNodeName[ 1024 ];
|
||||||
|
|
||||||
|
aseVertex_t* vertices = NULL;
|
||||||
|
aseTexCoord_t* texcoords = NULL;
|
||||||
|
aseColor_t* colors = NULL;
|
||||||
aseFace_t* faces = NULL;
|
aseFace_t* faces = NULL;
|
||||||
aseFace_t* facesTail = NULL;
|
int numVertices = 0;
|
||||||
|
int numFaces = 0;
|
||||||
|
int numTextureVertices = 0;
|
||||||
|
int numTextureVertexFaces = 0;
|
||||||
|
int numColorVertices = 0;
|
||||||
|
int numColorVertexFaces = 0;
|
||||||
|
int vertexId = 0;
|
||||||
|
|
||||||
aseMaterial_t* materials = NULL;
|
aseMaterial_t* materials = NULL;
|
||||||
|
|
||||||
#ifdef DEBUG_PM_ASE
|
#ifdef DEBUG_PM_ASE
|
||||||
|
@ -413,15 +566,49 @@ static picoModel_t *_ase_load( PM_PARAMS_LOAD ){
|
||||||
/* model mesh (originally contained within geomobject) */
|
/* model mesh (originally contained within geomobject) */
|
||||||
else if ( !_pico_stricmp( p->token,"*mesh" ) ) {
|
else if ( !_pico_stricmp( p->token,"*mesh" ) ) {
|
||||||
/* finish existing surface */
|
/* finish existing surface */
|
||||||
//_ase_make_surface( model, &surface );
|
_ase_submit_triangles( model, materials, vertices, texcoords, colors, faces, numFaces );
|
||||||
_ase_submit_triangles( surface, model,materials,faces );
|
_pico_free( faces );
|
||||||
_ase_free_faces( &faces,&facesTail );
|
_pico_free( vertices );
|
||||||
|
_pico_free( texcoords );
|
||||||
|
_pico_free( colors );
|
||||||
|
}
|
||||||
|
else if ( !_pico_stricmp( p->token,"*mesh_numvertex" ) ) {
|
||||||
|
if ( !_pico_parse_int( p, &numVertices ) ) {
|
||||||
|
_ase_error_return( "Missing MESH_NUMVERTEX value" );
|
||||||
|
}
|
||||||
|
|
||||||
/* allocate new pico surface */
|
vertices = _pico_calloc( numVertices, sizeof( aseVertex_t ) );
|
||||||
surface = PicoNewSurface( NULL );
|
}
|
||||||
if ( surface == NULL ) {
|
else if ( !_pico_stricmp( p->token,"*mesh_numfaces" ) ) {
|
||||||
PicoFreeModel( model );
|
if ( !_pico_parse_int( p, &numFaces ) ) {
|
||||||
return NULL;
|
_ase_error_return( "Missing MESH_NUMFACES value" );
|
||||||
|
}
|
||||||
|
|
||||||
|
faces = _pico_calloc( numFaces, sizeof( aseFace_t ) );
|
||||||
|
}
|
||||||
|
else if ( !_pico_stricmp( p->token,"*mesh_numtvertex" ) ) {
|
||||||
|
if ( !_pico_parse_int( p, &numTextureVertices ) ) {
|
||||||
|
_ase_error_return( "Missing MESH_NUMTVERTEX value" );
|
||||||
|
}
|
||||||
|
|
||||||
|
texcoords = _pico_calloc( numTextureVertices, sizeof( aseTexCoord_t ) );
|
||||||
|
}
|
||||||
|
else if ( !_pico_stricmp( p->token,"*mesh_numtvfaces" ) ) {
|
||||||
|
if ( !_pico_parse_int( p, &numTextureVertexFaces ) ) {
|
||||||
|
_ase_error_return( "Missing MESH_NUMTVFACES value" );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ( !_pico_stricmp( p->token,"*mesh_numcvertex" ) ) {
|
||||||
|
if ( !_pico_parse_int( p, &numColorVertices ) ) {
|
||||||
|
_ase_error_return( "Missing MESH_NUMCVERTEX value" );
|
||||||
|
}
|
||||||
|
|
||||||
|
colors = _pico_calloc( numColorVertices, sizeof( aseColor_t ) );
|
||||||
|
memset( colors, 255, numColorVertices * sizeof( aseColor_t ) ); /* ydnar: force colors to white initially */
|
||||||
|
}
|
||||||
|
else if ( !_pico_stricmp( p->token,"*mesh_numcvfaces" ) ) {
|
||||||
|
if ( !_pico_parse_int( p, &numColorVertexFaces ) ) {
|
||||||
|
_ase_error_return( "Missing MESH_NUMCVFACES value" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* mesh material reference. this usually comes at the end of */
|
/* mesh material reference. this usually comes at the end of */
|
||||||
|
@ -430,77 +617,63 @@ static picoModel_t *_ase_load( PM_PARAMS_LOAD ){
|
||||||
/* the material reference id (shader index) now. */
|
/* the material reference id (shader index) now. */
|
||||||
else if ( !_pico_stricmp( p->token,"*material_ref" ) ) {
|
else if ( !_pico_stricmp( p->token,"*material_ref" ) ) {
|
||||||
int mtlId;
|
int mtlId;
|
||||||
aseFace_t* face;
|
|
||||||
|
|
||||||
/* we must have a valid surface */
|
|
||||||
if ( surface == NULL ) {
|
|
||||||
_ase_error_return( "Missing mesh for material reference" );
|
|
||||||
}
|
|
||||||
|
|
||||||
/* get the material ref (0..n) */
|
/* get the material ref (0..n) */
|
||||||
if ( !_pico_parse_int( p,&mtlId ) ) {
|
if ( !_pico_parse_int( p,&mtlId ) ) {
|
||||||
_ase_error_return( "Missing material reference ID" );
|
_ase_error_return( "Missing material reference ID" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
int i = 0;
|
||||||
/* fix up all of the aseFaceList in the surface to point to the parent material */
|
/* fix up all of the aseFaceList in the surface to point to the parent material */
|
||||||
/* we've already saved off their subMtl */
|
/* we've already saved off their subMtl */
|
||||||
face = faces;
|
for (; i < numFaces; ++i )
|
||||||
while ( face != NULL )
|
|
||||||
{
|
{
|
||||||
face->mtlId = mtlId;
|
faces[i].materialId = mtlId;
|
||||||
face = face->next;
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* model mesh vertex */
|
/* model mesh vertex */
|
||||||
else if ( !_pico_stricmp( p->token,"*mesh_vertex" ) ) {
|
else if ( !_pico_stricmp( p->token,"*mesh_vertex" ) ) {
|
||||||
picoVec3_t v;
|
|
||||||
int index;
|
int index;
|
||||||
|
|
||||||
/* we must have a valid surface */
|
if ( numVertices == 0 ) {
|
||||||
if ( surface == NULL ) {
|
_ase_error_return( "Vertex parse error" );
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* get vertex data (orig: index +y -x +z) */
|
/* get vertex data (orig: index +y -x +z) */
|
||||||
if ( !_pico_parse_int( p,&index ) ) {
|
if ( !_pico_parse_int( p,&index ) ) {
|
||||||
_ase_error_return( "Vertex parse error" );
|
_ase_error_return( "Vertex parse error" );
|
||||||
}
|
}
|
||||||
if ( !_pico_parse_vec( p,v ) ) {
|
if ( !_pico_parse_vec( p,vertices[index].xyz ) ) {
|
||||||
_ase_error_return( "Vertex parse error" );
|
_ase_error_return( "Vertex parse error" );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set vertex */
|
vertices[index].id = vertexId++;
|
||||||
PicoSetSurfaceXYZ( surface,index,v );
|
|
||||||
}
|
}
|
||||||
/* model mesh vertex normal */
|
/* model mesh vertex normal */
|
||||||
else if ( !_pico_stricmp( p->token,"*mesh_vertexnormal" ) ) {
|
else if ( !_pico_stricmp( p->token,"*mesh_vertexnormal" ) ) {
|
||||||
picoVec3_t v;
|
|
||||||
int index;
|
int index;
|
||||||
|
|
||||||
/* we must have a valid surface */
|
if ( numVertices == 0 ) {
|
||||||
if ( surface == NULL ) {
|
_ase_error_return( "Vertex parse error" );
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* get vertex data (orig: index +y -x +z) */
|
/* get vertex data (orig: index +y -x +z) */
|
||||||
if ( !_pico_parse_int( p,&index ) ) {
|
if ( !_pico_parse_int( p,&index ) ) {
|
||||||
_ase_error_return( "Vertex parse error" );
|
_ase_error_return( "Vertex parse error" );
|
||||||
}
|
}
|
||||||
if ( !_pico_parse_vec( p,v ) ) {
|
if ( !_pico_parse_vec( p,vertices[index].normal ) ) {
|
||||||
_ase_error_return( "Vertex parse error" );
|
_ase_error_return( "Vertex parse error" );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set vertex */
|
|
||||||
PicoSetSurfaceNormal( surface,index,v );
|
|
||||||
}
|
}
|
||||||
/* model mesh face */
|
/* model mesh face */
|
||||||
else if ( !_pico_stricmp( p->token,"*mesh_face" ) ) {
|
else if ( !_pico_stricmp( p->token,"*mesh_face" ) ) {
|
||||||
picoIndex_t indexes[3];
|
picoIndex_t indexes[3];
|
||||||
int index;
|
int index;
|
||||||
|
|
||||||
/* we must have a valid surface */
|
if ( numFaces == 0 ) {
|
||||||
if ( surface == NULL ) {
|
_ase_error_return( "Face parse error" );
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* get face index */
|
/* get face index */
|
||||||
|
@ -526,75 +699,58 @@ static picoModel_t *_ase_load( PM_PARAMS_LOAD ){
|
||||||
_ase_error_return( "Face parse error" );
|
_ase_error_return( "Face parse error" );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set face indexes (note interleaved offset!) */
|
|
||||||
PicoSetSurfaceIndex( surface, ( index * 9 + 0 ), indexes[2] );
|
|
||||||
PicoSetSurfaceIndex( surface, ( index * 9 + 1 ), indexes[1] );
|
|
||||||
PicoSetSurfaceIndex( surface, ( index * 9 + 2 ), indexes[0] );
|
|
||||||
|
|
||||||
/* parse to the subMaterial ID */
|
/* parse to the subMaterial ID */
|
||||||
while ( 1 )
|
while ( 1 )
|
||||||
{
|
{
|
||||||
_pico_parse( p,0 );
|
if ( !_pico_parse( p,0 ) ) { /* EOL */
|
||||||
if ( !_pico_stricmp( p->token,"*MESH_MTLID" ) ) {
|
|
||||||
aseFace_t* newFace;
|
|
||||||
int subMtlId;
|
|
||||||
|
|
||||||
_pico_parse_int( p, &subMtlId );
|
|
||||||
newFace = _pico_calloc( 1, sizeof( aseFace_t ) );
|
|
||||||
|
|
||||||
/* we fix up the mtlId later when we parse the material_ref */
|
|
||||||
newFace->mtlId = 0;
|
|
||||||
newFace->subMtlId = subMtlId;
|
|
||||||
newFace->index[0] = indexes[2];
|
|
||||||
newFace->index[1] = indexes[1];
|
|
||||||
newFace->index[2] = indexes[0];
|
|
||||||
|
|
||||||
_ase_add_face( &faces,&facesTail,newFace );
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if ( !_pico_stricmp( p->token,"*MESH_SMOOTHING" ) ) {
|
||||||
|
_pico_parse_int( p, &faces[index].smoothingGroup );
|
||||||
|
}
|
||||||
|
if ( !_pico_stricmp( p->token,"*MESH_MTLID" ) ) {
|
||||||
|
_pico_parse_int( p, &faces[index].subMaterialId );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
faces[index].materialId = 0;
|
||||||
|
faces[index].indices[0] = indexes[2];
|
||||||
|
faces[index].indices[1] = indexes[1];
|
||||||
|
faces[index].indices[2] = indexes[0];
|
||||||
}
|
}
|
||||||
/* model texture vertex */
|
/* model texture vertex */
|
||||||
else if ( !_pico_stricmp( p->token,"*mesh_tvert" ) ) {
|
else if ( !_pico_stricmp( p->token,"*mesh_tvert" ) ) {
|
||||||
picoVec2_t uv;
|
|
||||||
int index;
|
int index;
|
||||||
|
|
||||||
/* we must have a valid surface */
|
if ( numVertices == 0 ) {
|
||||||
if ( surface == NULL ) {
|
_ase_error_return( "Texture Vertex parse error" );
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* get uv vertex index */
|
/* get uv vertex index */
|
||||||
if ( !_pico_parse_int( p,&index ) ) {
|
if ( !_pico_parse_int( p,&index ) || index >= numTextureVertices ) {
|
||||||
_ase_error_return( "UV vertex parse error" );
|
_ase_error_return( "Texture vertex parse error" );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* get uv vertex s */
|
/* get uv vertex s */
|
||||||
if ( !_pico_parse_float( p,&uv[0] ) ) {
|
if ( !_pico_parse_float( p,&texcoords[index].texcoord[0] ) ) {
|
||||||
_ase_error_return( "UV vertex parse error" );
|
_ase_error_return( "Texture vertex parse error" );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* get uv vertex t */
|
/* get uv vertex t */
|
||||||
if ( !_pico_parse_float( p,&uv[1] ) ) {
|
if ( !_pico_parse_float( p,&texcoords[index].texcoord[1] ) ) {
|
||||||
_ase_error_return( "UV vertex parse error" );
|
_ase_error_return( "Texture vertex parse error" );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ydnar: invert t */
|
/* ydnar: invert t */
|
||||||
uv[ 1 ] = 1.0f - uv[ 1 ];
|
texcoords[index].texcoord[ 1 ] = 1.0f - texcoords[index].texcoord[ 1 ];
|
||||||
|
|
||||||
/* set texture vertex */
|
|
||||||
PicoSetSurfaceST( surface,0,index,uv );
|
|
||||||
}
|
}
|
||||||
/* ydnar: model mesh texture face */
|
/* ydnar: model mesh texture face */
|
||||||
else if ( !_pico_stricmp( p->token, "*mesh_tface" ) ) {
|
else if ( !_pico_stricmp( p->token, "*mesh_tface" ) ) {
|
||||||
picoIndex_t indexes[3];
|
picoIndex_t indexes[3];
|
||||||
int index;
|
int index;
|
||||||
aseFace_t* face;
|
|
||||||
|
|
||||||
/* we must have a valid surface */
|
if ( numFaces == 0 ) {
|
||||||
if ( surface == NULL ) {
|
_ase_error_return( "Texture face parse error" );
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* get face index */
|
/* get face index */
|
||||||
|
@ -617,65 +773,52 @@ static picoModel_t *_ase_load( PM_PARAMS_LOAD ){
|
||||||
_ase_error_return( "Texture face parse error" );
|
_ase_error_return( "Texture face parse error" );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set face indexes (note interleaved offset!) */
|
faces[index].indices[3] = indexes[2];
|
||||||
PicoSetSurfaceIndex( surface, ( index * 9 + 3 ), indexes[2] );
|
faces[index].indices[4] = indexes[1];
|
||||||
PicoSetSurfaceIndex( surface, ( index * 9 + 4 ), indexes[1] );
|
faces[index].indices[5] = indexes[0];
|
||||||
PicoSetSurfaceIndex( surface, ( index * 9 + 5 ), indexes[0] );
|
|
||||||
|
|
||||||
face = _ase_get_face_for_index( faces,index );
|
|
||||||
face->index[3] = indexes[2];
|
|
||||||
face->index[4] = indexes[1];
|
|
||||||
face->index[5] = indexes[0];
|
|
||||||
}
|
}
|
||||||
/* model color vertex */
|
/* model color vertex */
|
||||||
else if ( !_pico_stricmp( p->token,"*mesh_vertcol" ) ) {
|
else if ( !_pico_stricmp( p->token,"*mesh_vertcol" ) ) {
|
||||||
picoColor_t color;
|
|
||||||
int index;
|
int index;
|
||||||
float colorInput;
|
float colorInput;
|
||||||
|
|
||||||
/* we must have a valid surface */
|
if ( numVertices == 0 ) {
|
||||||
if ( surface == NULL ) {
|
_ase_error_return( "Color Vertex parse error" );
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* get color vertex index */
|
/* get color vertex index */
|
||||||
if ( !_pico_parse_int( p,&index ) ) {
|
if ( !_pico_parse_int( p,&index ) ) {
|
||||||
_ase_error_return( "UV vertex parse error" );
|
_ase_error_return( "Color vertex parse error" );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* get R component */
|
/* get R component */
|
||||||
if ( !_pico_parse_float( p,&colorInput ) ) {
|
if ( !_pico_parse_float( p,&colorInput ) ) {
|
||||||
_ase_error_return( "color vertex parse error" );
|
_ase_error_return( "Color vertex parse error" );
|
||||||
}
|
}
|
||||||
color[0] = (picoByte_t)( colorInput * 255 );
|
colors[index].color[0] = (picoByte_t)( colorInput * 255 );
|
||||||
|
|
||||||
/* get G component */
|
/* get G component */
|
||||||
if ( !_pico_parse_float( p,&colorInput ) ) {
|
if ( !_pico_parse_float( p,&colorInput ) ) {
|
||||||
_ase_error_return( "color vertex parse error" );
|
_ase_error_return( "Color vertex parse error" );
|
||||||
}
|
}
|
||||||
color[1] = (picoByte_t)( colorInput * 255 );
|
colors[index].color[1] = (picoByte_t)( colorInput * 255 );
|
||||||
|
|
||||||
/* get B component */
|
/* get B component */
|
||||||
if ( !_pico_parse_float( p,&colorInput ) ) {
|
if ( !_pico_parse_float( p,&colorInput ) ) {
|
||||||
_ase_error_return( "color vertex parse error" );
|
_ase_error_return( "Color vertex parse error" );
|
||||||
}
|
}
|
||||||
color[2] = (picoByte_t)( colorInput * 255 );
|
colors[index].color[2] = (picoByte_t)( colorInput * 255 );
|
||||||
|
|
||||||
/* leave alpha alone since we don't get any data from the ASE format */
|
/* leave alpha alone since we don't get any data from the ASE format */
|
||||||
color[3] = 255;
|
colors[index].color[3] = 255;
|
||||||
|
|
||||||
/* set texture vertex */
|
|
||||||
PicoSetSurfaceColor( surface,0,index,color );
|
|
||||||
}
|
}
|
||||||
/* model color face */
|
/* model color face */
|
||||||
else if ( !_pico_stricmp( p->token,"*mesh_cface" ) ) {
|
else if ( !_pico_stricmp( p->token,"*mesh_cface" ) ) {
|
||||||
picoIndex_t indexes[3];
|
picoIndex_t indexes[3];
|
||||||
int index;
|
int index;
|
||||||
aseFace_t* face;
|
|
||||||
|
|
||||||
/* we must have a valid surface */
|
if ( numFaces == 0 ) {
|
||||||
if ( surface == NULL ) {
|
_ase_error_return( "Face parse error" );
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* get face index */
|
/* get face index */
|
||||||
|
@ -701,20 +844,14 @@ static picoModel_t *_ase_load( PM_PARAMS_LOAD ){
|
||||||
_ase_error_return( "Face parse error" );
|
_ase_error_return( "Face parse error" );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set face indexes (note interleaved offset!) */
|
faces[index].indices[6] = indexes[2];
|
||||||
PicoSetSurfaceIndex( surface, ( index * 9 + 6 ), indexes[2] );
|
faces[index].indices[7] = indexes[1];
|
||||||
PicoSetSurfaceIndex( surface, ( index * 9 + 7 ), indexes[1] );
|
faces[index].indices[8] = indexes[0];
|
||||||
PicoSetSurfaceIndex( surface, ( index * 9 + 8 ), indexes[0] );
|
|
||||||
|
|
||||||
face = _ase_get_face_for_index( faces,index );
|
|
||||||
face->index[6] = indexes[2];
|
|
||||||
face->index[7] = indexes[1];
|
|
||||||
face->index[8] = indexes[0];
|
|
||||||
}
|
}
|
||||||
/* model material */
|
/* model material */
|
||||||
else if ( !_pico_stricmp( p->token, "*material" ) ) {
|
else if ( !_pico_stricmp( p->token, "*material" ) ) {
|
||||||
aseSubMaterial_t* subMaterial = NULL;
|
aseSubMaterial_t* subMaterial = NULL;
|
||||||
picoShader_t *shader = NULL;
|
picoShader_t *shader;
|
||||||
int level = 1, index;
|
int level = 1, index;
|
||||||
char materialName[ 1024 ];
|
char materialName[ 1024 ];
|
||||||
float transValue = 0.0f, shineValue = 1.0f;
|
float transValue = 0.0f, shineValue = 1.0f;
|
||||||
|
@ -755,6 +892,8 @@ static picoModel_t *_ase_load( PM_PARAMS_LOAD ){
|
||||||
|
|
||||||
if ( level == subMaterialLevel ) {
|
if ( level == subMaterialLevel ) {
|
||||||
/* set material name */
|
/* set material name */
|
||||||
|
_pico_first_token( materialName );
|
||||||
|
shadername_convert( materialName );
|
||||||
PicoSetShaderName( shader, materialName );
|
PicoSetShaderName( shader, materialName );
|
||||||
|
|
||||||
/* set shader's transparency */
|
/* set shader's transparency */
|
||||||
|
@ -944,6 +1083,7 @@ static picoModel_t *_ase_load( PM_PARAMS_LOAD ){
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set material name */
|
/* set material name */
|
||||||
|
shadername_convert( materialName );
|
||||||
PicoSetShaderName( shader,materialName );
|
PicoSetShaderName( shader,materialName );
|
||||||
|
|
||||||
/* set shader's transparency */
|
/* set shader's transparency */
|
||||||
|
@ -967,6 +1107,34 @@ static picoModel_t *_ase_load( PM_PARAMS_LOAD ){
|
||||||
/* set material map name */
|
/* set material map name */
|
||||||
PicoSetShaderMapName( shader, mapname );
|
PicoSetShaderMapName( shader, mapname );
|
||||||
|
|
||||||
|
/* extract shadername from bitmap path */
|
||||||
|
if ( mapname != NULL ) {
|
||||||
|
char* p = mapname;
|
||||||
|
|
||||||
|
/* convert to shader-name format */
|
||||||
|
shadername_convert( mapname );
|
||||||
|
{
|
||||||
|
/* remove extension */
|
||||||
|
char* last_period = strrchr( p, '.' );
|
||||||
|
if ( last_period != NULL ) {
|
||||||
|
*last_period = '\0';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* find shader path */
|
||||||
|
for (; *p != '\0'; ++p )
|
||||||
|
{
|
||||||
|
if ( _pico_strnicmp( p, "models/", 7 ) == 0 || _pico_strnicmp( p, "textures/", 9 ) == 0 ) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( *p != '\0' ) {
|
||||||
|
/* set material name */
|
||||||
|
PicoSetShaderName( shader,p );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* this is just a material with 1 submaterial */
|
/* this is just a material with 1 submaterial */
|
||||||
subMaterial = _ase_add_submaterial( &materials, index, 0, shader );
|
subMaterial = _ase_add_submaterial( &materials, index, 0, shader );
|
||||||
}
|
}
|
||||||
|
@ -982,9 +1150,11 @@ static picoModel_t *_ase_load( PM_PARAMS_LOAD ){
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ydnar: finish existing surface */
|
/* ydnar: finish existing surface */
|
||||||
// _ase_make_surface( model, &surface );
|
_ase_submit_triangles( model, materials, vertices, texcoords, colors, faces, numFaces );
|
||||||
_ase_submit_triangles( surface, model,materials,faces );
|
_pico_free( faces );
|
||||||
_ase_free_faces( &faces,&facesTail );
|
_pico_free( vertices );
|
||||||
|
_pico_free( texcoords );
|
||||||
|
_pico_free( colors );
|
||||||
|
|
||||||
#ifdef DEBUG_PM_ASE
|
#ifdef DEBUG_PM_ASE
|
||||||
_ase_print_materials( materials );
|
_ase_print_materials( materials );
|
||||||
|
@ -995,6 +1165,8 @@ static picoModel_t *_ase_load( PM_PARAMS_LOAD ){
|
||||||
|
|
||||||
_ase_free_materials( &materials );
|
_ase_free_materials( &materials );
|
||||||
|
|
||||||
|
_pico_free_parser( p );
|
||||||
|
|
||||||
/* return allocated pico model */
|
/* return allocated pico model */
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
|
|
|
@ -350,7 +350,7 @@ static picoModel_t *_fm_load( PM_PARAMS_LOAD ){
|
||||||
texCoord->t = _pico_little_short( texCoord[i].t );
|
texCoord->t = _pico_little_short( texCoord[i].t );
|
||||||
}
|
}
|
||||||
// set Skin Name
|
// set Skin Name
|
||||||
strncpy( skinname, (char *) fm.fm_skin, FM_SKINPATHSIZE );
|
strncpy( skinname, (unsigned char *) fm.fm_skin, FM_SKINPATHSIZE );
|
||||||
|
|
||||||
#ifdef FM_VERBOSE_DBG
|
#ifdef FM_VERBOSE_DBG
|
||||||
// Print out md2 values
|
// Print out md2 values
|
||||||
|
|
|
@ -103,7 +103,7 @@ static picoModel_t *_lwo_load( PM_PARAMS_LOAD ){
|
||||||
lwPolygon *pol;
|
lwPolygon *pol;
|
||||||
lwPolVert *v;
|
lwPolVert *v;
|
||||||
lwVMapPt *vm;
|
lwVMapPt *vm;
|
||||||
char name[ 64 ];
|
char name[ 256 ];
|
||||||
int i, j, k, numverts;
|
int i, j, k, numverts;
|
||||||
|
|
||||||
picoModel_t *picoModel;
|
picoModel_t *picoModel;
|
||||||
|
@ -235,6 +235,7 @@ static picoModel_t *_lwo_load( PM_PARAMS_LOAD ){
|
||||||
|
|
||||||
/* detox and set shader name */
|
/* detox and set shader name */
|
||||||
strncpy( name, surface->name, sizeof( name ) );
|
strncpy( name, surface->name, sizeof( name ) );
|
||||||
|
_pico_first_token( name );
|
||||||
_pico_setfext( name, "" );
|
_pico_setfext( name, "" );
|
||||||
_pico_unixify( name );
|
_pico_unixify( name );
|
||||||
PicoSetShaderName( picoShader, name );
|
PicoSetShaderName( picoShader, name );
|
||||||
|
@ -282,9 +283,22 @@ static picoModel_t *_lwo_load( PM_PARAMS_LOAD ){
|
||||||
xyz[ 1 ] = pt->pos[ 2 ];
|
xyz[ 1 ] = pt->pos[ 2 ];
|
||||||
xyz[ 2 ] = pt->pos[ 1 ];
|
xyz[ 2 ] = pt->pos[ 1 ];
|
||||||
|
|
||||||
|
///* doom3 lwo data doesn't seem to have smoothing-angle information */
|
||||||
|
//#if 0
|
||||||
|
// if ( surface->smooth <= 0 ) {
|
||||||
|
// /* use face normals */
|
||||||
normal[ 0 ] = v->norm[ 0 ];
|
normal[ 0 ] = v->norm[ 0 ];
|
||||||
normal[ 1 ] = v->norm[ 2 ];
|
normal[ 1 ] = v->norm[ 2 ];
|
||||||
normal[ 2 ] = v->norm[ 1 ];
|
normal[ 2 ] = v->norm[ 1 ];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
//#endif
|
||||||
|
{
|
||||||
|
/* smooth normals later */
|
||||||
|
normal[ 0 ] = 0;
|
||||||
|
normal[ 1 ] = 0;
|
||||||
|
normal[ 2 ] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
st[ 0 ] = xyz[ defaultSTAxis[ 0 ] ] * defaultXYZtoSTScale[ 0 ];
|
st[ 0 ] = xyz[ defaultSTAxis[ 0 ] ] * defaultXYZtoSTScale[ 0 ];
|
||||||
st[ 1 ] = xyz[ defaultSTAxis[ 1 ] ] * defaultXYZtoSTScale[ 1 ];
|
st[ 1 ] = xyz[ defaultSTAxis[ 1 ] ] * defaultXYZtoSTScale[ 1 ];
|
||||||
|
|
|
@ -52,7 +52,7 @@
|
||||||
#define MDC_DIST_SCALE 0.05f
|
#define MDC_DIST_SCALE 0.05f
|
||||||
|
|
||||||
/* mdc decoding normal table */
|
/* mdc decoding normal table */
|
||||||
double mdcNormals[ 256 ][ 3 ] =
|
const double mdcNormals[ 256 ][ 3 ] =
|
||||||
{
|
{
|
||||||
{ 1.000000, 0.000000, 0.000000 },
|
{ 1.000000, 0.000000, 0.000000 },
|
||||||
{ 0.980785, 0.195090, 0.000000 },
|
{ 0.980785, 0.195090, 0.000000 },
|
||||||
|
|
|
@ -241,7 +241,7 @@ static int _obj_mtl_load( picoModel_t *model ){
|
||||||
return 0; \
|
return 0; \
|
||||||
}
|
}
|
||||||
/* alloc copy of model file name */
|
/* alloc copy of model file name */
|
||||||
fileName = _pico_clone_alloc( model->fileName,-1 );
|
fileName = _pico_clone_alloc( model->fileName );
|
||||||
if ( fileName == NULL ) {
|
if ( fileName == NULL ) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
607
libs/picomodel/pm_terrain.c
Normal file
607
libs/picomodel/pm_terrain.c
Normal file
|
@ -0,0 +1,607 @@
|
||||||
|
/* -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
PicoModel Library
|
||||||
|
|
||||||
|
Copyright (c) 2003, Randy Reddig & seaw0lf
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
Redistributions of source code must retain the above copyright notice, this list
|
||||||
|
of conditions and the following disclaimer.
|
||||||
|
|
||||||
|
Redistributions in binary form must reproduce the above copyright notice, this
|
||||||
|
list of conditions and the following disclaimer in the documentation and/or
|
||||||
|
other materials provided with the distribution.
|
||||||
|
|
||||||
|
Neither the names of the copyright holders nor the names of its contributors may
|
||||||
|
be used to endorse or promote products derived from this software without
|
||||||
|
specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||||
|
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
|
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* marker */
|
||||||
|
#define PM_TERRAIN_C
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* dependencies */
|
||||||
|
#include "picointernal.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct tga_s
|
||||||
|
{
|
||||||
|
unsigned char id_length, colormap_type, image_type;
|
||||||
|
unsigned short colormap_index, colormap_length;
|
||||||
|
unsigned char colormap_size;
|
||||||
|
unsigned short x_origin, y_origin, width, height;
|
||||||
|
unsigned char pixel_size, attributes;
|
||||||
|
}
|
||||||
|
tga_t;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
_terrain_load_tga_buffer()
|
||||||
|
loads a tga image into a newly allocated image buffer
|
||||||
|
fixme: replace/clean this function
|
||||||
|
*/
|
||||||
|
|
||||||
|
void _terrain_load_tga_buffer( unsigned char *buffer, unsigned char **pic, int *width, int *height ) {
|
||||||
|
int row, column;
|
||||||
|
int columns, rows, numPixels;
|
||||||
|
unsigned char *pixbuf;
|
||||||
|
unsigned char *buf_p;
|
||||||
|
tga_t targa_header;
|
||||||
|
unsigned char *targa_rgba;
|
||||||
|
|
||||||
|
|
||||||
|
*pic = NULL;
|
||||||
|
|
||||||
|
if ( buffer == NULL ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
buf_p = buffer;
|
||||||
|
|
||||||
|
targa_header.id_length = *buf_p++;
|
||||||
|
targa_header.colormap_type = *buf_p++;
|
||||||
|
targa_header.image_type = *buf_p++;
|
||||||
|
|
||||||
|
targa_header.colormap_index = _pico_little_short( *(short*)buf_p );
|
||||||
|
buf_p += 2;
|
||||||
|
targa_header.colormap_length = _pico_little_short( *(short*) buf_p );
|
||||||
|
buf_p += 2;
|
||||||
|
targa_header.colormap_size = *buf_p++;
|
||||||
|
targa_header.x_origin = _pico_little_short( *(short*) buf_p );
|
||||||
|
buf_p += 2;
|
||||||
|
targa_header.y_origin = _pico_little_short( *(short*) buf_p );
|
||||||
|
buf_p += 2;
|
||||||
|
targa_header.width = _pico_little_short( *(short*) buf_p );
|
||||||
|
buf_p += 2;
|
||||||
|
targa_header.height = _pico_little_short( *(short*) buf_p );
|
||||||
|
buf_p += 2;
|
||||||
|
targa_header.pixel_size = *buf_p++;
|
||||||
|
targa_header.attributes = *buf_p++;
|
||||||
|
|
||||||
|
if ( targa_header.image_type != 2 && targa_header.image_type != 10 && targa_header.image_type != 3 ) {
|
||||||
|
_pico_printf( PICO_ERROR, "Only type 2 (RGB), 3 (gray), and 10 (RGB) TGA images supported\n" );
|
||||||
|
pic = NULL;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( targa_header.colormap_type != 0 ) {
|
||||||
|
_pico_printf( PICO_ERROR, "Indexed color TGA images not supported\n" );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( targa_header.pixel_size != 32 && targa_header.pixel_size != 24 && targa_header.image_type != 3 ) {
|
||||||
|
_pico_printf( PICO_ERROR, "Only 32 or 24 bit TGA images supported (not indexed color)\n" );
|
||||||
|
pic = NULL;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
columns = targa_header.width;
|
||||||
|
rows = targa_header.height;
|
||||||
|
numPixels = columns * rows;
|
||||||
|
|
||||||
|
if ( width ) {
|
||||||
|
*width = columns;
|
||||||
|
}
|
||||||
|
if ( height ) {
|
||||||
|
*height = rows;
|
||||||
|
}
|
||||||
|
|
||||||
|
targa_rgba = _pico_alloc( numPixels * 4 );
|
||||||
|
*pic = targa_rgba;
|
||||||
|
|
||||||
|
if ( targa_header.id_length != 0 ) {
|
||||||
|
buf_p += targa_header.id_length; // skip TARGA image comment
|
||||||
|
|
||||||
|
}
|
||||||
|
if ( targa_header.image_type == 2 || targa_header.image_type == 3 ) {
|
||||||
|
// Uncompressed RGB or gray scale image
|
||||||
|
for ( row = rows - 1; row >= 0; row-- )
|
||||||
|
{
|
||||||
|
pixbuf = targa_rgba + row * columns * 4;
|
||||||
|
for ( column = 0; column < columns; column++ )
|
||||||
|
{
|
||||||
|
unsigned char red,green,blue,alphabyte;
|
||||||
|
switch ( targa_header.pixel_size )
|
||||||
|
{
|
||||||
|
|
||||||
|
case 8:
|
||||||
|
blue = *buf_p++;
|
||||||
|
green = blue;
|
||||||
|
red = blue;
|
||||||
|
*pixbuf++ = red;
|
||||||
|
*pixbuf++ = green;
|
||||||
|
*pixbuf++ = blue;
|
||||||
|
*pixbuf++ = 255;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 24:
|
||||||
|
blue = *buf_p++;
|
||||||
|
green = *buf_p++;
|
||||||
|
red = *buf_p++;
|
||||||
|
*pixbuf++ = red;
|
||||||
|
*pixbuf++ = green;
|
||||||
|
*pixbuf++ = blue;
|
||||||
|
*pixbuf++ = 255;
|
||||||
|
break;
|
||||||
|
case 32:
|
||||||
|
blue = *buf_p++;
|
||||||
|
green = *buf_p++;
|
||||||
|
red = *buf_p++;
|
||||||
|
alphabyte = *buf_p++;
|
||||||
|
*pixbuf++ = red;
|
||||||
|
*pixbuf++ = green;
|
||||||
|
*pixbuf++ = blue;
|
||||||
|
*pixbuf++ = alphabyte;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* rle encoded pixels */
|
||||||
|
else if ( targa_header.image_type == 10 ) {
|
||||||
|
unsigned char red,green,blue,alphabyte,packetHeader,packetSize,j;
|
||||||
|
|
||||||
|
red = 0;
|
||||||
|
green = 0;
|
||||||
|
blue = 0;
|
||||||
|
alphabyte = 0xff;
|
||||||
|
|
||||||
|
for ( row = rows - 1; row >= 0; row-- ) {
|
||||||
|
pixbuf = targa_rgba + row * columns * 4;
|
||||||
|
for ( column = 0; column < columns; ) {
|
||||||
|
packetHeader = *buf_p++;
|
||||||
|
packetSize = 1 + ( packetHeader & 0x7f );
|
||||||
|
if ( packetHeader & 0x80 ) { // run-length packet
|
||||||
|
switch ( targa_header.pixel_size ) {
|
||||||
|
case 24:
|
||||||
|
blue = *buf_p++;
|
||||||
|
green = *buf_p++;
|
||||||
|
red = *buf_p++;
|
||||||
|
alphabyte = 255;
|
||||||
|
break;
|
||||||
|
case 32:
|
||||||
|
blue = *buf_p++;
|
||||||
|
green = *buf_p++;
|
||||||
|
red = *buf_p++;
|
||||||
|
alphabyte = *buf_p++;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
//Error("LoadTGA: illegal pixel_size '%d' in file '%s'\n", targa_header.pixel_size, name );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
for ( j = 0; j < packetSize; j++ ) {
|
||||||
|
*pixbuf++ = red;
|
||||||
|
*pixbuf++ = green;
|
||||||
|
*pixbuf++ = blue;
|
||||||
|
*pixbuf++ = alphabyte;
|
||||||
|
column++;
|
||||||
|
if ( column == columns ) { // run spans across rows
|
||||||
|
column = 0;
|
||||||
|
if ( row > 0 ) {
|
||||||
|
row--;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
goto breakOut;
|
||||||
|
}
|
||||||
|
pixbuf = targa_rgba + row * columns * 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else { // non run-length packet
|
||||||
|
for ( j = 0; j < packetSize; j++ ) {
|
||||||
|
switch ( targa_header.pixel_size ) {
|
||||||
|
case 24:
|
||||||
|
blue = *buf_p++;
|
||||||
|
green = *buf_p++;
|
||||||
|
red = *buf_p++;
|
||||||
|
*pixbuf++ = red;
|
||||||
|
*pixbuf++ = green;
|
||||||
|
*pixbuf++ = blue;
|
||||||
|
*pixbuf++ = 255;
|
||||||
|
break;
|
||||||
|
case 32:
|
||||||
|
blue = *buf_p++;
|
||||||
|
green = *buf_p++;
|
||||||
|
red = *buf_p++;
|
||||||
|
alphabyte = *buf_p++;
|
||||||
|
*pixbuf++ = red;
|
||||||
|
*pixbuf++ = green;
|
||||||
|
*pixbuf++ = blue;
|
||||||
|
*pixbuf++ = alphabyte;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
//Sysprintf("LoadTGA: illegal pixel_size '%d' in file '%s'\n", targa_header.pixel_size, name );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
column++;
|
||||||
|
if ( column == columns ) { // pixel packet run spans across rows
|
||||||
|
column = 0;
|
||||||
|
if ( row > 0 ) {
|
||||||
|
row--;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
goto breakOut;
|
||||||
|
}
|
||||||
|
pixbuf = targa_rgba + row * columns * 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
breakOut:;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* fix vertically flipped image */
|
||||||
|
if ( ( targa_header.attributes & ( 1 << 5 ) ) ) {
|
||||||
|
int flip;
|
||||||
|
for ( row = 0; row < .5f * rows; row++ )
|
||||||
|
{
|
||||||
|
for ( column = 0; column < columns; column++ )
|
||||||
|
{
|
||||||
|
flip = *( (int*)targa_rgba + row * columns + column );
|
||||||
|
*( (int*)targa_rgba + row * columns + column ) = *( (int*)targa_rgba + ( ( rows - 1 ) - row ) * columns + column );
|
||||||
|
*( (int*)targa_rgba + ( ( rows - 1 ) - row ) * columns + column ) = flip;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
_terrain_canload()
|
||||||
|
validates a picoterrain file
|
||||||
|
*/
|
||||||
|
|
||||||
|
static int _terrain_canload( PM_PARAMS_CANLOAD ) {
|
||||||
|
picoParser_t *p;
|
||||||
|
|
||||||
|
|
||||||
|
/* keep the friggin compiler happy */
|
||||||
|
*fileName = *fileName;
|
||||||
|
|
||||||
|
/* create pico parser */
|
||||||
|
p = _pico_new_parser( (picoByte_t*) buffer, bufSize );
|
||||||
|
if ( p == NULL ) {
|
||||||
|
return PICO_PMV_ERROR_MEMORY;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* get first token */
|
||||||
|
if ( _pico_parse_first( p ) == NULL ) {
|
||||||
|
return PICO_PMV_ERROR_IDENT;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* check first token */
|
||||||
|
if ( _pico_stricmp( p->token, "picoterrain" ) ) {
|
||||||
|
_pico_free_parser( p );
|
||||||
|
return PICO_PMV_ERROR_IDENT;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* free the pico parser object */
|
||||||
|
_pico_free_parser( p );
|
||||||
|
|
||||||
|
/* file seems to be a valid picoterrain file */
|
||||||
|
return PICO_PMV_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
_terrain_load()
|
||||||
|
loads a picoterrain file
|
||||||
|
*/
|
||||||
|
|
||||||
|
static picoModel_t *_terrain_load( PM_PARAMS_LOAD ) {
|
||||||
|
int i, j, v, pw[ 5 ], r;
|
||||||
|
picoParser_t *p;
|
||||||
|
|
||||||
|
char *shader, *heightmapFile, *colormapFile;
|
||||||
|
picoVec3_t scale, origin;
|
||||||
|
|
||||||
|
unsigned char *imageBuffer;
|
||||||
|
int imageBufSize, w, h, cw, ch;
|
||||||
|
unsigned char *heightmap, *colormap, *heightPixel, *colorPixel;
|
||||||
|
|
||||||
|
picoModel_t *picoModel;
|
||||||
|
picoSurface_t *picoSurface;
|
||||||
|
picoShader_t *picoShader;
|
||||||
|
picoVec3_t xyz, normal;
|
||||||
|
picoVec2_t st;
|
||||||
|
picoColor_t color;
|
||||||
|
|
||||||
|
|
||||||
|
/* keep the friggin compiler happy */
|
||||||
|
*fileName = *fileName;
|
||||||
|
|
||||||
|
/* create pico parser */
|
||||||
|
p = _pico_new_parser( (picoByte_t*) buffer, bufSize );
|
||||||
|
if ( p == NULL ) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* get first token */
|
||||||
|
if ( _pico_parse_first( p ) == NULL ) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* check first token */
|
||||||
|
if ( _pico_stricmp( p->token, "picoterrain" ) ) {
|
||||||
|
_pico_printf( PICO_ERROR, "Invalid PicoTerrain model" );
|
||||||
|
_pico_free_parser( p );
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* setup */
|
||||||
|
shader = heightmapFile = colormapFile = NULL;
|
||||||
|
_pico_set_vec( scale, 512, 512, 32 );
|
||||||
|
|
||||||
|
/* parse ase model file */
|
||||||
|
while ( 1 )
|
||||||
|
{
|
||||||
|
/* get first token on line */
|
||||||
|
if ( !_pico_parse_first( p ) ) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* skip empty lines */
|
||||||
|
if ( !p->token || !p->token[ 0 ] ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* shader */
|
||||||
|
if ( !_pico_stricmp( p->token, "shader" ) ) {
|
||||||
|
if ( _pico_parse( p, 0 ) && p->token[ 0 ] ) {
|
||||||
|
if ( shader != NULL ) {
|
||||||
|
_pico_free( shader );
|
||||||
|
}
|
||||||
|
shader = _pico_clone_alloc( p->token );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* heightmap */
|
||||||
|
else if ( !_pico_stricmp( p->token, "heightmap" ) ) {
|
||||||
|
if ( _pico_parse( p, 0 ) && p->token[ 0 ] ) {
|
||||||
|
if ( heightmapFile != NULL ) {
|
||||||
|
_pico_free( heightmapFile );
|
||||||
|
}
|
||||||
|
heightmapFile = _pico_clone_alloc( p->token );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* colormap */
|
||||||
|
else if ( !_pico_stricmp( p->token, "colormap" ) ) {
|
||||||
|
if ( _pico_parse( p, 0 ) && p->token[ 0 ] ) {
|
||||||
|
if ( colormapFile != NULL ) {
|
||||||
|
_pico_free( colormapFile );
|
||||||
|
}
|
||||||
|
colormapFile = _pico_clone_alloc( p->token );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* scale */
|
||||||
|
else if ( !_pico_stricmp( p->token, "scale" ) ) {
|
||||||
|
_pico_parse_vec( p, scale );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* skip unparsed rest of line and continue */
|
||||||
|
_pico_parse_skip_rest( p );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------- */
|
||||||
|
|
||||||
|
/* load heightmap */
|
||||||
|
heightmap = imageBuffer = NULL;
|
||||||
|
_pico_load_file( heightmapFile, &imageBuffer, &imageBufSize );
|
||||||
|
_terrain_load_tga_buffer( imageBuffer, &heightmap, &w, &h );
|
||||||
|
_pico_free( heightmapFile );
|
||||||
|
_pico_free_file( imageBuffer );
|
||||||
|
|
||||||
|
if ( heightmap == NULL || w < 2 || h < 2 ) {
|
||||||
|
_pico_printf( PICO_ERROR, "PicoTerrain model with invalid heightmap" );
|
||||||
|
if ( shader != NULL ) {
|
||||||
|
_pico_free( shader );
|
||||||
|
}
|
||||||
|
if ( colormapFile != NULL ) {
|
||||||
|
_pico_free( colormapFile );
|
||||||
|
}
|
||||||
|
_pico_free_parser( p );
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* set origin (bottom lowest corner of terrain mesh) */
|
||||||
|
_pico_set_vec( origin, ( w / -2 ) * scale[ 0 ], ( h / -2 ) * scale[ 1 ], -128 * scale[ 2 ] );
|
||||||
|
|
||||||
|
/* load colormap */
|
||||||
|
colormap = imageBuffer = NULL;
|
||||||
|
_pico_load_file( colormapFile, &imageBuffer, &imageBufSize );
|
||||||
|
_terrain_load_tga_buffer( imageBuffer, &colormap, &cw, &ch );
|
||||||
|
_pico_free( colormapFile );
|
||||||
|
_pico_free_file( imageBuffer );
|
||||||
|
|
||||||
|
if ( cw != w || ch != h ) {
|
||||||
|
_pico_printf( PICO_WARNING, "PicoTerrain colormap/heightmap size mismatch" );
|
||||||
|
_pico_free( colormap );
|
||||||
|
colormap = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------- */
|
||||||
|
|
||||||
|
/* create new pico model */
|
||||||
|
picoModel = PicoNewModel();
|
||||||
|
if ( picoModel == NULL ) {
|
||||||
|
_pico_printf( PICO_ERROR, "Unable to allocate a new model" );
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* do model setup */
|
||||||
|
PicoSetModelFrameNum( picoModel, frameNum );
|
||||||
|
PicoSetModelNumFrames( picoModel, 1 ); /* sea */
|
||||||
|
PicoSetModelName( picoModel, fileName );
|
||||||
|
PicoSetModelFileName( picoModel, fileName );
|
||||||
|
|
||||||
|
/* allocate new pico surface */
|
||||||
|
picoSurface = PicoNewSurface( picoModel );
|
||||||
|
if ( picoSurface == NULL ) {
|
||||||
|
_pico_printf( PICO_ERROR, "Unable to allocate a new model surface" );
|
||||||
|
PicoFreeModel( picoModel ); /* sea */
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* terrain surfaces are triangle meshes */
|
||||||
|
PicoSetSurfaceType( picoSurface, PICO_TRIANGLES );
|
||||||
|
|
||||||
|
/* set surface name */
|
||||||
|
PicoSetSurfaceName( picoSurface, "picoterrain" );
|
||||||
|
|
||||||
|
/* create new pico shader */
|
||||||
|
picoShader = PicoNewShader( picoModel );
|
||||||
|
if ( picoShader == NULL ) {
|
||||||
|
_pico_printf( PICO_ERROR, "Unable to allocate a new model shader" );
|
||||||
|
PicoFreeModel( picoModel );
|
||||||
|
_pico_free( shader );
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* detox and set shader name */
|
||||||
|
_pico_setfext( shader, "" );
|
||||||
|
_pico_unixify( shader );
|
||||||
|
PicoSetShaderName( picoShader, shader );
|
||||||
|
_pico_free( shader );
|
||||||
|
|
||||||
|
/* associate current surface with newly created shader */
|
||||||
|
PicoSetSurfaceShader( picoSurface, picoShader );
|
||||||
|
|
||||||
|
/* make bogus normal */
|
||||||
|
_pico_set_vec( normal, 0.0f, 0.0f, 0.0f );
|
||||||
|
|
||||||
|
/* create mesh */
|
||||||
|
for ( j = 0; j < h; j++ )
|
||||||
|
{
|
||||||
|
for ( i = 0; i < w; i++ )
|
||||||
|
{
|
||||||
|
/* get pointers */
|
||||||
|
v = i + ( j * w );
|
||||||
|
heightPixel = heightmap + v * 4;
|
||||||
|
colorPixel = colormap
|
||||||
|
? colormap + v * 4
|
||||||
|
: NULL;
|
||||||
|
|
||||||
|
/* set xyz */
|
||||||
|
_pico_set_vec( xyz, origin[ 0 ] + scale[ 0 ] * i,
|
||||||
|
origin[ 1 ] + scale[ 1 ] * j,
|
||||||
|
origin[ 2 ] + scale[ 2 ] * heightPixel[ 0 ] );
|
||||||
|
PicoSetSurfaceXYZ( picoSurface, v, xyz );
|
||||||
|
|
||||||
|
/* set normal */
|
||||||
|
PicoSetSurfaceNormal( picoSurface, v, normal );
|
||||||
|
|
||||||
|
/* set st */
|
||||||
|
st[ 0 ] = (float) i;
|
||||||
|
st[ 1 ] = (float) j;
|
||||||
|
PicoSetSurfaceST( picoSurface, 0, v, st );
|
||||||
|
|
||||||
|
/* set color */
|
||||||
|
if ( colorPixel != NULL ) {
|
||||||
|
_pico_set_color( color, colorPixel[ 0 ], colorPixel[ 1 ], colorPixel[ 2 ], colorPixel[ 3 ] );
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
_pico_set_color( color, 255, 255, 255, 255 );
|
||||||
|
}
|
||||||
|
PicoSetSurfaceColor( picoSurface, 0, v, color );
|
||||||
|
|
||||||
|
/* set triangles (zero alpha in heightmap suppresses this quad) */
|
||||||
|
if ( i < ( w - 1 ) && j < ( h - 1 ) && heightPixel[ 3 ] >= 128 ) {
|
||||||
|
/* set indexes */
|
||||||
|
pw[ 0 ] = i + ( j * w );
|
||||||
|
pw[ 1 ] = i + ( ( j + 1 ) * w );
|
||||||
|
pw[ 2 ] = i + 1 + ( ( j + 1 ) * w );
|
||||||
|
pw[ 3 ] = i + 1 + ( j * w );
|
||||||
|
pw[ 4 ] = i + ( j * w ); /* same as pw[ 0 ] */
|
||||||
|
|
||||||
|
/* set radix */
|
||||||
|
r = ( i + j ) & 1;
|
||||||
|
|
||||||
|
/* make first triangle */
|
||||||
|
PicoSetSurfaceIndex( picoSurface, ( v * 6 + 0 ), (picoIndex_t) pw[ r + 0 ] );
|
||||||
|
PicoSetSurfaceIndex( picoSurface, ( v * 6 + 1 ), (picoIndex_t) pw[ r + 1 ] );
|
||||||
|
PicoSetSurfaceIndex( picoSurface, ( v * 6 + 2 ), (picoIndex_t) pw[ r + 2 ] );
|
||||||
|
|
||||||
|
/* make second triangle */
|
||||||
|
PicoSetSurfaceIndex( picoSurface, ( v * 6 + 3 ), (picoIndex_t) pw[ r + 0 ] );
|
||||||
|
PicoSetSurfaceIndex( picoSurface, ( v * 6 + 4 ), (picoIndex_t) pw[ r + 2 ] );
|
||||||
|
PicoSetSurfaceIndex( picoSurface, ( v * 6 + 5 ), (picoIndex_t) pw[ r + 3 ] );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* free stuff */
|
||||||
|
_pico_free_parser( p );
|
||||||
|
_pico_free( heightmap );
|
||||||
|
_pico_free( colormap );
|
||||||
|
|
||||||
|
/* return the new pico model */
|
||||||
|
return picoModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* pico file format module definition */
|
||||||
|
const picoModule_t picoModuleTerrain =
|
||||||
|
{
|
||||||
|
"1.3", /* module version string */
|
||||||
|
"PicoTerrain", /* module display name */
|
||||||
|
"Randy Reddig", /* author's name */
|
||||||
|
"2003 Randy Reddig", /* module copyright */
|
||||||
|
{
|
||||||
|
"picoterrain", NULL, NULL, NULL /* default extensions to use */
|
||||||
|
},
|
||||||
|
_terrain_canload, /* validation routine */
|
||||||
|
_terrain_load, /* load routine */
|
||||||
|
NULL, /* save validation routine */
|
||||||
|
NULL /* save routine */
|
||||||
|
};
|
|
@ -38,7 +38,7 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
<PlatformToolset>v110_xp</PlatformToolset>
|
<PlatformToolset>v140</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
<ImportGroup Label="ExtensionSettings">
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
|
|
@ -91,7 +91,7 @@
|
||||||
/*!
|
/*!
|
||||||
=======================================================================
|
=======================================================================
|
||||||
diagnostic printing facility
|
diagnostic printing facility
|
||||||
independently from any API negociation stuff,
|
independently from any API negotiation stuff,
|
||||||
we need a diagnostic facility that's available at all times
|
we need a diagnostic facility that's available at all times
|
||||||
=======================================================================
|
=======================================================================
|
||||||
*/
|
*/
|
||||||
|
@ -219,7 +219,7 @@ void SetType( EAPIManagerType type ) { mType = type; }
|
||||||
set the API matching pattern
|
set the API matching pattern
|
||||||
supported syntax:
|
supported syntax:
|
||||||
any minor for a given major, for instance: PLUGIN_MAJOR, "*"
|
any minor for a given major, for instance: PLUGIN_MAJOR, "*"
|
||||||
a space seperated list of minors for a given major: IMAGE_MAJOR, "tga jpg"
|
a space separated list of minors for a given major: IMAGE_MAJOR, "tga jpg"
|
||||||
*/
|
*/
|
||||||
void SetMatchAPI( const char *major, const char *minor );
|
void SetMatchAPI( const char *major, const char *minor );
|
||||||
|
|
||||||
|
@ -236,8 +236,8 @@ static APIDescriptor_t* PrepareRequireAPI( APIDescriptor_t *pAPI );
|
||||||
bool CheckSetActive();
|
bool CheckSetActive();
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
the manager answers wether it wants to load this or not
|
the manager answers whether it wants to load this or not
|
||||||
we provide a default implementation, but this can be completely overriden if needed
|
we provide a default implementation, but this can be completely overridden if needed
|
||||||
see SetMatchAPI for the documentation of the default implementation
|
see SetMatchAPI for the documentation of the default implementation
|
||||||
NOTE: this should only be called on API_MATCH type of managers
|
NOTE: this should only be called on API_MATCH type of managers
|
||||||
*/
|
*/
|
||||||
|
@ -279,8 +279,8 @@ class CSynapseServer; // forward declare
|
||||||
class CSynapseClient : public IRefCounted
|
class CSynapseClient : public IRefCounted
|
||||||
{
|
{
|
||||||
/*!
|
/*!
|
||||||
this flag indicates wether this client is active
|
this flag indicates whether this client is active
|
||||||
i.e. wether you can ask it for interfaces
|
i.e. whether you can ask it for interfaces
|
||||||
this is either a client for which all required interfaces have been filled in
|
this is either a client for which all required interfaces have been filled in
|
||||||
or a client we are trying to resolve (i.e. load with all it's stuff)
|
or a client we are trying to resolve (i.e. load with all it's stuff)
|
||||||
*/
|
*/
|
||||||
|
@ -324,7 +324,7 @@ APIDescriptor_t* GetAPIDescriptor( int ) const; ///< retrieve specific informati
|
||||||
SYN_PROVIDE: means this is an API we provide if anyone needs it
|
SYN_PROVIDE: means this is an API we provide if anyone needs it
|
||||||
SYN_REQUIRE: means this is an API we will require for operation
|
SYN_REQUIRE: means this is an API we will require for operation
|
||||||
SYN_REQUIRE_ANY: means this is an API we want to load *any* minor found
|
SYN_REQUIRE_ANY: means this is an API we want to load *any* minor found
|
||||||
(for instance a list of image fornats, or the plugins)
|
(for instance a list of image formats, or the plugins)
|
||||||
|
|
||||||
\param pTable
|
\param pTable
|
||||||
the function table
|
the function table
|
||||||
|
@ -363,7 +363,7 @@ CSynapseAPIManager* GetManagerList( int ); ///< get corresponding API manager
|
||||||
virtual bool RequestAPI( APIDescriptor_t *pAPI ) = 0;
|
virtual bool RequestAPI( APIDescriptor_t *pAPI ) = 0;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
return the build date, can be overriden by client module
|
return the build date, can be overridden by client module
|
||||||
*/
|
*/
|
||||||
virtual const char* GetInfo();
|
virtual const char* GetInfo();
|
||||||
|
|
||||||
|
@ -405,7 +405,7 @@ virtual bool OnActivate() { return true; }
|
||||||
|
|
||||||
\param client_name, the name of the client node to look for. If NULL, use GetName()
|
\param client_name, the name of the client node to look for. If NULL, use GetName()
|
||||||
|
|
||||||
\return wether all APIs given were successfully found in the config
|
\return whether all APIs given were successfully found in the config
|
||||||
*/
|
*/
|
||||||
bool ConfigXML( CSynapseServer *pServer, const char *client_name, const XMLConfigEntry_t entries[] );
|
bool ConfigXML( CSynapseServer *pServer, const char *client_name, const XMLConfigEntry_t entries[] );
|
||||||
|
|
||||||
|
@ -451,7 +451,7 @@ typedef enum { SYN_SO, SYN_BUILTIN } EClientType;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
server side slot for a synapse client
|
server side slot for a synapse client
|
||||||
is OS dependant, except for the ISynapseClient part
|
is OS dependent, except for the ISynapseClient part
|
||||||
*/
|
*/
|
||||||
class CSynapseClientSlot
|
class CSynapseClientSlot
|
||||||
{
|
{
|
||||||
|
@ -517,7 +517,7 @@ gchar *m_content;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
push required interfaces for this client into the stack of things to be resolved
|
push required interfaces for this client into the stack of things to be resolved
|
||||||
it is possible that several mathing interfaces be in the stack at the same time
|
it is possible that several matching interfaces be in the stack at the same time
|
||||||
(for instance several modules that want to get the VFS)
|
(for instance several modules that want to get the VFS)
|
||||||
but we should never have the same APIDescriptor_t twice
|
but we should never have the same APIDescriptor_t twice
|
||||||
NOTE: as this function is called repeatedly during the resolve (because the list of required things is refining),
|
NOTE: as this function is called repeatedly during the resolve (because the list of required things is refining),
|
||||||
|
@ -567,8 +567,8 @@ void AddSearchPath( char* ); ///< add a new directory to the module search path
|
||||||
/*!
|
/*!
|
||||||
do the big thing, scan for modules, scan their APIs, load up everything
|
do the big thing, scan for modules, scan their APIs, load up everything
|
||||||
providing pf is optional, will set the diagnostics printing
|
providing pf is optional, will set the diagnostics printing
|
||||||
\param conf_file is the XML configuration file for the intialization (see docs/runtime.txt)
|
\param conf_file is the XML configuration file for the initialization (see docs/runtime.txt)
|
||||||
\return false if the init failed (for instance not found/invalid conf file
|
\return false if the init failed (for instance not found/invalid configuration file
|
||||||
*/
|
*/
|
||||||
bool Initialize( const char* conf_file = NULL, PFN_SYN_PRINTF_VA pf = NULL );
|
bool Initialize( const char* conf_file = NULL, PFN_SYN_PRINTF_VA pf = NULL );
|
||||||
|
|
||||||
|
@ -593,8 +593,8 @@ bool Resolve( CSynapseClient *pClient );
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief shutdown all the clients. Should only be called when the core is about to exit
|
\brief shutdown all the clients. Should only be called when the core is about to exit
|
||||||
this will force all clients to shutdown. it may destroy refcounted APIs and stuff
|
this will force all clients to shutdown. it may destroy refcounted APIs and such
|
||||||
\todo hafta use the release/refresh code before doing actual shutdown
|
\todo have to use the release/refresh code before doing actual shutdown
|
||||||
(i.e. when that code is written later on)
|
(i.e. when that code is written later on)
|
||||||
we need to 'broadcast' to all the clients .. that all the modules are going to be reloaded sorta
|
we need to 'broadcast' to all the clients .. that all the modules are going to be reloaded sorta
|
||||||
should clear up as many interfaces as possible to avoid unexpected crashes in the final stages of app exit
|
should clear up as many interfaces as possible to avoid unexpected crashes in the final stages of app exit
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
<PlatformToolset>v110_xp</PlatformToolset>
|
<PlatformToolset>v140</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
<ImportGroup Label="ExtensionSettings">
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
@ -123,6 +123,9 @@
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="synapse.cpp" />
|
<ClCompile Include="synapse.cpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="..\synapse.h" />
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
<ImportGroup Label="ExtensionTargets">
|
<ImportGroup Label="ExtensionTargets">
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
|
|
|
@ -11,4 +11,9 @@
|
||||||
<Filter>src</Filter>
|
<Filter>src</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="..\synapse.h">
|
||||||
|
<Filter>src</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
|
@ -38,7 +38,7 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<PlatformToolset>v110_xp</PlatformToolset>
|
<PlatformToolset>v140</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
<ImportGroup Label="ExtensionSettings">
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
|
|
@ -402,12 +402,12 @@ void EClass_ImportFromClass( eclass_t *e, GSList *l_classes, class_t *bc ){
|
||||||
|
|
||||||
// make sure we don't request ourself!
|
// make sure we don't request ourself!
|
||||||
if ( rbc == bc ) {
|
if ( rbc == bc ) {
|
||||||
Sys_Printf( "WARNING: baseclass '%s' tried to request itself!\n", bclst->data );
|
Sys_FPrintf( SYS_WRN, "WARNING: baseclass '%s' tried to request itself!\n", bclst->data );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( !rbc ) {
|
if ( !rbc ) {
|
||||||
Sys_Printf( "WARNING: could not find the requested baseclass '%s' when building '%s'\n", requestedclass,bc->classname );
|
Sys_FPrintf( SYS_WRN, "WARNING: could not find the requested baseclass '%s' when building '%s'\n", requestedclass,bc->classname );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -494,7 +494,7 @@ void EClass_ImportFromClass( eclass_t *e, GSList *l_classes, class_t *bc ){
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Sys_Printf( "WARNING: baseclass '%s' has a spawnflag out of range, ignored!\n", bc->classname );
|
Sys_FPrintf( SYS_WRN, "WARNING: baseclass '%s' has a spawnflag out of range, ignored!\n", bc->classname );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1015,7 +1015,7 @@ void Eclass_ScanFile( char *filename ){
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Sys_Printf( "%WARNING: Parse error occured in '%s - %s'\n",classnames[newclass->classtype],newclass->classname );
|
Sys_FPrintf( SYS_WRN, "WARNING: Parse error occured in '%s - %s'\n",classnames[newclass->classtype],newclass->classname );
|
||||||
Free_Option( newoption );
|
Free_Option( newoption );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -152,7 +152,7 @@ void CEntityEclassModel::UpdateCachedData(){
|
||||||
m4x4_pivoted_transform_by_vec3( m_transform, m_translate, m_euler, eXYZ, m_scale, m_pivot );
|
m4x4_pivoted_transform_by_vec3( m_transform, m_translate, m_euler, eXYZ, m_scale, m_pivot );
|
||||||
memcpy( m_inverse_transform, m_transform, sizeof( m4x4_t ) );
|
memcpy( m_inverse_transform, m_transform, sizeof( m4x4_t ) );
|
||||||
if ( m4x4_invert( m_inverse_transform ) == 1 ) {
|
if ( m4x4_invert( m_inverse_transform ) == 1 ) {
|
||||||
Sys_Printf( "ERROR: Singular Matrix, cannot invert" );
|
Sys_FPrintf( SYS_ERR, "ERROR: Singular Matrix, cannot invert" );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( m_eclass ) {
|
if ( m_eclass ) {
|
||||||
|
|
|
@ -326,7 +326,7 @@ epair_t** Entity_GetKeyValList( entity_t *e ){
|
||||||
|
|
||||||
void Entity_SetKeyValList( entity_t *e, epair_t* ep ){
|
void Entity_SetKeyValList( entity_t *e, epair_t* ep ){
|
||||||
if ( e->epairs ) {
|
if ( e->epairs ) {
|
||||||
Sys_Printf( "Warning : pe->epairs != NULL in Entity_SetKeyValList, will not set\n" );
|
Sys_FPrintf( SYS_WRN, "Warning : pe->epairs != NULL in Entity_SetKeyValList, will not set\n" );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
e->epairs = ep;
|
e->epairs = ep;
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<PlatformToolset>v110_xp</PlatformToolset>
|
<PlatformToolset>v140</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
<ImportGroup Label="ExtensionSettings">
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
#include "entity_entitymodel.h"
|
#include "entity_entitymodel.h"
|
||||||
#include "entity.h"
|
#include "entity.h"
|
||||||
|
@ -201,9 +202,11 @@ void CEntityMiscModel::SetName( const char *name ){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( m_cachereq.GetBuffer()[0] != ':'
|
if ( m_oldcachereq.GetBuffer()[0] != ':'
|
||||||
&& m_version.c_str()[0] != '\0' ) {
|
&& m_version.c_str()[0] != '\0' ) {
|
||||||
GetModelCache()->DeleteByID( m_cachereq.GetBuffer(), m_version.c_str() );
|
GetModelCache()->DeleteByID( m_oldcachereq.GetBuffer(), m_version.c_str() );
|
||||||
|
} else {
|
||||||
|
assert(m_model == NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_model = NULL;
|
m_model = NULL;
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<PlatformToolset>v110_xp</PlatformToolset>
|
<PlatformToolset>v140</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
<ImportGroup Label="ExtensionSettings">
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<PlatformToolset>v110_xp</PlatformToolset>
|
<PlatformToolset>v140</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
<ImportGroup Label="ExtensionSettings">
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
|
|
@ -148,14 +148,14 @@ static void LoadIDSP( const char *name, byte ** pic, int *width, int *height ){
|
||||||
header = (dspriteheader_t *)buffer;
|
header = (dspriteheader_t *)buffer;
|
||||||
|
|
||||||
if ( header->ident != IDSPRITEHEADER ) {
|
if ( header->ident != IDSPRITEHEADER ) {
|
||||||
Sys_Printf( "WARNING: %s has wrong header\n" );
|
Sys_FPrintf( SYS_WRN, "WARNING: %s has wrong header\n" );
|
||||||
vfsFreeFile( buffer );
|
vfsFreeFile( buffer );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
version = header->version;
|
version = header->version;
|
||||||
if ( version != 1 && version != 2 ) {
|
if ( version != 1 && version != 2 ) {
|
||||||
Sys_Printf( "WARNING: %s has wrong version number "
|
Sys_FPrintf( SYS_WRN, "WARNING: %s has wrong version number "
|
||||||
"(%i should be 1 or 2)\n", name, version );
|
"(%i should be 1 or 2)\n", name, version );
|
||||||
vfsFreeFile( buffer );
|
vfsFreeFile( buffer );
|
||||||
return;
|
return;
|
||||||
|
@ -180,7 +180,7 @@ static void LoadIDSP( const char *name, byte ** pic, int *width, int *height ){
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if ( numframes > 1 ) {
|
if ( numframes > 1 ) {
|
||||||
Sys_Printf( "WARNING: %s has multiple frames, only the first frame will be used.\n", name );
|
Sys_FPrintf( SYS_WRN, "WARNING: %s has multiple frames, only the first frame will be used.\n", name );
|
||||||
}
|
}
|
||||||
|
|
||||||
// palette = buffer+mipdatasize+2;
|
// palette = buffer+mipdatasize+2;
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<PlatformToolset>v110_xp</PlatformToolset>
|
<PlatformToolset>v140</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
<ImportGroup Label="ExtensionSettings">
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<PlatformToolset>v110_xp</PlatformToolset>
|
<PlatformToolset>v140</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
<ImportGroup Label="ExtensionSettings">
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<PlatformToolset>v110_xp</PlatformToolset>
|
<PlatformToolset>v140</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
<ImportGroup Label="ExtensionSettings">
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<PlatformToolset>v110_xp</PlatformToolset>
|
<PlatformToolset>v140</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
<ImportGroup Label="ExtensionSettings">
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
|
|
@ -338,7 +338,7 @@ void Face_Parse( face_t *face, bool bAlternateTexdef = false ){
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// using the cache below means that this message is only ever printed out once!
|
// using the cache below means that this message is only ever printed out once!
|
||||||
Sys_Printf( "WARNING: could not find \"%s\" in any listed wad files, searching all wad files instead!\n",token );
|
Sys_FPrintf( SYS_WRN, "WARNING: could not find \"%s\" in any listed wad files, searching all wad files instead!\n",token );
|
||||||
}
|
}
|
||||||
// end of half-life specific bit.
|
// end of half-life specific bit.
|
||||||
|
|
||||||
|
@ -390,7 +390,7 @@ void Face_Parse( face_t *face, bool bAlternateTexdef = false ){
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Sys_Printf( "WARNING: could not find \"%s\" in the vfs search path\n",token );
|
Sys_FPrintf( SYS_WRN, "WARNING: could not find \"%s\" in the vfs search path\n",token );
|
||||||
str = new char[strlen( token ) + 10];
|
str = new char[strlen( token ) + 10];
|
||||||
strcpy( str, "textures/" );
|
strcpy( str, "textures/" );
|
||||||
strcpy( str + 9, token );
|
strcpy( str + 9, token );
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<PlatformToolset>v110_xp</PlatformToolset>
|
<PlatformToolset>v140</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
<ImportGroup Label="ExtensionSettings">
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
|
|
@ -38,6 +38,8 @@ CPicoSurface::CPicoSurface( picoSurface_t *pSurface ){
|
||||||
// directory as a fall-back. This is a hack for malformed models.
|
// directory as a fall-back. This is a hack for malformed models.
|
||||||
|
|
||||||
if ( m_shader->IsDefault() ) {
|
if ( m_shader->IsDefault() ) {
|
||||||
|
Sys_FPrintf( SYS_WRN, "WARNING: Failed to load shader %s for %s\n", m_shader->getName(), m_pSurface->model->name );
|
||||||
|
|
||||||
gchar *dir = g_path_get_dirname( m_pSurface->model->name );
|
gchar *dir = g_path_get_dirname( m_pSurface->model->name );
|
||||||
gchar *skin = g_strdup_printf( "%s/skin.tga", dir );
|
gchar *skin = g_strdup_printf( "%s/skin.tga", dir );
|
||||||
|
|
||||||
|
@ -144,7 +146,7 @@ void CPicoSurface::Draw( int state, IShader *pShader, int rflags ){
|
||||||
g_QglTable.m_pfn_qglEnd();*/
|
g_QglTable.m_pfn_qglEnd();*/
|
||||||
|
|
||||||
break;
|
break;
|
||||||
default: Sys_Printf( "ERROR: Unsupported Pico Surface Type: %i", PicoGetSurfaceType( m_pSurface ) );
|
default: Sys_FPrintf( SYS_ERR, "ERROR: Unsupported Pico Surface Type: %i", PicoGetSurfaceType( m_pSurface ) );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -203,7 +205,7 @@ bool CPicoSurface::TestRay( const ray_t *ray, vec_t *dist ) const {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Sys_Printf( "ERROR: Unsupported Pico Surface Type: %i", PicoGetSurfaceType( m_pSurface ) );
|
Sys_FPrintf( SYS_ERR, "ERROR: Unsupported Pico Surface Type: %i", PicoGetSurfaceType( m_pSurface ) );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -317,7 +317,7 @@ void CEntityMiscModel::UpdateCachedData(){
|
||||||
m4x4_pivoted_transform_by_vec3( m_transform, m_translate, m_euler, m_scale, m_pivot );
|
m4x4_pivoted_transform_by_vec3( m_transform, m_translate, m_euler, m_scale, m_pivot );
|
||||||
memcpy( m_inverse_transform, m_transform, sizeof( m4x4_t ) );
|
memcpy( m_inverse_transform, m_transform, sizeof( m4x4_t ) );
|
||||||
if ( m4x4_invert( m_inverse_transform ) == 1 ) {
|
if ( m4x4_invert( m_inverse_transform ) == 1 ) {
|
||||||
Sys_Printf( "ERROR: Singular Matrix, cannot invert" );
|
Sys_FPrintf( SYS_ERR, "ERROR: Singular Matrix, cannot invert" );
|
||||||
}
|
}
|
||||||
|
|
||||||
aabb_clear( &aabb_temp );
|
aabb_clear( &aabb_temp );
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<PlatformToolset>v110_xp</PlatformToolset>
|
<PlatformToolset>v140</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
<ImportGroup Label="ExtensionSettings">
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
|
|
@ -74,7 +74,7 @@ void PicoPrintFunc( int level, const char *str ){
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PICO_WARNING:
|
case PICO_WARNING:
|
||||||
Sys_Printf( "WARNING: %s\n", str );
|
Sys_FPrintf( SYS_WRN, "WARNING: %s\n", str );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PICO_ERROR:
|
case PICO_ERROR:
|
||||||
|
@ -82,7 +82,7 @@ void PicoPrintFunc( int level, const char *str ){
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PICO_FATAL:
|
case PICO_FATAL:
|
||||||
Sys_Printf( "ERROR: %s\n", str );
|
Sys_FPrintf( SYS_ERR, "ERROR: %s\n", str );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,6 +53,7 @@ extern _QERBrushTable g_BrushTable;
|
||||||
#define vfsLoadFile g_VFSTable.m_pfnLoadFile
|
#define vfsLoadFile g_VFSTable.m_pfnLoadFile
|
||||||
#define vfsFreeFile g_VFSTable.m_pfnFreeFile
|
#define vfsFreeFile g_VFSTable.m_pfnFreeFile
|
||||||
#define Sys_Printf g_FuncTable.m_pfnSysPrintf
|
#define Sys_Printf g_FuncTable.m_pfnSysPrintf
|
||||||
|
#define Sys_FPrintf g_FuncTable.m_pfnSysFPrintf
|
||||||
|
|
||||||
class CSynapseClientShaders : public CSynapseClient
|
class CSynapseClientShaders : public CSynapseClient
|
||||||
{
|
{
|
||||||
|
|
|
@ -188,7 +188,7 @@ void CShaderArray::operator =( const class CShaderArray & src ){
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
if ( CPtrArray::GetSize() != 0 ) {
|
if ( CPtrArray::GetSize() != 0 ) {
|
||||||
Sys_Printf( "WARNING: CShaderArray::operator = expects an empty array\n" );
|
Sys_FPrintf( SYS_WRN, "WARNING: CShaderArray::operator = expects an empty array\n" );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
Copy( src );
|
Copy( src );
|
||||||
|
@ -239,7 +239,7 @@ char *ShaderNameLookup( patchMesh_t * patch ){
|
||||||
return static_cast < patchEntry_t * >( PatchShaders.GetAt( i ) )->name;
|
return static_cast < patchEntry_t * >( PatchShaders.GetAt( i ) )->name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Sys_Printf( "ERROR: failed to lookup name in ShaderNameLookup??\n" );
|
Sys_FPrintf( SYS_ERR, "ERROR: failed to lookup name in ShaderNameLookup??\n" );
|
||||||
return const_cast<char*>(SHADER_NOT_FOUND);
|
return const_cast<char*>(SHADER_NOT_FOUND);
|
||||||
}
|
}
|
||||||
//++timo end clean
|
//++timo end clean
|
||||||
|
@ -420,7 +420,7 @@ int WINAPI QERApp_LoadShadersFromDir( const char *path ){
|
||||||
// check we activated the right shader
|
// check we activated the right shader
|
||||||
// NOTE: if there was something else loaded, the size of g_Shaders may have changed and strange behaviours are to be expected
|
// NOTE: if there was something else loaded, the size of g_Shaders may have changed and strange behaviours are to be expected
|
||||||
if ( pFoo != pShader ) {
|
if ( pFoo != pShader ) {
|
||||||
Sys_Printf( "WARNING: unexpected pFoo != pShader in QERApp_LoadShadersFromDir\n" );
|
Sys_FPrintf( SYS_WRN, "WARNING: unexpected pFoo != pShader in QERApp_LoadShadersFromDir\n" );
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
pFoo = NULL; // leo: shut up the compiler
|
pFoo = NULL; // leo: shut up the compiler
|
||||||
|
@ -606,7 +606,7 @@ void WINAPI QERApp_LoadShaderFile( const char *filename ){
|
||||||
//++timo NOTE: this may a bit slow, we may need to use a map instead of a dumb list
|
//++timo NOTE: this may a bit slow, we may need to use a map instead of a dumb list
|
||||||
if ( g_Shaders.Shader_ForName( pShader->getName() ) != NULL ) {
|
if ( g_Shaders.Shader_ForName( pShader->getName() ) != NULL ) {
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
Sys_Printf( "WARNING: shader %s is already in memory, definition in %s ignored.\n",
|
Sys_FPrintf( SYS_WRN, "WARNING: shader %s is already in memory, definition in %s ignored.\n",
|
||||||
pShader->getName(), filename );
|
pShader->getName(), filename );
|
||||||
#endif
|
#endif
|
||||||
delete pShader;
|
delete pShader;
|
||||||
|
@ -620,7 +620,7 @@ void WINAPI QERApp_LoadShaderFile( const char *filename ){
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Sys_Printf( "Error parsing shader %s\n", pShader->getName() );
|
Sys_FPrintf( SYS_ERR, "ERROR: parsing shader %s\n", pShader->getName() );
|
||||||
delete pShader;
|
delete pShader;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -628,7 +628,7 @@ void WINAPI QERApp_LoadShaderFile( const char *filename ){
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Sys_Printf( "Unable to read shaderfile %s\n", filename );
|
Sys_FPrintf( SYS_ERR, "ERROR: Unable to read shaderfile %s\n", filename );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -658,7 +658,7 @@ IShader *WINAPI QERApp_CreateShader_ForTextureName( const char *name ){
|
||||||
// Hydra: display an error message, so the user can quickly find a list of missing
|
// Hydra: display an error message, so the user can quickly find a list of missing
|
||||||
// textures by looking at the console.
|
// textures by looking at the console.
|
||||||
if ( !pShader->Activate() ) {
|
if ( !pShader->Activate() ) {
|
||||||
Sys_Printf( "WARNING: Activate shader failed for %s\n",pShader->getName() );
|
Sys_FPrintf( SYS_WRN, "WARNING: Activate shader failed for %s\n", pShader->getName() );
|
||||||
}
|
}
|
||||||
pShader->SetDisplayed( true );
|
pShader->SetDisplayed( true );
|
||||||
|
|
||||||
|
@ -706,7 +706,7 @@ qtexture_t *WINAPI QERApp_Try_Texture_ForName( const char *name ){
|
||||||
for ( q = g_qeglobals.d_qtextures; q; q = q->next )
|
for ( q = g_qeglobals.d_qtextures; q; q = q->next )
|
||||||
{
|
{
|
||||||
if ( !strcmp( stdName, q->name ) ) {
|
if ( !strcmp( stdName, q->name ) ) {
|
||||||
Sys_Printf( "ERROR: %s is not in texture map, but was found in texture list\n" );
|
Sys_FPrintf( SYS_ERR, "ERROR: %s is not in texture map, but was found in texture list\n" );
|
||||||
return q;
|
return q;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -837,7 +837,7 @@ void WINAPI QERApp_ReloadShaderFile( const char *name ){
|
||||||
// check the shader name is a reletive path
|
// check the shader name is a reletive path
|
||||||
// I hacked together a few quick tests to make sure :-)
|
// I hacked together a few quick tests to make sure :-)
|
||||||
if ( strstr( name, ":\\" ) || !strstr( name, "scripts" ) ) {
|
if ( strstr( name, ":\\" ) || !strstr( name, "scripts" ) ) {
|
||||||
Sys_Printf( "WARNING: is %s a reletive path to a shader file? (QERApp_ReloadShaderFile\n" );
|
Sys_FPrintf( SYS_WRN, "WARNING: is %s a reletive path to a shader file? (QERApp_ReloadShaderFile\n" );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<PlatformToolset>v110_xp</PlatformToolset>
|
<PlatformToolset>v140</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
<ImportGroup Label="ExtensionSettings">
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
|
|
@ -35,7 +35,7 @@ void LoadSpriteModel( entity_interfaces_t *interfaces, const char *name ){
|
||||||
pShader = QERApp_Shader_ForName( name );
|
pShader = QERApp_Shader_ForName( name );
|
||||||
|
|
||||||
if ( !pShader ) {
|
if ( !pShader ) {
|
||||||
Sys_Printf( "ERROR: can't find shader (or image) for: %s\n", name );
|
Sys_FPrintf( SYS_ERR, "ERROR: can't find shader (or image) for: %s\n", name );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<PlatformToolset>v110_xp</PlatformToolset>
|
<PlatformToolset>v140</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
<ImportGroup Label="ExtensionSettings">
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<PlatformToolset>v110_xp</PlatformToolset>
|
<PlatformToolset>v140</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
<ImportGroup Label="ExtensionSettings">
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<PlatformToolset>v110_xp</PlatformToolset>
|
<PlatformToolset>v140</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
<ImportGroup Label="ExtensionSettings">
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<PlatformToolset>v110_xp</PlatformToolset>
|
<PlatformToolset>v140</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
<ImportGroup Label="ExtensionSettings">
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<PlatformToolset>v110_xp</PlatformToolset>
|
<PlatformToolset>v140</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
<ImportGroup Label="ExtensionSettings">
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
|
|
@ -1177,8 +1177,8 @@ extern const char *z_errmsg[10]; /* indexed by 2-zlib_error */
|
||||||
|
|
||||||
|
|
||||||
typedef uLong (*check_func) OF((uLong check, const Byte *buf, uInt len));
|
typedef uLong (*check_func) OF((uLong check, const Byte *buf, uInt len));
|
||||||
voidp zcalloc OF((voidp opaque, unsigned items, unsigned size));
|
static voidp zcalloc OF((voidp opaque, unsigned items, unsigned size));
|
||||||
void zcfree OF((voidp opaque, voidp ptr));
|
static void zcfree OF((voidp opaque, voidp ptr));
|
||||||
|
|
||||||
#define ZALLOC(strm, items, size) \
|
#define ZALLOC(strm, items, size) \
|
||||||
(*((strm)->zalloc))((strm)->opaque, (items), (size))
|
(*((strm)->zalloc))((strm)->opaque, (items), (size))
|
||||||
|
@ -1618,12 +1618,12 @@ static int unzlocal_GetCurrentFileInfoInternal (unzFile file,
|
||||||
|
|
||||||
|
|
||||||
/* we check the magic */
|
/* we check the magic */
|
||||||
if (err==UNZ_OK)
|
if (err==UNZ_OK) {
|
||||||
if (unzlocal_getLong(s->file,&uMagic) != UNZ_OK)
|
if (unzlocal_getLong(s->file,&uMagic) != UNZ_OK)
|
||||||
err=UNZ_ERRNO;
|
err=UNZ_ERRNO;
|
||||||
else if (uMagic!=0x02014b50)
|
else if (uMagic!=0x02014b50)
|
||||||
err=UNZ_BADZIPFILE;
|
err=UNZ_BADZIPFILE;
|
||||||
|
}
|
||||||
if (unzlocal_getShort(s->file,&file_info.version) != UNZ_OK)
|
if (unzlocal_getShort(s->file,&file_info.version) != UNZ_OK)
|
||||||
err=UNZ_ERRNO;
|
err=UNZ_ERRNO;
|
||||||
|
|
||||||
|
@ -1698,11 +1698,12 @@ static int unzlocal_GetCurrentFileInfoInternal (unzFile file,
|
||||||
else
|
else
|
||||||
uSizeRead = extraFieldBufferSize;
|
uSizeRead = extraFieldBufferSize;
|
||||||
|
|
||||||
if (lSeek!=0)
|
if (lSeek!=0) {
|
||||||
if (fseek(s->file,lSeek,SEEK_CUR)==0)
|
if (fseek(s->file,lSeek,SEEK_CUR)==0)
|
||||||
lSeek=0;
|
lSeek=0;
|
||||||
else
|
else
|
||||||
err=UNZ_ERRNO;
|
err=UNZ_ERRNO;
|
||||||
|
}
|
||||||
if ((file_info.size_file_extra>0) && (extraFieldBufferSize>0))
|
if ((file_info.size_file_extra>0) && (extraFieldBufferSize>0))
|
||||||
if (fread(extraField,(uInt)uSizeRead,1,s->file)!=1)
|
if (fread(extraField,(uInt)uSizeRead,1,s->file)!=1)
|
||||||
err=UNZ_ERRNO;
|
err=UNZ_ERRNO;
|
||||||
|
@ -1723,11 +1724,12 @@ static int unzlocal_GetCurrentFileInfoInternal (unzFile file,
|
||||||
else
|
else
|
||||||
uSizeRead = commentBufferSize;
|
uSizeRead = commentBufferSize;
|
||||||
|
|
||||||
if (lSeek!=0)
|
if (lSeek!=0) {
|
||||||
if (fseek(s->file,lSeek,SEEK_CUR)==0)
|
if (fseek(s->file,lSeek,SEEK_CUR)==0)
|
||||||
lSeek=0;
|
lSeek=0;
|
||||||
else
|
else
|
||||||
err=UNZ_ERRNO;
|
err=UNZ_ERRNO;
|
||||||
|
}
|
||||||
if ((file_info.size_file_comment>0) && (commentBufferSize>0))
|
if ((file_info.size_file_comment>0) && (commentBufferSize>0))
|
||||||
if (fread(szComment,(uInt)uSizeRead,1,s->file)!=1)
|
if (fread(szComment,(uInt)uSizeRead,1,s->file)!=1)
|
||||||
err=UNZ_ERRNO;
|
err=UNZ_ERRNO;
|
||||||
|
@ -1889,12 +1891,12 @@ static int unzlocal_CheckCurrentFileCoherencyHeader (unz_s* s, uInt* piSizeVar,
|
||||||
return UNZ_ERRNO;
|
return UNZ_ERRNO;
|
||||||
|
|
||||||
|
|
||||||
if (err==UNZ_OK)
|
if (err==UNZ_OK) {
|
||||||
if (unzlocal_getLong(s->file,&uMagic) != UNZ_OK)
|
if (unzlocal_getLong(s->file,&uMagic) != UNZ_OK)
|
||||||
err=UNZ_ERRNO;
|
err=UNZ_ERRNO;
|
||||||
else if (uMagic!=0x04034b50)
|
else if (uMagic!=0x04034b50)
|
||||||
err=UNZ_BADZIPFILE;
|
err=UNZ_BADZIPFILE;
|
||||||
|
}
|
||||||
if (unzlocal_getShort(s->file,&uData) != UNZ_OK)
|
if (unzlocal_getShort(s->file,&uData) != UNZ_OK)
|
||||||
err=UNZ_ERRNO;
|
err=UNZ_ERRNO;
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<PlatformToolset>v110_xp</PlatformToolset>
|
<PlatformToolset>v140</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
<ImportGroup Label="ExtensionSettings">
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
|
|
@ -1178,8 +1178,8 @@ extern const char *z_errmsg[10]; /* indexed by 2-zlib_error */
|
||||||
|
|
||||||
|
|
||||||
typedef uLong (*check_func) OF((uLong check, const Byte *buf, uInt len));
|
typedef uLong (*check_func) OF((uLong check, const Byte *buf, uInt len));
|
||||||
voidp zcalloc OF((voidp opaque, unsigned items, unsigned size));
|
static voidp zcalloc OF((voidp opaque, unsigned items, unsigned size));
|
||||||
void zcfree OF((voidp opaque, voidp ptr));
|
static void zcfree OF((voidp opaque, voidp ptr));
|
||||||
|
|
||||||
#define ZALLOC(strm, items, size) \
|
#define ZALLOC(strm, items, size) \
|
||||||
(*((strm)->zalloc))((strm)->opaque, (items), (size))
|
(*((strm)->zalloc))((strm)->opaque, (items), (size))
|
||||||
|
@ -1615,12 +1615,12 @@ static int unzlocal_GetCurrentFileInfoInternal (unzFile file,
|
||||||
|
|
||||||
|
|
||||||
/* we check the magic */
|
/* we check the magic */
|
||||||
if (err==UNZ_OK)
|
if (err==UNZ_OK) {
|
||||||
if (unzlocal_getLong(s->file,&uMagic) != UNZ_OK)
|
if (unzlocal_getLong(s->file,&uMagic) != UNZ_OK)
|
||||||
err=UNZ_ERRNO;
|
err=UNZ_ERRNO;
|
||||||
else if (uMagic!=0x02014b50)
|
else if (uMagic!=0x02014b50)
|
||||||
err=UNZ_BADZIPFILE;
|
err=UNZ_BADZIPFILE;
|
||||||
|
}
|
||||||
if (unzlocal_getShort(s->file,&file_info.version) != UNZ_OK)
|
if (unzlocal_getShort(s->file,&file_info.version) != UNZ_OK)
|
||||||
err=UNZ_ERRNO;
|
err=UNZ_ERRNO;
|
||||||
|
|
||||||
|
@ -1695,11 +1695,12 @@ static int unzlocal_GetCurrentFileInfoInternal (unzFile file,
|
||||||
else
|
else
|
||||||
uSizeRead = extraFieldBufferSize;
|
uSizeRead = extraFieldBufferSize;
|
||||||
|
|
||||||
if (lSeek!=0)
|
if (lSeek!=0) {
|
||||||
if (fseek(s->file,lSeek,SEEK_CUR)==0)
|
if (fseek(s->file,lSeek,SEEK_CUR)==0)
|
||||||
lSeek=0;
|
lSeek=0;
|
||||||
else
|
else
|
||||||
err=UNZ_ERRNO;
|
err=UNZ_ERRNO;
|
||||||
|
}
|
||||||
if ((file_info.size_file_extra>0) && (extraFieldBufferSize>0))
|
if ((file_info.size_file_extra>0) && (extraFieldBufferSize>0))
|
||||||
if (fread_ql(extraField,(uInt)uSizeRead,1,s->file)!=1)
|
if (fread_ql(extraField,(uInt)uSizeRead,1,s->file)!=1)
|
||||||
err=UNZ_ERRNO;
|
err=UNZ_ERRNO;
|
||||||
|
@ -1720,11 +1721,12 @@ static int unzlocal_GetCurrentFileInfoInternal (unzFile file,
|
||||||
else
|
else
|
||||||
uSizeRead = commentBufferSize;
|
uSizeRead = commentBufferSize;
|
||||||
|
|
||||||
if (lSeek!=0)
|
if (lSeek!=0) {
|
||||||
if (fseek(s->file,lSeek,SEEK_CUR)==0)
|
if (fseek(s->file,lSeek,SEEK_CUR)==0)
|
||||||
lSeek=0;
|
lSeek=0;
|
||||||
else
|
else
|
||||||
err=UNZ_ERRNO;
|
err=UNZ_ERRNO;
|
||||||
|
}
|
||||||
if ((file_info.size_file_comment>0) && (commentBufferSize>0))
|
if ((file_info.size_file_comment>0) && (commentBufferSize>0))
|
||||||
if (fread_ql(szComment,(uInt)uSizeRead,1,s->file)!=1)
|
if (fread_ql(szComment,(uInt)uSizeRead,1,s->file)!=1)
|
||||||
err=UNZ_ERRNO;
|
err=UNZ_ERRNO;
|
||||||
|
@ -1886,12 +1888,12 @@ static int unzlocal_CheckCurrentFileCoherencyHeader (unz_s* s, uInt* piSizeVar,
|
||||||
return UNZ_ERRNO;
|
return UNZ_ERRNO;
|
||||||
|
|
||||||
|
|
||||||
if (err==UNZ_OK)
|
if (err==UNZ_OK) {
|
||||||
if (unzlocal_getLong(s->file,&uMagic) != UNZ_OK)
|
if (unzlocal_getLong(s->file,&uMagic) != UNZ_OK)
|
||||||
err=UNZ_ERRNO;
|
err=UNZ_ERRNO;
|
||||||
else if (uMagic!=0x04034b50)
|
else if (uMagic!=0x04034b50)
|
||||||
err=UNZ_BADZIPFILE;
|
err=UNZ_BADZIPFILE;
|
||||||
|
}
|
||||||
if (unzlocal_getShort(s->file,&uData) != UNZ_OK)
|
if (unzlocal_getShort(s->file,&uData) != UNZ_OK)
|
||||||
err=UNZ_ERRNO;
|
err=UNZ_ERRNO;
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<PlatformToolset>v110_xp</PlatformToolset>
|
<PlatformToolset>v140</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
<ImportGroup Label="ExtensionSettings">
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
|
|
@ -119,9 +119,7 @@ int vfsBuildShortPathName( const char* pPath, char* pBuffer, int nBufferLen ){
|
||||||
strcpy( pBuffer, pPath ); // Use long filename
|
strcpy( pBuffer, pPath ); // Use long filename
|
||||||
}
|
}
|
||||||
return nResult;
|
return nResult;
|
||||||
#endif
|
#elif defined ( __linux__ ) || defined ( __APPLE__ )
|
||||||
|
|
||||||
#if defined ( __linux__ ) || defined ( __APPLE__ )
|
|
||||||
|
|
||||||
// remove /../ from directories
|
// remove /../ from directories
|
||||||
const char *scr = pPath; char *dst = pBuffer;
|
const char *scr = pPath; char *dst = pBuffer;
|
||||||
|
@ -142,6 +140,8 @@ int vfsBuildShortPathName( const char* pPath, char* pBuffer, int nBufferLen ){
|
||||||
*dst = 0;
|
*dst = 0;
|
||||||
|
|
||||||
return strlen( pBuffer );
|
return strlen( pBuffer );
|
||||||
|
#else
|
||||||
|
#error "unsupported platform"
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<PlatformToolset>v110_xp</PlatformToolset>
|
<PlatformToolset>v140</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
<ImportGroup Label="ExtensionSettings">
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
|
|
@ -341,7 +341,7 @@ void Face_TextureVectors( face_t *f, float STfromXYZ[2][4] ){
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
// this code is not supposed to be used while in BP mode, warning here can help spot the problem
|
// this code is not supposed to be used while in BP mode, warning here can help spot the problem
|
||||||
if ( g_qeglobals.m_bBrushPrimitMode && !g_qeglobals.bNeedConvert ) {
|
if ( g_qeglobals.m_bBrushPrimitMode && !g_qeglobals.bNeedConvert ) {
|
||||||
Sys_Printf( "Warning : illegal call of Face_TextureVectors in brush primitive mode\n" );
|
Sys_FPrintf( SYS_WRN, "Warning : illegal call of Face_TextureVectors in brush primitive mode\n" );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -867,7 +867,7 @@ void Brush_Build( brush_t *b, bool bSnap, bool bMarkMap, bool bConvert, bool bFi
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
if ( !g_qeglobals.m_bBrushPrimitMode && bConvert ) {
|
if ( !g_qeglobals.m_bBrushPrimitMode && bConvert ) {
|
||||||
Sys_Printf( "Warning : conversion from brush primitive to old brush format not implemented\n" );
|
Sys_FPrintf( SYS_WRN, "Warning : conversion from brush primitive to old brush format not implemented\n" );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1539,7 +1539,7 @@ const char* Brush_GetKeyValue( brush_t *b, const char *pKey ){
|
||||||
void CheckName( face_t *fa, char *pname ){
|
void CheckName( face_t *fa, char *pname ){
|
||||||
if ( !strlen( fa->texdef.GetName() ) ) {
|
if ( !strlen( fa->texdef.GetName() ) ) {
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
Sys_Printf( "WARNING: unexpected texdef.name is empty in Brush.cpp CheckName\n" );
|
Sys_FPrintf( SYS_WRN, "WARNING: unexpected texdef.name is empty in Brush.cpp CheckName\n" );
|
||||||
#endif
|
#endif
|
||||||
fa->texdef.SetName( SHADER_NOT_FOUND );
|
fa->texdef.SetName( SHADER_NOT_FOUND );
|
||||||
strcpy( pname, SHADER_NOT_FOUND );
|
strcpy( pname, SHADER_NOT_FOUND );
|
||||||
|
@ -1592,7 +1592,7 @@ brush_t *Brush_Create( vec3_t mins, vec3_t maxs, texdef_t *texdef ){
|
||||||
if ( g_qeglobals.m_bBrushPrimitMode ) {
|
if ( g_qeglobals.m_bBrushPrimitMode ) {
|
||||||
// check texdef is empty .. if there are cases it's not we need to write some conversion code
|
// check texdef is empty .. if there are cases it's not we need to write some conversion code
|
||||||
if ( texdef->shift[0] != 0 || texdef->shift[1] != 0 || texdef->scale[0] != 0 || texdef->scale[1] != 0 || texdef->rotate != 0 ) {
|
if ( texdef->shift[0] != 0 || texdef->shift[1] != 0 || texdef->scale[0] != 0 || texdef->scale[1] != 0 || texdef->rotate != 0 ) {
|
||||||
Sys_Printf( "Warning : non-zero texdef detected in Brush_Create .. need brush primitive conversion\n" );
|
Sys_FPrintf( SYS_WRN, "Warning : non-zero texdef detected in Brush_Create .. need brush primitive conversion\n" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -103,11 +103,11 @@ void FaceToBrushPrimitFace( face_t *f ){
|
||||||
strcpy(f->brushprimit_texdef.name,f->texdef.name); */
|
strcpy(f->brushprimit_texdef.name,f->texdef.name); */
|
||||||
#ifdef DBG_BP
|
#ifdef DBG_BP
|
||||||
if ( f->plane.normal[0] == 0.0f && f->plane.normal[1] == 0.0f && f->plane.normal[2] == 0.0f ) {
|
if ( f->plane.normal[0] == 0.0f && f->plane.normal[1] == 0.0f && f->plane.normal[2] == 0.0f ) {
|
||||||
Sys_Printf( "Warning : f->plane.normal is (0,0,0) in FaceToBrushPrimitFace\n" );
|
Sys_FPrintf( SYS_WRN, "Warning : f->plane.normal is (0,0,0) in FaceToBrushPrimitFace\n" );
|
||||||
}
|
}
|
||||||
// check d_texture
|
// check d_texture
|
||||||
if ( !f->d_texture ) {
|
if ( !f->d_texture ) {
|
||||||
Sys_Printf( "Warning : f.d_texture is NULL in FaceToBrushPrimitFace\n" );
|
Sys_FPrintf( SYS_WRN, "Warning : f.d_texture is NULL in FaceToBrushPrimitFace\n" );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -162,10 +162,10 @@ void EmitBrushPrimitTextureCoordinates( face_t * f, winding_t * w ){
|
||||||
vec_t T = f->brushprimit_texdef.coords[1][0] * x + f->brushprimit_texdef.coords[1][1] * y + f->brushprimit_texdef.coords[1][2];
|
vec_t T = f->brushprimit_texdef.coords[1][0] * x + f->brushprimit_texdef.coords[1][1] * y + f->brushprimit_texdef.coords[1][2];
|
||||||
if ( fabs( S - w->points[i][3] ) > 1e-2 || fabs( T - w->points[i][4] ) > 1e-2 ) {
|
if ( fabs( S - w->points[i][3] ) > 1e-2 || fabs( T - w->points[i][4] ) > 1e-2 ) {
|
||||||
if ( fabs( S - w->points[i][3] ) > 1e-4 || fabs( T - w->points[i][4] ) > 1e-4 ) {
|
if ( fabs( S - w->points[i][3] ) > 1e-4 || fabs( T - w->points[i][4] ) > 1e-4 ) {
|
||||||
Sys_Printf( "Warning : precision loss in brush -> brush primitive texture computation\n" );
|
Sys_FPrintf( SYS_WRN, "Warning : precision loss in brush -> brush primitive texture computation\n" );
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
Sys_Printf( "Warning : brush -> brush primitive texture computation bug detected\n" );
|
Sys_FPrintf( SYS_WRN, "Warning : brush -> brush primitive texture computation bug detected\n" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -181,14 +181,14 @@ void TexMatToFakeTexCoords( vec_t texMat[2][3], float shift[2], float *rot, floa
|
||||||
#ifdef DBG_BP
|
#ifdef DBG_BP
|
||||||
// check this matrix is orthogonal
|
// check this matrix is orthogonal
|
||||||
if ( fabs( texMat[0][0] * 1.0L * texMat[0][1] + texMat[1][0] * 1.0L * texMat[1][1] ) > ZERO_EPSILON ) {
|
if ( fabs( texMat[0][0] * 1.0L * texMat[0][1] + texMat[1][0] * 1.0L * texMat[1][1] ) > ZERO_EPSILON ) {
|
||||||
Sys_Printf( "Warning : non orthogonal texture matrix in TexMatToFakeTexCoords\n" );
|
Sys_FPrintf( SYS_WRN, "Warning : non orthogonal texture matrix in TexMatToFakeTexCoords\n" );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
scale[0] = sqrt( texMat[0][0] * 1.0L * texMat[0][0] + texMat[1][0] * 1.0L * texMat[1][0] );
|
scale[0] = sqrt( texMat[0][0] * 1.0L * texMat[0][0] + texMat[1][0] * 1.0L * texMat[1][0] );
|
||||||
scale[1] = sqrt( texMat[0][1] * 1.0L * texMat[0][1] + texMat[1][1] * 1.0L * texMat[1][1] );
|
scale[1] = sqrt( texMat[0][1] * 1.0L * texMat[0][1] + texMat[1][1] * 1.0L * texMat[1][1] );
|
||||||
#ifdef DBG_BP
|
#ifdef DBG_BP
|
||||||
if ( scale[0] < ZERO_EPSILON || scale[1] < ZERO_EPSILON ) {
|
if ( scale[0] < ZERO_EPSILON || scale[1] < ZERO_EPSILON ) {
|
||||||
Sys_Printf( "Warning : unexpected scale==0 in TexMatToFakeTexCoords\n" );
|
Sys_FPrintf( SYS_WRN, "Warning : unexpected scale==0 in TexMatToFakeTexCoords\n" );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
// compute rotate value
|
// compute rotate value
|
||||||
|
@ -196,7 +196,7 @@ void TexMatToFakeTexCoords( vec_t texMat[2][3], float shift[2], float *rot, floa
|
||||||
#ifdef DBG_BP
|
#ifdef DBG_BP
|
||||||
// check brushprimit_texdef[1][0] is not zero
|
// check brushprimit_texdef[1][0] is not zero
|
||||||
if ( fabs( texMat[1][0] ) < ZERO_EPSILON ) {
|
if ( fabs( texMat[1][0] ) < ZERO_EPSILON ) {
|
||||||
Sys_Printf( "Warning : unexpected texdef[1][0]==0 in TexMatToFakeTexCoords\n" );
|
Sys_FPrintf( SYS_WRN, "Warning : unexpected texdef[1][0]==0 in TexMatToFakeTexCoords\n" );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
// rotate is +-90
|
// rotate is +-90
|
||||||
|
|
|
@ -1634,7 +1634,7 @@ void CamWnd::Cam_Draw(){
|
||||||
|
|
||||||
void CamWnd::OnExpose(){
|
void CamWnd::OnExpose(){
|
||||||
if ( !MakeCurrent() ) {
|
if ( !MakeCurrent() ) {
|
||||||
Sys_Printf( "ERROR: glXMakeCurrent failed..\n " );
|
Sys_FPrintf( SYS_ERR, "ERROR: glXMakeCurrent failed..\n " );
|
||||||
Sys_Printf( "Please restart Radiant if the camera view is not working\n" );
|
Sys_Printf( "Please restart Radiant if the camera view is not working\n" );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -382,8 +382,8 @@ void Eclass_Init(){
|
||||||
if ( !strcmp( ValueForKey( g_qeglobals.d_project_entity, "gamemode" ), "sp" ) ) {
|
if ( !strcmp( ValueForKey( g_qeglobals.d_project_entity, "gamemode" ), "sp" ) ) {
|
||||||
// SP mapping, ignore mp_*.def
|
// SP mapping, ignore mp_*.def
|
||||||
char *name = (char *)pFile->data;
|
char *name = (char *)pFile->data;
|
||||||
if ( name[0] == 'm' && name[1] == 'p' && name[2] == '_'
|
if ( ( name[0] == 'm' && name[1] == 'p' && name[2] == '_' )
|
||||||
|| name[0] == 'h' && name[1] == 'm' && name[2] == '_' ) {
|
|| ( name[0] == 'h' && name[1] == 'm' && name[2] == '_' ) ) {
|
||||||
Sys_Printf( "Single Player mapping mode. Ignoring '%s'\n", name );
|
Sys_Printf( "Single Player mapping mode. Ignoring '%s'\n", name );
|
||||||
pFile = pFile->next;
|
pFile = pFile->next;
|
||||||
continue;
|
continue;
|
||||||
|
@ -445,7 +445,7 @@ eclass_t *Eclass_ForName( const char *name, qboolean has_brushes ){
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
// grouping stuff, not an eclass
|
// grouping stuff, not an eclass
|
||||||
if ( strcmp( name, "group_info" ) == 0 ) {
|
if ( strcmp( name, "group_info" ) == 0 ) {
|
||||||
Sys_Printf( "WARNING: unexpected group_info entity in Eclass_ForName\n" );
|
Sys_FPrintf( SYS_WRN, "WARNING: unexpected group_info entity in Eclass_ForName\n" );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ void WINAPI QERApp_UnHookGL2DWindow( IGL2DWindow* pGLW ){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
Sys_Printf( "ERROR: IGL2DWindow* not found in QERApp_UnHookGL2DWindow\n" );
|
Sys_FPrintf( SYS_ERR, "ERROR: IGL2DWindow* not found in QERApp_UnHookGL2DWindow\n" );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ void WINAPI QERApp_UnHookGL3DWindow( IGL3DWindow* pGLW ){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
Sys_Printf( "ERROR: IGL3DWindow* not found in QERApp_UnHookGL3DWindow\n" );
|
Sys_FPrintf( SYS_ERR, "ERROR: IGL3DWindow* not found in QERApp_UnHookGL3DWindow\n" );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -826,7 +826,7 @@ void Group_AddToProperGroup( brush_t *b ){
|
||||||
Group_AddToItem(b, g->itemOwner);
|
Group_AddToItem(b, g->itemOwner);
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
else
|
else
|
||||||
Sys_Printf("WARNING: unexpected Group_ForName not found in Group_AddToProperGroup\n");
|
Sys_FPrintf(SYS_WRN, "WARNING: unexpected Group_ForName not found in Group_AddToProperGroup\n");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -3793,8 +3793,47 @@ void DoTextEditor( const char* filename, int cursorpos ){
|
||||||
CString strEditCommand;
|
CString strEditCommand;
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
if ( g_PrefsDlg.m_bUseWin32Editor ) {
|
if ( g_PrefsDlg.m_bUseWin32Editor ) {
|
||||||
Sys_Printf( "opening file '%s' (line %d info ignored)\n", filename );
|
HINSTANCE result;
|
||||||
ShellExecute( (HWND)GDK_WINDOW_HWND( g_pParentWnd->m_pWidget->window ), "open", filename, NULL, NULL, SW_SHOW );
|
Sys_Printf( "Opening file '%s'.\n", filename );
|
||||||
|
result = ShellExecute( (HWND)GDK_WINDOW_HWND( g_pParentWnd->m_pWidget->window ), "open", filename, NULL, NULL, SW_SHOW );
|
||||||
|
if( (int)result <= 32 ) {
|
||||||
|
const char *errstr;
|
||||||
|
switch( (int)result ) {
|
||||||
|
case SE_ERR_OOM:
|
||||||
|
case 0:
|
||||||
|
errstr = _( "The operating system is out of memory or resources." );
|
||||||
|
break;
|
||||||
|
case ERROR_FILE_NOT_FOUND:
|
||||||
|
//case SE_ERR_FNF:
|
||||||
|
errstr = _( "The specified file was not found." );
|
||||||
|
break;
|
||||||
|
case SE_ERR_NOASSOC:
|
||||||
|
{
|
||||||
|
SHELLEXECUTEINFO sei = {0};
|
||||||
|
sei.cbSize = sizeof( sei );
|
||||||
|
sei.nShow = SW_SHOWNORMAL;
|
||||||
|
sei.lpFile = TEXT( filename );
|
||||||
|
sei.fMask = SEE_MASK_CLASSNAME;
|
||||||
|
sei.lpVerb = TEXT( "open" );
|
||||||
|
sei.lpClass = TEXT( ".txt" );
|
||||||
|
|
||||||
|
if( ShellExecuteEx( &sei ) )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
errstr = _( "There is no application associated with the given file name extension." );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case ERROR_PATH_NOT_FOUND:
|
||||||
|
//case SE_ERR_PNF:
|
||||||
|
errstr = _( "The specified path was not found." );
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
errstr = "";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
Sys_FPrintf( SYS_WRN, "Failed to open file '%s'. %s\n", filename, errstr );
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -414,7 +414,7 @@ void error_redirect( const gchar *domain, GLogLevelFlags log_level, const gchar
|
||||||
#define GETTEXT_PACKAGE "radiant"
|
#define GETTEXT_PACKAGE "radiant"
|
||||||
#define LOCALEDIR "lang"
|
#define LOCALEDIR "lang"
|
||||||
|
|
||||||
int main( int argc, char* argv[] ) {
|
int mainRadiant( int argc, char* argv[] ) {
|
||||||
const char *libgl;
|
const char *libgl;
|
||||||
int i, j, k;
|
int i, j, k;
|
||||||
|
|
||||||
|
@ -697,13 +697,13 @@ int main( int argc, char* argv[] ) {
|
||||||
chomp++;
|
chomp++;
|
||||||
buf[chomp] = '\0';
|
buf[chomp] = '\0';
|
||||||
if ( strcmp( buf, RADIANT_MAJOR_VERSION ) ) {
|
if ( strcmp( buf, RADIANT_MAJOR_VERSION ) ) {
|
||||||
Sys_Printf( "ERROR: file RADIANT_MAJOR doesn't match ('%s')\n", buf );
|
Sys_FPrintf( SYS_ERR, "ERROR: file RADIANT_MAJOR doesn't match ('%s')\n", buf );
|
||||||
bVerIsGood = false;
|
bVerIsGood = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Sys_Printf( "ERROR: can't find RADIANT_MAJOR in '%s'\n", ver_file_name.GetBuffer() );
|
Sys_FPrintf( SYS_ERR, "ERROR: can't find RADIANT_MAJOR in '%s'\n", ver_file_name.GetBuffer() );
|
||||||
bVerIsGood = false;
|
bVerIsGood = false;
|
||||||
}
|
}
|
||||||
ver_file_name = g_strAppPath;
|
ver_file_name = g_strAppPath;
|
||||||
|
@ -719,13 +719,13 @@ int main( int argc, char* argv[] ) {
|
||||||
chomp++;
|
chomp++;
|
||||||
buf[chomp] = '\0';
|
buf[chomp] = '\0';
|
||||||
if ( strcmp( buf, RADIANT_MINOR_VERSION ) ) {
|
if ( strcmp( buf, RADIANT_MINOR_VERSION ) ) {
|
||||||
Sys_Printf( "ERROR: file RADIANT_MINOR doesn't match ('%s')\n", buf );
|
Sys_FPrintf( SYS_ERR, "ERROR: file RADIANT_MINOR doesn't match ('%s')\n", buf );
|
||||||
bVerIsGood = false;
|
bVerIsGood = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Sys_Printf( "ERROR: can't find RADIANT_MINOR in '%s'\n", ver_file_name.GetBuffer() );
|
Sys_FPrintf( SYS_ERR, "ERROR: can't find RADIANT_MINOR in '%s'\n", ver_file_name.GetBuffer() );
|
||||||
bVerIsGood = false;
|
bVerIsGood = false;
|
||||||
}
|
}
|
||||||
if ( !bVerIsGood ) {
|
if ( !bVerIsGood ) {
|
||||||
|
@ -923,6 +923,76 @@ int main( int argc, char* argv[] ) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if defined( _WIN32 ) && defined( _MSC_VER )
|
||||||
|
#include <dbghelp.h>
|
||||||
|
#include <shellapi.h>
|
||||||
|
#include <shlobj.h>
|
||||||
|
#include <strsafe.h> //StringCchPrintf
|
||||||
|
|
||||||
|
int GenerateDump( EXCEPTION_POINTERS* pExceptionPointers ) {
|
||||||
|
BOOL bMiniDumpSuccessful;
|
||||||
|
char szPath[MAX_PATH];
|
||||||
|
char szFileName[MAX_PATH];
|
||||||
|
char szAppName[] = "GTKRadiant";
|
||||||
|
char* szVersion = RADIANT_VERSION;
|
||||||
|
DWORD dwBufferSize = MAX_PATH;
|
||||||
|
HANDLE hDumpFile;
|
||||||
|
SYSTEMTIME stLocalTime;
|
||||||
|
MINIDUMP_EXCEPTION_INFORMATION ExpParam;
|
||||||
|
|
||||||
|
GetLocalTime( &stLocalTime );
|
||||||
|
GetTempPath( dwBufferSize, szPath );
|
||||||
|
|
||||||
|
StringCchPrintf( szFileName, MAX_PATH, "%s%s", szPath, szAppName );
|
||||||
|
CreateDirectory( szFileName, NULL );
|
||||||
|
|
||||||
|
StringCchPrintf( szFileName, MAX_PATH, "%s%s\\%s-%s-%04d%02d%02d-%02d%02d%02d.dmp",
|
||||||
|
szPath, szAppName, szAppName, szVersion,
|
||||||
|
stLocalTime.wYear, stLocalTime.wMonth, stLocalTime.wDay,
|
||||||
|
stLocalTime.wHour, stLocalTime.wMinute, stLocalTime.wSecond );
|
||||||
|
hDumpFile = CreateFile(szFileName, GENERIC_READ|GENERIC_WRITE,
|
||||||
|
FILE_SHARE_WRITE|FILE_SHARE_READ, 0, CREATE_ALWAYS, 0, 0);
|
||||||
|
|
||||||
|
ExpParam.ThreadId = GetCurrentThreadId();
|
||||||
|
ExpParam.ExceptionPointers = pExceptionPointers;
|
||||||
|
ExpParam.ClientPointers = TRUE;
|
||||||
|
|
||||||
|
bMiniDumpSuccessful = MiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(),
|
||||||
|
hDumpFile, MiniDumpWithDataSegs, &ExpParam, NULL, NULL);
|
||||||
|
|
||||||
|
return EXCEPTION_EXECUTE_HANDLER;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int main( int argc, char* argv[] ) {
|
||||||
|
|
||||||
|
#if defined( _WIN32 ) && defined( _MSC_VER )
|
||||||
|
__try {
|
||||||
|
return mainRadiant( argc, argv );
|
||||||
|
} __except( GenerateDump( GetExceptionInformation() ) ) {
|
||||||
|
|
||||||
|
char szPath[MAX_PATH];
|
||||||
|
char szText[MAX_PATH];
|
||||||
|
char szFileName[MAX_PATH];
|
||||||
|
char szAppName[] = "GTKRadiant";
|
||||||
|
SYSTEMTIME stLocalTime;
|
||||||
|
DWORD dwBufferSize = MAX_PATH;
|
||||||
|
|
||||||
|
GetLocalTime( &stLocalTime );
|
||||||
|
GetTempPath( dwBufferSize, szPath );
|
||||||
|
|
||||||
|
StringCchPrintf( szFileName, MAX_PATH, "%s%s", szPath, szAppName );
|
||||||
|
|
||||||
|
StringCchPrintf( szText, MAX_PATH, _("Application crashed!\nCreated a dump file in: \n%s"), szFileName );
|
||||||
|
|
||||||
|
MessageBox( NULL, szText, NULL, MB_ICONERROR );
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
return mainRadiant( argc, argv );
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
// ydnar: quick and dirty fix, just make the buffer bigger
|
// ydnar: quick and dirty fix, just make the buffer bigger
|
||||||
#define BIG_PATH_MAX 4096
|
#define BIG_PATH_MAX 4096
|
||||||
|
|
||||||
|
@ -1098,7 +1168,7 @@ static gboolean RunBsp_CaptureOutput(void *data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( pid == -1 ) {
|
if ( pid == -1 ) {
|
||||||
Sys_Printf( "Failed to wait for %d: %s\n", process->pid, strerror( errno ) );
|
Sys_FPrintf( SYS_ERR, "ERROR: Failed to wait for %d: %s\n", process->pid, strerror( errno ) );
|
||||||
} else {
|
} else {
|
||||||
Sys_Printf( "Process %d terminated with status %d\n", process->pid, process->status );
|
Sys_Printf( "Process %d terminated with status %d\n", process->pid, process->status );
|
||||||
}
|
}
|
||||||
|
|
|
@ -2536,7 +2536,7 @@ void MainFrame::Create(){
|
||||||
|
|
||||||
gtk_window_set_icon_from_file( GTK_WINDOW( window ), icon.GetBuffer(), &error );
|
gtk_window_set_icon_from_file( GTK_WINDOW( window ), icon.GetBuffer(), &error );
|
||||||
if ( error != NULL ) {
|
if ( error != NULL ) {
|
||||||
Sys_Printf( "Failed to load icon: %s\n", error->message );
|
Sys_FPrintf( SYS_ERR, "ERROR: Failed to load icon: %s\n", error->message );
|
||||||
g_error_free( error );
|
g_error_free( error );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3203,7 +3203,7 @@ void MainFrame::OnSleep(){
|
||||||
{
|
{
|
||||||
#ifdef DBG_SLEEP
|
#ifdef DBG_SLEEP
|
||||||
if (ent->md3Class)
|
if (ent->md3Class)
|
||||||
Sys_Printf("WARNING: unexpected ent->md3Class!=NULL with ent->eclass->model!=NULL\n");
|
Sys_FPrintf(SYS_WRN, "WARNING: unexpected ent->md3Class!=NULL with ent->eclass->model!=NULL\n");
|
||||||
#endif
|
#endif
|
||||||
entitymodel_t *model;
|
entitymodel_t *model;
|
||||||
for (model = ent->eclass->model; model; model=model->pNext)
|
for (model = ent->eclass->model; model; model=model->pNext)
|
||||||
|
@ -3216,7 +3216,7 @@ void MainFrame::OnSleep(){
|
||||||
}
|
}
|
||||||
#ifdef DBG_SLEEP
|
#ifdef DBG_SLEEP
|
||||||
else
|
else
|
||||||
Sys_Printf("WARNING: entity %p %s with fixedsize and no model no md3Class\n", ent, ent->eclass->name);
|
Sys_FPrintf(SYS_WRN, "WARNING: entity %p %s with fixedsize and no model no md3Class\n", ent, ent->eclass->name);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3497,7 +3497,7 @@ void MainFrame::LoadCommandMap(){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( j == g_nKeyCount ) {
|
if ( j == g_nKeyCount ) {
|
||||||
Sys_Printf( "WARNING: failed to parse user command %s\n", value );
|
Sys_FPrintf( SYS_WRN, "WARNING: failed to parse user command %s\n", value );
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -391,7 +391,7 @@ void Map_ImportEntities( CPtrArray *ents, bool bAddSelected = false ){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
Sys_Printf( "WARNING: no terrain shader found for brush\n" );
|
Sys_FPrintf( SYS_WRN, "WARNING: no terrain shader found for brush\n" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1038,7 +1038,7 @@ void Map_RegionSelectedBrushes( void ){
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
if ( filtered_brushes.next != &filtered_brushes ) {
|
if ( filtered_brushes.next != &filtered_brushes ) {
|
||||||
Sys_Printf( "WARNING: filtered_brushes list may not be empty in Map_RegionSelectedBrushes\n" );
|
Sys_FPrintf( SYS_WRN, "WARNING: filtered_brushes list may not be empty in Map_RegionSelectedBrushes\n" );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -57,14 +57,14 @@ skipspace:
|
||||||
{
|
{
|
||||||
if ( !*script_p ) {
|
if ( !*script_p ) {
|
||||||
if ( !crossline ) {
|
if ( !crossline ) {
|
||||||
Sys_Printf( "Warning: Line %i is incomplete [01]\n",scriptline );
|
Sys_FPrintf( SYS_WRN, "Warning: Line %i is incomplete [01]\n",scriptline );
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( *script_p++ == '\n' ) {
|
if ( *script_p++ == '\n' ) {
|
||||||
if ( !crossline ) {
|
if ( !crossline ) {
|
||||||
Sys_Printf( "Warning: Line %i is incomplete [02]\n",scriptline );
|
Sys_FPrintf( SYS_WRN, "Warning: Line %i is incomplete [02]\n",scriptline );
|
||||||
}
|
}
|
||||||
scriptline++;
|
scriptline++;
|
||||||
}
|
}
|
||||||
|
@ -72,12 +72,12 @@ skipspace:
|
||||||
|
|
||||||
if ( script_p[0] == '/' && script_p[1] == '/' ) { // comment field
|
if ( script_p[0] == '/' && script_p[1] == '/' ) { // comment field
|
||||||
if ( !crossline ) {
|
if ( !crossline ) {
|
||||||
Sys_Printf( "Warning: Line %i is incomplete [03]\n",scriptline );
|
Sys_FPrintf( SYS_WRN, "Warning: Line %i is incomplete [03]\n",scriptline );
|
||||||
}
|
}
|
||||||
while ( *script_p++ != '\n' )
|
while ( *script_p++ != '\n' )
|
||||||
if ( !*script_p ) {
|
if ( !*script_p ) {
|
||||||
if ( !crossline ) {
|
if ( !crossline ) {
|
||||||
Sys_Printf( "Warning: Line %i is incomplete [04]\n",scriptline );
|
Sys_FPrintf( SYS_WRN, "Warning: Line %i is incomplete [04]\n",scriptline );
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -694,7 +694,7 @@ void PatchDialog::GetPatchInfo(){
|
||||||
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
Sys_Printf( "WARNING: no patch\n" );
|
Sys_FPrintf( SYS_WRN, "WARNING: no patch\n" );
|
||||||
}
|
}
|
||||||
// fill in our internal structs
|
// fill in our internal structs
|
||||||
m_nRow = 0; m_nCol = 0;
|
m_nRow = 0; m_nCol = 0;
|
||||||
|
|
|
@ -251,10 +251,12 @@ virtual void DeleteByID( const char *id, const char* version ){
|
||||||
{
|
{
|
||||||
elem = (CModelWrapper*)m_ptrs->pdata[i];
|
elem = (CModelWrapper*)m_ptrs->pdata[i];
|
||||||
if (strcmp(elem->m_version.c_str(), version) == 0
|
if (strcmp(elem->m_version.c_str(), version) == 0
|
||||||
&& strcmp( elem->m_id.c_str(), id ) == 0
|
&& strcmp(elem->m_id.c_str(), id) == 0) {
|
||||||
&& --elem->refcount == 0 ) {
|
elem->refcount--;
|
||||||
|
if (elem->refcount == 0) {
|
||||||
g_ptr_array_remove_index_fast(m_ptrs, i);
|
g_ptr_array_remove_index_fast(m_ptrs, i);
|
||||||
delete elem;
|
delete elem;
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -719,7 +721,7 @@ void CPlugInManager::Cleanup(){
|
||||||
//++timo FIXME: for now I leave a leak warning, we'd need a table to keep track of commited patches
|
//++timo FIXME: for now I leave a leak warning, we'd need a table to keep track of commited patches
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
if ( m_PluginPatches.GetSize() != 0 ) {
|
if ( m_PluginPatches.GetSize() != 0 ) {
|
||||||
Sys_Printf( "WARNING: m_PluginPatches.GetSize() != 0 in CPlugInManager::Cleanup, possible leak\n" );
|
Sys_FPrintf( SYS_WRN, "WARNING: m_PluginPatches.GetSize() != 0 in CPlugInManager::Cleanup, possible leak\n" );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -859,7 +861,7 @@ patchMesh_t* CPlugInManager::FindPatchHandle( int index ){
|
||||||
return pb->pPatch;
|
return pb->pPatch;
|
||||||
}
|
}
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
Sys_Printf( "WARNING: out of bounds in CPlugInManager::FindPatchHandle\n" );
|
Sys_FPrintf( SYS_WRN, "WARNING: out of bounds in CPlugInManager::FindPatchHandle\n" );
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case EAllocatedPatches:
|
case EAllocatedPatches:
|
||||||
|
@ -868,7 +870,7 @@ patchMesh_t* CPlugInManager::FindPatchHandle( int index ){
|
||||||
return pPatch;
|
return pPatch;
|
||||||
}
|
}
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
Sys_Printf( "WARNING: out of bounds in CPlugInManager::FindPatchHandle\n" );
|
Sys_FPrintf( SYS_WRN, "WARNING: out of bounds in CPlugInManager::FindPatchHandle\n" );
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1066,7 +1068,7 @@ _QERFaceData* WINAPI QERApp_GetFaceData( void* pv, int nFaceIndex ){
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
if ( !pBrush->brush_faces ) {
|
if ( !pBrush->brush_faces ) {
|
||||||
Sys_Printf( "Warning : pBrush->brush_faces is NULL in QERApp_GetFaceData\n" );
|
Sys_FPrintf( SYS_WRN, "Warning : pBrush->brush_faces is NULL in QERApp_GetFaceData\n" );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -1500,7 +1502,7 @@ qtexture_t* WINAPI QERApp_Texture_ForName( const char *name ){
|
||||||
gtk_glwidget_make_current( g_qeglobals_gui.d_glBase );
|
gtk_glwidget_make_current( g_qeglobals_gui.d_glBase );
|
||||||
|
|
||||||
//++timo debugging
|
//++timo debugging
|
||||||
Sys_Printf( "WARNING: QERApp_Texture_ForName ... don't call that!!\n" );
|
Sys_FPrintf( SYS_WRN, "WARNING: QERApp_Texture_ForName ... don't call that!!\n" );
|
||||||
qtexture_t* qtex = QERApp_Texture_ForName2( name );
|
qtexture_t* qtex = QERApp_Texture_ForName2( name );
|
||||||
return qtex;
|
return qtex;
|
||||||
}
|
}
|
||||||
|
@ -1547,7 +1549,7 @@ void CPlugInManager::CommitEntityHandleToMap( void* vpEntity ){
|
||||||
// fixedsize
|
// fixedsize
|
||||||
if ( e->fixedsize ) {
|
if ( e->fixedsize ) {
|
||||||
if ( pe->brushes.onext != &pe->brushes ) {
|
if ( pe->brushes.onext != &pe->brushes ) {
|
||||||
Sys_Printf( "Warning : Fixed size entity with brushes in CPlugInManager::CommitEntityHandleToMap\n" );
|
Sys_FPrintf( SYS_WRN, "Warning : Fixed size entity with brushes in CPlugInManager::CommitEntityHandleToMap\n" );
|
||||||
}
|
}
|
||||||
// create a custom brush
|
// create a custom brush
|
||||||
VectorAdd( e->mins, pe->origin, mins );
|
VectorAdd( e->mins, pe->origin, mins );
|
||||||
|
@ -1590,7 +1592,7 @@ void CPlugInManager::CommitEntityHandleToMap( void* vpEntity ){
|
||||||
else
|
else
|
||||||
{ // brush entity
|
{ // brush entity
|
||||||
if ( pe->brushes.next == &pe->brushes ) {
|
if ( pe->brushes.next == &pe->brushes ) {
|
||||||
Sys_Printf( "Warning: Brush entity with no brushes in CPlugInManager::CommitEntityHandleToMap\n" );
|
Sys_FPrintf( SYS_WRN, "Warning: Brush entity with no brushes in CPlugInManager::CommitEntityHandleToMap\n" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1636,7 +1638,7 @@ void CPlugInManager::CommitEntityHandleToMap( void* vpEntity ){
|
||||||
world_entity = pe;
|
world_entity = pe;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
Sys_Printf( "Warning : unexpected world_entity == NULL in CommitEntityHandleToMap\n" );
|
Sys_FPrintf( SYS_WRN, "Warning : unexpected world_entity == NULL in CommitEntityHandleToMap\n" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1673,7 +1675,7 @@ patchMesh_t* QERApp_GetSelectedPatch(){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
Sys_Printf( "WARNING: QERApp_GetSelectedPatchTexdef called with no patch selected\n" );
|
Sys_FPrintf( SYS_WRN, "WARNING: QERApp_GetSelectedPatchTexdef called with no patch selected\n" );
|
||||||
#endif
|
#endif
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -1765,7 +1767,7 @@ void WINAPI QERApp_DeletePatch( int index ){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
Sys_Printf( "Warning: QERApp_DeletePatch: FindPatchHandle failed\n" );
|
Sys_FPrintf( SYS_WRN, "Warning: QERApp_DeletePatch: FindPatchHandle failed\n" );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1378,7 +1378,7 @@ brush_t* Patch_GenericMesh( int nWidth, int nHeight, int nOrientation, bool bDel
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !bOverride && !QE_SingleBrush() ) {
|
if ( !bOverride && !QE_SingleBrush() ) {
|
||||||
Sys_Printf( "Error: you must have a single brush selected\n" );
|
Sys_FPrintf( SYS_ERR, "ERROR: you must have a single brush selected\n" );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4956,7 +4956,7 @@ void Patch_ShiftTextureST( patchMesh_t *p, float fx, float fy ){
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
// NOTE: when called by Patch_ShiftTexture this warning may be bogus
|
// NOTE: when called by Patch_ShiftTexture this warning may be bogus
|
||||||
if ( ( ABS( fx ) >= 1 ) || ( ABS( fy ) >= 1 ) ) {
|
if ( ( ABS( fx ) >= 1 ) || ( ABS( fy ) >= 1 ) ) {
|
||||||
Sys_Printf( "WARNING: increments exceed 1 in Patch_ShiftTextureST\n" );
|
Sys_FPrintf( SYS_WRN, "WARNING: increments exceed 1 in Patch_ShiftTextureST\n" );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
for ( int w = 0; w < p->width; w++ )
|
for ( int w = 0; w < p->width; w++ )
|
||||||
|
|
|
@ -108,7 +108,7 @@ void WINAPI QE_CheckOpenGLForErrors( void ){
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Sys_Printf( "Warning: OpenGL Error %s\n", qgluErrorString( (GLenum)i ) );
|
Sys_FPrintf( SYS_WRN, "WARNING: OpenGL Error %s\n", qgluErrorString( (GLenum)i ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -802,13 +802,13 @@ qboolean QE_SingleBrush( bool bQuiet ){
|
||||||
if ( ( selected_brushes.next == &selected_brushes )
|
if ( ( selected_brushes.next == &selected_brushes )
|
||||||
|| ( selected_brushes.next->next != &selected_brushes ) ) {
|
|| ( selected_brushes.next->next != &selected_brushes ) ) {
|
||||||
if ( !bQuiet ) {
|
if ( !bQuiet ) {
|
||||||
Sys_Printf( "Error: you must have a single brush selected\n" );
|
Sys_FPrintf( SYS_ERR, "ERROR: you must have a single brush selected\n" );
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ( selected_brushes.next->owner->eclass->fixedsize ) {
|
if ( selected_brushes.next->owner->eclass->fixedsize ) {
|
||||||
if ( !bQuiet ) {
|
if ( !bQuiet ) {
|
||||||
Sys_Printf( "Error: you cannot manipulate fixed size entities\n" );
|
Sys_FPrintf( SYS_ERR, "ERROR: you cannot manipulate fixed size entities\n" );
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<PlatformToolset>v110_xp</PlatformToolset>
|
<PlatformToolset>v140</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
<ImportGroup Label="ExtensionSettings">
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
@ -84,7 +84,7 @@
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<AdditionalOptions>/STACK:8388608 %(AdditionalOptions)</AdditionalOptions>
|
<AdditionalOptions>/STACK:8388608 %(AdditionalOptions)</AdditionalOptions>
|
||||||
<AdditionalDependencies>Ws2_32.lib;glib-2.0.lib;gobject-2.0.lib;intl.lib;gtk-win32-2.0.lib;gdk-win32-2.0.lib;pango-1.0.lib;pangoft2-1.0.lib;gdkglext-win32-1.0.lib;gtkglext-win32-1.0.lib;libxml2_a.lib;mathlib.lib;synapse.lib;l_net.lib;cmdlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>Ws2_32.lib;glib-2.0.lib;gobject-2.0.lib;intl.lib;gtk-win32-2.0.lib;gdk-win32-2.0.lib;pango-1.0.lib;pangoft2-1.0.lib;gdkglext-win32-1.0.lib;gtkglext-win32-1.0.lib;libxml2_a.lib;mathlib.lib;synapse.lib;l_net.lib;cmdlib.lib;Dbghelp.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
<AdditionalLibraryDirectories>$(SolutionDir)\..\gtk-2.24.10\lib;$(SolutionDir)\..\libxml2-2.9.2/win32/bin.msvc;$(SolutionDir)\..\gtkglext-1.2.0\lib;$(SolutionDir)\build\$(Configuration)\libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
<AdditionalLibraryDirectories>$(SolutionDir)\..\gtk-2.24.10\lib;$(SolutionDir)\..\libxml2-2.9.2/win32/bin.msvc;$(SolutionDir)\..\gtkglext-1.2.0\lib;$(SolutionDir)\build\$(Configuration)\libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<SubSystem>Console</SubSystem>
|
<SubSystem>Console</SubSystem>
|
||||||
|
@ -106,7 +106,7 @@
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<AdditionalOptions>/STACK:8388608 %(AdditionalOptions)</AdditionalOptions>
|
<AdditionalOptions>/STACK:8388608 %(AdditionalOptions)</AdditionalOptions>
|
||||||
<AdditionalDependencies>Ws2_32.lib;glib-2.0.lib;gobject-2.0.lib;intl.lib;gtk-win32-2.0.lib;gdk-win32-2.0.lib;pango-1.0.lib;pangoft2-1.0.lib;gdkglext-win32-1.0.lib;gtkglext-win32-1.0.lib;libxml2_a.lib;mathlib.lib;synapse.lib;l_net.lib;cmdlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>Ws2_32.lib;glib-2.0.lib;gobject-2.0.lib;intl.lib;gtk-win32-2.0.lib;gdk-win32-2.0.lib;pango-1.0.lib;pangoft2-1.0.lib;gdkglext-win32-1.0.lib;gtkglext-win32-1.0.lib;libxml2_a.lib;mathlib.lib;synapse.lib;l_net.lib;cmdlib.lib;Dbghelp.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
<AdditionalLibraryDirectories>$(SolutionDir)\..\gtk-2.24.10\lib;$(SolutionDir)\..\libxml2-2.9.2/win32/bin.msvc;$(SolutionDir)\..\gtkglext-1.2.0\lib;$(SolutionDir)\build\$(Configuration)\libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
<AdditionalLibraryDirectories>$(SolutionDir)\..\gtk-2.24.10\lib;$(SolutionDir)\..\libxml2-2.9.2/win32/bin.msvc;$(SolutionDir)\..\gtkglext-1.2.0\lib;$(SolutionDir)\build\$(Configuration)\libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<SubSystem>Console</SubSystem>
|
<SubSystem>Console</SubSystem>
|
||||||
|
@ -124,7 +124,7 @@
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<AdditionalOptions>/STACK:8388608 %(AdditionalOptions)</AdditionalOptions>
|
<AdditionalOptions>/STACK:8388608 %(AdditionalOptions)</AdditionalOptions>
|
||||||
<AdditionalDependencies>Ws2_32.lib;glib-2.0.lib;gobject-2.0.lib;intl.lib;gtk-win32-2.0.lib;gdk-win32-2.0.lib;pango-1.0.lib;pangoft2-1.0.lib;gdkglext-win32-1.0.lib;gtkglext-win32-1.0.lib;libxml2_a.lib;mathlib.lib;synapse.lib;l_net.lib;cmdlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>Ws2_32.lib;glib-2.0.lib;gobject-2.0.lib;intl.lib;gtk-win32-2.0.lib;gdk-win32-2.0.lib;pango-1.0.lib;pangoft2-1.0.lib;gdkglext-win32-1.0.lib;gtkglext-win32-1.0.lib;libxml2_a.lib;mathlib.lib;synapse.lib;l_net.lib;cmdlib.lib;Dbghelp.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
<AdditionalLibraryDirectories>$(SolutionDir)\..\gtk-2.24.10\lib;$(SolutionDir)\..\libxml2-2.9.2/win32/bin.msvc;$(SolutionDir)\..\gtkglext-1.2.0\lib;$(SolutionDir)\build\$(Configuration)\libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
<AdditionalLibraryDirectories>$(SolutionDir)\..\gtk-2.24.10\lib;$(SolutionDir)\..\libxml2-2.9.2/win32/bin.msvc;$(SolutionDir)\..\gtkglext-1.2.0\lib;$(SolutionDir)\build\$(Configuration)\libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
|
@ -146,7 +146,7 @@
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<AdditionalOptions>/STACK:8388608 %(AdditionalOptions)</AdditionalOptions>
|
<AdditionalOptions>/STACK:8388608 %(AdditionalOptions)</AdditionalOptions>
|
||||||
<AdditionalDependencies>Ws2_32.lib;glib-2.0.lib;gobject-2.0.lib;intl.lib;gtk-win32-2.0.lib;gdk-win32-2.0.lib;pango-1.0.lib;pangoft2-1.0.lib;gdkglext-win32-1.0.lib;gtkglext-win32-1.0.lib;libxml2_a.lib;mathlib.lib;synapse.lib;l_net.lib;cmdlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>Ws2_32.lib;glib-2.0.lib;gobject-2.0.lib;intl.lib;gtk-win32-2.0.lib;gdk-win32-2.0.lib;pango-1.0.lib;pangoft2-1.0.lib;gdkglext-win32-1.0.lib;gtkglext-win32-1.0.lib;libxml2_a.lib;mathlib.lib;synapse.lib;l_net.lib;cmdlib.lib;Dbghelp.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
<AdditionalLibraryDirectories>$(SolutionDir)\..\gtk-2.24.10\lib;$(SolutionDir)\..\libxml2-2.9.2/win32/bin.msvc;$(SolutionDir)\..\gtkglext-1.2.0\lib;$(SolutionDir)\build\$(Configuration)\libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
<AdditionalLibraryDirectories>$(SolutionDir)\..\gtk-2.24.10\lib;$(SolutionDir)\..\libxml2-2.9.2/win32/bin.msvc;$(SolutionDir)\..\gtkglext-1.2.0\lib;$(SolutionDir)\build\$(Configuration)\libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
|
|
|
@ -849,7 +849,7 @@ void ComputeAbsolute( face_t* f, vec3_t& p1, vec3_t& p2, vec3_t& p3 ){
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
if ( g_qeglobals.m_bBrushPrimitMode ) {
|
if ( g_qeglobals.m_bBrushPrimitMode ) {
|
||||||
Sys_Printf( "Warning : illegal call of ComputeAbsolute in brush primitive mode\n" );
|
Sys_FPrintf( SYS_WRN, "Warning : illegal call of ComputeAbsolute in brush primitive mode\n" );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -898,7 +898,7 @@ void AbsoluteToLocal( plane_t normal2, face_t* f, vec3_t& p1, vec3_t& p2, vec3_t
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
if ( g_qeglobals.m_bBrushPrimitMode ) {
|
if ( g_qeglobals.m_bBrushPrimitMode ) {
|
||||||
Sys_Printf( "Warning : illegal call of AbsoluteToLocal in brush primitive mode\n" );
|
Sys_FPrintf( SYS_WRN, "Warning : illegal call of AbsoluteToLocal in brush primitive mode\n" );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ int WINAPI QERApp_GetFaceInfo( int iface, _QERFaceData *pFaceData, winding_t *pW
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if ( !g_qeglobals.m_bBrushPrimitMode ) {
|
if ( !g_qeglobals.m_bBrushPrimitMode ) {
|
||||||
Sys_Printf( "Warning: unexpected QERApp_GetFaceInfo out of brush primitive mode\n" );
|
Sys_FPrintf( SYS_WRN, "Warning: unexpected QERApp_GetFaceInfo out of brush primitive mode\n" );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
face_t *selFace = reinterpret_cast<face_t*>( g_ptrSelectedFaces.GetAt( iface ) );
|
face_t *selFace = reinterpret_cast<face_t*>( g_ptrSelectedFaces.GetAt( iface ) );
|
||||||
|
@ -77,7 +77,7 @@ int WINAPI QERApp_SetFaceInfo( int iface, _QERFaceData *pFaceData ){
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if ( !g_qeglobals.m_bBrushPrimitMode ) {
|
if ( !g_qeglobals.m_bBrushPrimitMode ) {
|
||||||
Sys_Printf( "Warning: unexpected QERApp_SetFaceInfo out of brush primitive mode\n" );
|
Sys_FPrintf( SYS_WRN, "Warning: unexpected QERApp_SetFaceInfo out of brush primitive mode\n" );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
face_t *selFace = reinterpret_cast<face_t*>( g_ptrSelectedFaces.GetAt( iface ) );
|
face_t *selFace = reinterpret_cast<face_t*>( g_ptrSelectedFaces.GetAt( iface ) );
|
||||||
|
|
|
@ -375,7 +375,7 @@ static void OnBtnMatchGrid( GtkWidget *widget, gpointer data ){
|
||||||
hscale = gtk_spin_button_get_value_as_float( GTK_SPIN_BUTTON( g_dlgSurface.GetDlgWidget( "hscale" ) ) );
|
hscale = gtk_spin_button_get_value_as_float( GTK_SPIN_BUTTON( g_dlgSurface.GetDlgWidget( "hscale" ) ) );
|
||||||
vscale = gtk_spin_button_get_value_as_float( GTK_SPIN_BUTTON( g_dlgSurface.GetDlgWidget( "vscale" ) ) );
|
vscale = gtk_spin_button_get_value_as_float( GTK_SPIN_BUTTON( g_dlgSurface.GetDlgWidget( "vscale" ) ) );
|
||||||
if ( hscale == 0.0f || vscale == 0.0f ) {
|
if ( hscale == 0.0f || vscale == 0.0f ) {
|
||||||
Sys_Printf( "ERROR: unexpected scale == 0.0f\n" );
|
Sys_FPrintf( SYS_ERR, "ERROR: unexpected scale == 0.0f\n" );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
DoSnapTToGrid( hscale, vscale );
|
DoSnapTToGrid( hscale, vscale );
|
||||||
|
|
|
@ -41,7 +41,7 @@ void QERApp_GetTwoSelectedPatch( patchMesh_t **p1, patchMesh_t **p2 ){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
Sys_Printf( "WARNING: QERApp_GetTwoSelectedPatch failed (did not find two patches)\n" );
|
Sys_FPrintf( SYS_WRN, "WARNING: QERApp_GetTwoSelectedPatch failed (did not find two patches)\n" );
|
||||||
#endif
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1086,7 +1086,7 @@ IShader* Texture_NextPos( int *x, int *y ){
|
||||||
nCurrentShader++;
|
nCurrentShader++;
|
||||||
pCurrentShader = QERApp_ActiveShader_ForIndex( nCurrentShader );
|
pCurrentShader = QERApp_ActiveShader_ForIndex( nCurrentShader );
|
||||||
if ( pCurrentShader == NULL ) {
|
if ( pCurrentShader == NULL ) {
|
||||||
Sys_Printf( "ERROR: unexpected pCurrentShader == NULL in Texture_NextPos\n" );
|
Sys_FPrintf( SYS_ERR, "ERROR: unexpected pCurrentShader == NULL in Texture_NextPos\n" );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
current_texture = pCurrentShader->getTexture();
|
current_texture = pCurrentShader->getTexture();
|
||||||
|
@ -1285,7 +1285,7 @@ void SelectTexture( int mx, int my, bool bShift, bool bFitScale ){
|
||||||
&& my < y && y - my < nHeight + FONT_HEIGHT ) {
|
&& my < y && y - my < nHeight + FONT_HEIGHT ) {
|
||||||
if ( bShift ) {
|
if ( bShift ) {
|
||||||
if ( pCurrentShader->IsDefault() ) {
|
if ( pCurrentShader->IsDefault() ) {
|
||||||
Sys_Printf( "ERROR: %s is not a shader, it's a texture.\n", pCurrentShader->getName() );
|
Sys_FPrintf( SYS_ERR, "ERROR: %s is not a shader, it's a texture.\n", pCurrentShader->getName() );
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
ViewShader( pCurrentShader->getShaderFileName(), pCurrentShader->getName() );
|
ViewShader( pCurrentShader->getShaderFileName(), pCurrentShader->getName() );
|
||||||
|
@ -1321,7 +1321,7 @@ void SelectTexture( int mx, int my, bool bShift, bool bFitScale ){
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
// this one is never supposed to be set as current one
|
// this one is never supposed to be set as current one
|
||||||
if ( pAuxShader->IsColor() ) {
|
if ( pAuxShader->IsColor() ) {
|
||||||
Sys_Printf( "ERROR: unexpected pCurrentShader->IsColor() in SelectTexture\n" );
|
Sys_FPrintf( SYS_ERR, "ERROR: unexpected pCurrentShader->IsColor() in SelectTexture\n" );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
// NOTE: IsColor is false, IsDefault the only remaining property
|
// NOTE: IsColor is false, IsDefault the only remaining property
|
||||||
|
@ -1701,7 +1701,7 @@ void TexWnd::OnSize( int cx, int cy ){
|
||||||
void TexWnd::OnExpose() {
|
void TexWnd::OnExpose() {
|
||||||
int nOld = g_qeglobals.d_texturewin.m_nTotalHeight;
|
int nOld = g_qeglobals.d_texturewin.m_nTotalHeight;
|
||||||
if ( !MakeCurrent() ) {
|
if ( !MakeCurrent() ) {
|
||||||
Sys_Printf( "ERROR: glXMakeCurrent failed..\n " );
|
Sys_FPrintf( SYS_ERR, "ERROR: glXMakeCurrent failed..\n " );
|
||||||
Sys_Printf( "Please restart Radiant if the Texture view is not working\n" );
|
Sys_Printf( "Please restart Radiant if the Texture view is not working\n" );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -170,7 +170,7 @@ void WINAPI QERApp_UnHookWindow( IWindowListener* pListen ){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
Sys_Printf( "WARNING: IWindowListener not found in QERApp_UnHookWindow\n" );
|
Sys_FPrintf( SYS_WRN, "WARNING: IWindowListener not found in QERApp_UnHookWindow\n" );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -198,7 +198,7 @@ bool DispatchOnLButtonUp( guint32 nFlags, int x, int y ){
|
||||||
void WINAPI QERApp_HookListener( IListener* pListen, int Msg ){
|
void WINAPI QERApp_HookListener( IListener* pListen, int Msg ){
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
if ( Msg >= RADIANT_MSGCOUNT ) {
|
if ( Msg >= RADIANT_MSGCOUNT ) {
|
||||||
Sys_Printf( "ERROR: bad index in QERApp_HookListener\n" );
|
Sys_FPrintf( SYS_ERR, "ERROR: bad index in QERApp_HookListener\n" );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -221,7 +221,7 @@ int WINAPI QERApp_UnHookListener( IListener* pListen ){
|
||||||
void DispatchRadiantMsg( int Msg ){
|
void DispatchRadiantMsg( int Msg ){
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
if ( Msg >= RADIANT_MSGCOUNT ) {
|
if ( Msg >= RADIANT_MSGCOUNT ) {
|
||||||
Sys_Printf( "ERROR: bad index in DispatchRadiantMsg\n" );
|
Sys_FPrintf( SYS_ERR, "ERROR: bad index in DispatchRadiantMsg\n" );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -227,7 +227,7 @@ void Undo_GeneralStart( const char *operation ){
|
||||||
|
|
||||||
if ( g_lastundo ) {
|
if ( g_lastundo ) {
|
||||||
if ( !g_lastundo->done ) {
|
if ( !g_lastundo->done ) {
|
||||||
Sys_Printf( "Undo_Start: WARNING last undo not finished.\n" );
|
Sys_FPrintf( SYS_WRN, "WARNING last undo not finished.\n" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -363,7 +363,7 @@ void Undo_AddBrush( brush_t *pBrush ){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ( g_lastundo->entitylist.next != &g_lastundo->entitylist ) {
|
if ( g_lastundo->entitylist.next != &g_lastundo->entitylist ) {
|
||||||
Sys_Printf( "Undo_AddBrushList: WARNING adding brushes after entity.\n" );
|
Sys_FPrintf( SYS_WRN, "WARNING adding brushes after entity.\n" );
|
||||||
}
|
}
|
||||||
//if the brush is already in the undo
|
//if the brush is already in the undo
|
||||||
if ( Undo_BrushInUndo( g_lastundo, pBrush ) ) {
|
if ( Undo_BrushInUndo( g_lastundo, pBrush ) ) {
|
||||||
|
@ -406,7 +406,7 @@ void Undo_AddBrushList( brush_t *brushlist ){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ( g_lastundo->entitylist.next != &g_lastundo->entitylist ) {
|
if ( g_lastundo->entitylist.next != &g_lastundo->entitylist ) {
|
||||||
Sys_Printf( "Undo_AddBrushList: WARNING adding brushes after entity.\n" );
|
Sys_FPrintf( SYS_WRN, "WARNING adding brushes after entity.\n" );
|
||||||
}
|
}
|
||||||
//copy the brushes to the undo
|
//copy the brushes to the undo
|
||||||
for ( pBrush = brushlist->next ; pBrush != NULL && pBrush != brushlist; pBrush = pBrush->next )
|
for ( pBrush = brushlist->next ; pBrush != NULL && pBrush != brushlist; pBrush = pBrush->next )
|
||||||
|
@ -626,7 +626,7 @@ void Undo_Undo( qboolean bSilent ){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ( !g_lastundo->done ) {
|
if ( !g_lastundo->done ) {
|
||||||
Sys_Printf( "Undo_Undo: WARNING: last undo not yet finished!\n" );
|
Sys_FPrintf( SYS_WRN, "WARNING: last undo not yet finished!\n" );
|
||||||
}
|
}
|
||||||
// get the last undo
|
// get the last undo
|
||||||
undo = g_lastundo;
|
undo = g_lastundo;
|
||||||
|
@ -801,7 +801,7 @@ void Undo_Redo( void ){
|
||||||
}
|
}
|
||||||
if ( g_lastundo ) {
|
if ( g_lastundo ) {
|
||||||
if ( !g_lastundo->done ) {
|
if ( !g_lastundo->done ) {
|
||||||
Sys_Printf( "WARNING: last undo not finished.\n" );
|
Sys_FPrintf( SYS_WRN, "WARNING: last undo not finished.\n" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// get the last redo
|
// get the last redo
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue