Merge remote-tracking branch 'refs/remotes/TTimo/master' into DisplaySizeInfo

This commit is contained in:
Mateos81 2015-10-31 12:39:58 +01:00
commit f441e81620
6 changed files with 50 additions and 4 deletions

View file

@ -49,7 +49,6 @@
* - '_obj_load' code crashes in a weird way after
* '_obj_mtl_load' for a few .mtl files
* - process 'mtllib' rather than using <model>.mtl
* - handle 'usemtl' statements
*/
/* uncomment when debugging this module */
/* #define DEBUG_PM_OBJ */
@ -859,6 +858,22 @@ static picoModel_t *_obj_load( PM_PARAMS_LOAD ){
/* increase vertex count */
curVertex += max;
}
}
else if ( !_pico_stricmp( p->token, "usemtl" ) ) {
char *materialName;
materialName = _pico_parse( p, 0 );
if( materialName || strlen( materialName ) ) {
picoShader_t *shader;
shader = PicoFindShader( model, materialName, 0 );
if( !shader ) {
shader = PicoNewShader( model );
PicoSetShaderName( shader, materialName );
}
if( shader && curSurface ) {
PicoSetSurfaceShader( curSurface, shader );
}
}
}
/* skip unparsed rest of line and continue */
_pico_parse_skip_rest( p );

View file

@ -39,6 +39,7 @@
#endif
#include <stdio.h>
#include <errno.h>
#include "vfspk3.h"
#include "vfs.h"

View file

@ -121,6 +121,8 @@ void setSpecialLoad( eclass_t *e, const char* pWhat, char*& p ){
}
}
qboolean IsModelEntity( const char *name );
eclass_t *Eclass_InitFromText( char *text ){
char *t;
int len;
@ -181,6 +183,9 @@ eclass_t *Eclass_InitFromText( char *text ){
text++;
}
}
else if ( Get_COM_Token()[0] == '?' ) {
text = t;
}
// get the flags
@ -253,7 +258,7 @@ eclass_t *Eclass_InitFromText( char *text ){
if ( strcmpi( e->name, "path" ) == 0 ) {
e->nShowFlags |= ECLASS_PATH;
}
if ( strcmpi( e->name, "misc_model" ) == 0 ) {
if ( IsModelEntity( e->name ) == qtrue ) {
e->nShowFlags |= ECLASS_MISCMODEL;
}

View file

@ -141,6 +141,8 @@ bfilter_t *FilterAddBase( bfilter_t *pFilter ){
pFilter = FilterAddImpl( pFilter,3,0,"trigger",EXCLUDE_TRIGGERS,true );
pFilter = FilterAddImpl( pFilter,3,0,"misc_model",EXCLUDE_MODELS,true );
pFilter = FilterAddImpl( pFilter,3,0,"misc_gamemodel",EXCLUDE_MODELS,true );
pFilter = FilterAddImpl( pFilter,3,0,"misc_model_static",EXCLUDE_MODELS,true );
pFilter = FilterAddImpl( pFilter,3,0,"model_static",EXCLUDE_MODELS,true );
pFilter = FilterAddImpl( pFilter,4,ECLASS_LIGHT,NULL,EXCLUDE_LIGHTS,true );
pFilter = FilterAddImpl( pFilter,4,ECLASS_PATH,NULL,EXCLUDE_PATHS,true );
pFilter = FilterAddImpl( pFilter,1,0,"lightgrid",EXCLUDE_LIGHTGRID,true );

View file

@ -1837,7 +1837,7 @@ void PrefsDlg::BuildDialog(){
gtk_box_pack_start( GTK_BOX( hbox2 ), label, FALSE, FALSE, 0 );
// adjustment
adj = gtk_adjustment_new( 100, 50, 300, 1, 10, 10 );
adj = gtk_adjustment_new( 100, 1, 300, 1, 10, 10 );
AddDialogData( adj, &m_nMoveSpeed, DLG_ADJ_INT );
// scale

View file

@ -356,6 +356,29 @@ void DrawPathLines( void ){
extern void AssignModel();
static const char *model_classnames[] =
{
"misc_model",
"misc_model_static",
"misc_model_breakable",
"misc_gamemodel",
"model_static",
};
static const size_t model_classnames_count = sizeof( model_classnames ) / sizeof( *model_classnames );
qboolean IsModelEntity( const char *name )
{
for ( size_t i = 0; i < model_classnames_count; i++ )
{
if ( stricmp( name, model_classnames[i] ) == 0 )
{
return qtrue;
}
}
return qfalse;
}
void CreateEntityFromName( const char* name, const vec3_t origin ){
entity_t *e;
brush_t* b;
@ -431,7 +454,7 @@ void CreateEntityFromName( const char* name, const vec3_t origin ){
}
Select_Brush( e->brushes.onext );
if ( ( stricmp( name, "misc_model" ) == 0 ) || ( stricmp( name, "misc_gamemodel" ) == 0 ) || ( strcmpi( name, "model_static" ) == 0 ) ) {
if ( IsModelEntity( name ) == qtrue ) {
SetInspectorMode( W_ENTITY );
AssignModel();
}