Exemple #1
0
RtVoid PreWorld()
#endif
{
	if ( g_cl_fb )
	{
		RiDisplay( tokenCast("aqsis"), tokenCast("framebuffer"), tokenCast("rgb"), NULL );
	}
	else if ( !g_cl_type.empty() )
	{
		RiDisplay( tokenCast("aqsis"), tokenCast(g_cl_type.c_str()),
				   tokenCast(g_cl_mode.c_str()), NULL );
	}
	else if ( !g_cl_addtype.empty() )
	{
		RiDisplay( tokenCast("+aqsis"), tokenCast(g_cl_addtype.c_str()),
				   tokenCast(g_cl_mode.c_str()), NULL );
	}

	// Pass the statistics option onto Aqsis.
	if ( g_cl_endofframe >= 0 )
	{
		RiOption( tokenCast("statistics"), "endofframe", &g_cl_endofframe, RI_NULL );
	}

	// Pass the crop window onto Aqsis.
	if( g_cl_cropWindow.size() == 4 )
	{
		RiCropWindow(g_cl_cropWindow[0], g_cl_cropWindow[1], g_cl_cropWindow[2], g_cl_cropWindow[3]);
	}

	// Pass in specified resolution.
	if(g_cl_res.size() == 2)
	{
		RiFormat(g_cl_res[0], g_cl_res[1], 1.0f);
	}

#	if ENABLE_MPDUMP
	// Pass the statistics option onto Aqsis.
	if ( g_cl_mpdump )
	{
		RtInt enabled = 1;
		RiOption( "mpdump", "enabled", &enabled, RI_NULL );
	}
#	endif

	// Parse all the command line options with the RIB parser.
	for(TqInt i = 0, end = g_cl_options.size(); i < end; ++i)
	{
		std::istringstream inStream(g_cl_options[i]);
		Aqsis::QGetRenderContextI()->parseRibStream(inStream, "command_line_option");
	}
	return;
}
Exemple #2
0
/** \brief Feed command line options to the renderer.
 *
 * This function sends all command line options to the renderer, except those
 * which are set directly before the world block.
 */
void setupOptions()
{
	if ( g_cl_echoapi )
		Aqsis::cxxRenderContext()->addFilter("echorib");

	std::string frameList = getFrameList();
	if(!frameList.empty())
		Aqsis::cxxRenderContext()->addFilter("framedrop",
				Aqsis::ParamListBuilder()("frames", frameList.c_str()) );

	// Allow any command line arguments to override system/env settings
	Aqsis::log() << Aqsis::info
		<< "Applying search paths provided at the command line\n";
	const char* popt[1];
	if(!g_cl_shader_path.empty())
	{
		popt[0] = g_cl_shader_path.c_str();
		RiOption( tokenCast("searchpath"), "shader", &popt, RI_NULL );
	}
	if(!g_cl_archive_path.empty())
	{
		popt[0] = g_cl_archive_path.c_str();
		RiOption( tokenCast("searchpath"), "archive", &popt, RI_NULL );
	}
	if(!g_cl_texture_path.empty())
	{
		popt[0] = g_cl_texture_path.c_str();
		RiOption( tokenCast("searchpath"), "texture", &popt, RI_NULL );
	}
	if(!g_cl_display_path.empty())
	{
		popt[0] = g_cl_display_path.c_str();
		RiOption( tokenCast("searchpath"), "display", &popt, RI_NULL );
	}
	if(!g_cl_procedural_path.empty())
	{
		popt[0] = g_cl_procedural_path.c_str();
		RiOption( tokenCast("searchpath"), "procedural", &popt, RI_NULL );
	}

	RiProgressHandler( &PrintProgress );
}
Exemple #3
0
/** \brief Feed command line options to the renderer.
 *
 * This function sends all command line options to the renderer, except those
 * which are set directly before the world block.
 */
void setupOptions()
{
	if ( g_cl_echoapi )
	{
		RtInt echoapi = 1;
		RiOption( tokenCast("statistics"), "echoapi", &echoapi, RI_NULL );
	}
	
	// Allow any command line arguments to override system/env settings
	Aqsis::log() << Aqsis::info
		<< "Applying search paths provided at the command line\n";
	const char* popt[1];
	if(!g_cl_shader_path.empty())
	{
		popt[0] = g_cl_shader_path.c_str();
		RiOption( tokenCast("searchpath"), "shader", &popt, RI_NULL );
	}
	if(!g_cl_archive_path.empty())
	{
		popt[0] = g_cl_archive_path.c_str();
		RiOption( tokenCast("searchpath"), "archive", &popt, RI_NULL );
	}
	if(!g_cl_texture_path.empty())
	{
		popt[0] = g_cl_texture_path.c_str();
		RiOption( tokenCast("searchpath"), "texture", &popt, RI_NULL );
	}
	if(!g_cl_display_path.empty())
	{
		popt[0] = g_cl_display_path.c_str();
		RiOption( tokenCast("searchpath"), "display", &popt, RI_NULL );
	}
	if(!g_cl_procedural_path.empty())
	{
		popt[0] = g_cl_procedural_path.c_str();
		RiOption( tokenCast("searchpath"), "procedural", &popt, RI_NULL );
	}

	RiProgressHandler( &PrintProgress );
	RiPreWorldFunction( &PreWorld );
}
Exemple #4
0
// Get list of frames, as a string
std::string getFrameList()
{
	std::string frameList;
	if(g_cl_frames.size() == 2)
	{
		std::ostringstream fmt;
		fmt << g_cl_frames[0] << "-" << g_cl_frames[1];
		frameList = fmt.str();
	}
	if(!g_cl_frameList.empty())
	{
		if(!frameList.empty())
			frameList += ',';
		frameList += g_cl_frameList;
	}
	return frameList;
}
Exemple #5
0
int main( int argc, const char** argv )
{

#ifdef	AQSIS_SYSTEM_WIN32
	char acPath[256];
	char rootPath[256];
	if( GetModuleFileName( NULL, acPath, 256 ) != 0)
	{
		// guaranteed file name of at least one character after path
		*( strrchr( acPath, '\\' ) + 1 ) = '\0';
		std::string	 stracPath(acPath);
		stracPath.append("..\\");
		_fullpath(rootPath,&stracPath[0],256);
	}
	g_shader_path = rootPath;
	g_shader_path.append( "shaders" );
#elif defined(AQSIS_SYSTEM_MACOSX)
#else

	g_shader_path = AQSIS_XSTR(DEFAULT_SHADER_PATH);
#endif

	/*Aqsis::QGetRenderContextI();*/
	ArgParse ap;
	ap.usageHeader( ArgParse::apstring( "Usage: " ) + argv[ 0 ] + " <shadername>" );
	ap.argFlag( "help", "\aPrint this help and exit", &g_cl_help );
	ap.alias( "help" , "h" );
	ap.argFlag( "version", "\aPrint version information and exit", &g_cl_version );
	ap.argString( "shaders", "=string\aOverride the default shader searchpath(s) [" + g_shader_path + "]", &g_cl_shader_path );

	if ( argc > 1 && !ap.parse( argc - 1, argv + 1 ) )
	{
		Aqsis::log() << ap.errmsg() << std::endl << ap.usagemsg();
		exit( 1 );
	}

	if ( g_cl_help )
	{
		std::cout << ap.usagemsg();
		exit( 0 );
	}

	if ( g_cl_version )
	{
		std::cout << "aqsltell version " << AQSIS_VERSION_STR_FULL << std::endl << "compiled " << __DATE__ << " " << __TIME__ << std::endl;
		exit( 0 );
	}

	// Apply environment-variable overrides to default paths ...
	if(getenv("AQSIS_SHADER_PATH"))
		g_shader_path = getenv("AQSIS_SHADER_PATH");

	// Apply command-line overrides to default paths ...
	if(!g_cl_shader_path.empty())
		g_shader_path = g_cl_shader_path;

	// Any leftovers are presumed to be shader names.
	if ( ap.leftovers().size() == 0 )     // If no files specified, take input from stdin.
	{
		Aqsis::log() << ap.errmsg() << std::endl << ap.usagemsg();
		exit( 1 );
	}
	else
	{
		for ( ArgParse::apstringvec::const_iterator e = ap.leftovers().begin(); e != ap.leftovers().end(); e++ )
		{
			SLX_SetPath( const_cast<char*>( g_shader_path.c_str() ) );
			SLX_SetDSOPath( const_cast<char*>( g_shader_path.c_str() ) );
			Slo_SetShader( ( char* ) e->c_str() );

			if ( SLX_SetShader( ( char* ) e->c_str() ) == 0 )
			{
				// SLX_SetShader successful
				int	nArgs;
				int i;
				SLX_VISSYMDEF * symPtr;

				std::cout << SLX_TypetoStr( SLX_GetType() ) << " \"" << Slo_GetName() << "\"" << std::endl;
				nArgs = SLX_GetNArgs();

				for ( i = 0; i < nArgs; i++ )
				{
					symPtr = SLX_GetArgById( i );
					if ( symPtr != NULL )
					{
						TqInt arrayLen = 1;
						if ( symPtr->svd_arraylen != 0 )
							arrayLen = symPtr->svd_arraylen;

						std::cout << "    \"" << symPtr->svd_name << "\" \"parameter " <<
						SLX_DetailtoStr( symPtr->svd_detail ) << " " <<
						SLX_TypetoStr( symPtr->svd_type );

						if ( symPtr->svd_arraylen != 0 )
							std::cout << "[" << arrayLen << "]";

						std::cout << "\"" << std::endl;

						TqInt arrayIndex;
						for ( arrayIndex = 0; arrayIndex < arrayLen; arrayIndex++ )
						{
							std::cout << "\t\tDefault value: ";

							if ( symPtr->svd_spacename != NULL )
							{
								if ( ( symPtr->svd_type == SLX_TYPE_POINT ) ||
								        ( symPtr->svd_type == SLX_TYPE_NORMAL ) ||
								        ( symPtr->svd_type == SLX_TYPE_VECTOR ) ||
								        ( symPtr->svd_type == SLX_TYPE_MATRIX ) ||
								        ( symPtr->svd_type == SLX_TYPE_COLOR ) )
									std::cout << "\"" << symPtr->svd_spacename << "\" ";
							}

							if ( symPtr->svd_default.stringval != NULL )
							{
								switch ( symPtr->svd_type )
								{
										case SLX_TYPE_UNKNOWN:
										std::cout << "unknown" << std::endl;
										break;
										case SLX_TYPE_POINT:
										case SLX_TYPE_NORMAL:
										case SLX_TYPE_VECTOR:
										std::cout << "[" << symPtr->svd_default.pointval[ arrayIndex ].xval << " " <<
										symPtr->svd_default.pointval[ arrayIndex ].yval << " " <<
										symPtr->svd_default.pointval[ arrayIndex ].zval <<
										"]" << std::endl;
										break;
										case SLX_TYPE_COLOR:
										std::cout << "[" << symPtr->svd_default.pointval[ arrayIndex ].xval << " " <<
										symPtr->svd_default.pointval[ arrayIndex ].yval << " " <<
										symPtr->svd_default.pointval[ arrayIndex ].zval <<
										"]" << std::endl;
										break;
										case SLX_TYPE_SCALAR:
										std::cout << symPtr->svd_default.scalarval[ arrayIndex ] << std::endl;
										break;
										case SLX_TYPE_STRING:
										std::cout << "\"" << symPtr->svd_default.stringval[ arrayIndex ] << "\"" << std::endl;
										break;
										case SLX_TYPE_MATRIX:
										std::cout << "[" <<
										symPtr->svd_default.matrixval[ arrayIndex ].val[0][0] << " " <<
										symPtr->svd_default.matrixval[ arrayIndex ].val[0][1] << " " <<
										symPtr->svd_default.matrixval[ arrayIndex ].val[0][2] << " " <<
										symPtr->svd_default.matrixval[ arrayIndex ].val[0][2] << " " <<
										symPtr->svd_default.matrixval[ arrayIndex ].val[1][0] << " " <<
										symPtr->svd_default.matrixval[ arrayIndex ].val[1][1] << " " <<
										symPtr->svd_default.matrixval[ arrayIndex ].val[1][2] << " " <<
										symPtr->svd_default.matrixval[ arrayIndex ].val[1][2] << " " <<
										symPtr->svd_default.matrixval[ arrayIndex ].val[2][0] << " " <<
										symPtr->svd_default.matrixval[ arrayIndex ].val[2][1] << " " <<
										symPtr->svd_default.matrixval[ arrayIndex ].val[2][2] << " " <<
										symPtr->svd_default.matrixval[ arrayIndex ].val[2][3] << " " <<
										symPtr->svd_default.matrixval[ arrayIndex ].val[3][0] << " " <<
										symPtr->svd_default.matrixval[ arrayIndex ].val[3][1] << " " <<
										symPtr->svd_default.matrixval[ arrayIndex ].val[3][2] << " " <<
										symPtr->svd_default.matrixval[ arrayIndex ].val[3][3] <<
										"]" << std::endl;
										break;
										default:
										std::cout << "unknown" << std::endl;
										break;
								}
							}
						}
					}
					else
					{
						printf( "ERROR - null pointer to value\n" );
					}
					//std::cout << std::endl;
				}

				SLX_EndShader();
			}
			else
			{
				printf("ERROR - could not read shader file\n");
			}
		}
	}

	return ( 0 );
}