当前位置: 首页>>代码示例>>C++>>正文


C++ CrtRender::SetUsingNormalMaps方法代码示例

本文整理汇总了C++中CrtRender::SetUsingNormalMaps方法的典型用法代码示例。如果您正苦于以下问题:C++ CrtRender::SetUsingNormalMaps方法的具体用法?C++ CrtRender::SetUsingNormalMaps怎么用?C++ CrtRender::SetUsingNormalMaps使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CrtRender的用法示例。


在下文中一共展示了CrtRender::SetUsingNormalMaps方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: WinMain

//----------------------------------------------------------------------------------------------------
// Standard windows mainline, this is the program entry point
//
CrtInt32 WINAPI WinMain(	HINSTANCE	hInstance,		
					HINSTANCE	hPrevInstance,	
					LPSTR		lpCmdLine,			
					CrtInt32			nCmdShow)	
{
	(void)hPrevInstance; // Avoid warnings
	(void)nCmdShow; // Avoid warnings
	(void)hInstance; // Avoid warnings

#ifndef NO_DEVIL
	ilInit();
#endif

	MSG		msg;									
	BOOL	done=FALSE;								
	
	// Avoid warnings later
	msg.wParam = 0;

	// Turns on windows heap debugging
#if HEAP_DEBUG
	_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_CHECK_ALWAYS_DF | _CRTDBG_CHECK_CRT_DF /*| _CRTDBG_DELAY_FREE_MEM_DF*/);
#endif

	// Ask The User Which Screen Mode They Prefer
	//	if (MessageBox(NULL,"Would You Like To Run In Fullscreen Mode?", "Start FullScreen?",MB_YESNO|MB_ICONQUESTION)==IDNO)
	{
		fullscreen=FALSE;							
	}

	// Set the default screen size
	_CrtRender.SetScreenWidth( 640);
	_CrtRender.SetScreenHeight( 480);

	// Create an OpenGL Window
	if (!CreateGLWindow("Collada Viewer for PC", _CrtRender.GetScreenWidth(), _CrtRender.GetScreenHeight(),32,fullscreen))
	{
		return 0;									
	}
	
	// Turn data dumping (debug) off
	//CrtBool dumpData = CrtFalse; 

	// Initialize the renderer
	// !!!GAC for compatibility with the new COLLADA_FX code, Init now forces UsingCg and UsingVBOs to
	// !!!GAC false.  It also calls CrtInitCg, creating the CG context and calling cgGLRegisterStates.
	// !!!GAC All these things are currently required for the cfx rendering path to work, changing them
	// !!!GAC may cause problems.  This is work in progress and will be much cleaner when the refactor is done.
	
	_CrtRender.Init();
	//_CrtRender.SetRenderDebug( CrtTrue ); 

	// !!!GAC kept for reference, changing these may cause problems with the cfx include path
	//_CrtRender.SetUsingCg( CrtFalse );
	// Turn off VBOs (the GL skinning path doesn't work with VBOs yet)
	_CrtRender.SetUsingVBOs( CrtTrue ); 
	_CrtRender.SetUsingNormalMaps( CrtTrue ); 	
	//_CrtRender.SetRenderDebug( CrtTrue ); 
	//_CrtRender.SetUsingShadowMaps(CrtTrue);

	// We might get a windows-style path on the command line, this can mess up the DOM which expects
	// all paths to be URI's.  This block of code does some conversion to try and make the input
	// compliant without breaking the ability to accept a properly formatted URI.  Right now this only
	// displays the first filename
	char
		file[512],
		*in = lpCmdLine,
		*out = file;
	*out = NULL;
	// If the first character is a ", skip it (filenames with spaces in them are quoted)
	if(*in == '\"')
	{
		in++;
	}
	if(*(in+1) == ':')
	{
		// Second character is a :, assume we have a path with a drive letter and add a slash at the beginning
		*(out++) = '/';
	}
	int i;
	for(i =0; i<512; i++)
	{
		// If we hit a null or a quote, stop copying.  This will get just the first filename.
		if(*in == NULL || *in == '\"')
			break;
		// Copy while swapping backslashes for forward ones
		if(*in == '\\')
		{
			*out = '/';
		}
		else
		{
			*out = *in;
		}
		in++;
		out++;
	}
//.........这里部分代码省略.........
开发者ID:mDibyo,项目名称:docker-files,代码行数:101,代码来源:mainPC.cpp

示例2: main

//----------------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------
int main(int LArgC, char** LArgV)
{
    atexit(DestroyCrt);		// Need this, because old GLUT never returns from glutMainLoop()

    // Create an OpenGL Window
    if (!CreateGLWindow(LArgC, LArgV, (char*)"COLLADA_DOM Sample Viewer", _CrtRender.GetScreenWidth(), _CrtRender.GetScreenHeight()))
    {
        return 0;
    }

    // Initialize the renderer
    // !!!GAC for compatibility with the new COLLADA_FX code, Init now forces UsingCg and UsingVBOs to
    // !!!GAC false.  It also calls CrtInitCg, creating the CG context and calling cgGLRegisterStates.
    // !!!GAC All these things are currently required for the cfx rendering path to work, changing them
    // !!!GAC may cause problems.  This is work in progress and will be much cleaner when the refactor is done.

    _CrtRender.Init();

    _CrtRender.SetUsingVBOs( CrtTrue );
    _CrtRender.SetUsingNormalMaps( CrtTrue );

    // Load the file name provided on the command line
    if(LArgC > 1 && LArgV[1])
    {
        printf("%s(): Loading %s...\n", __FUNCTION__, LArgV[1]);
        fflush(stdout);
        if ( !_CrtRender.Load( LArgV[1] ))
        {
            exit(0);
        }
    }
    else
    {
        printf("%s(): Loading default document cage.dae... \n", __FUNCTION__);
        fflush(stdout);
        if ( !_CrtRender.Load( "cage.dae" ))
        {
            exit(0);
        }
    }

    // This block of code shows how to enumerate all the effects, get their parameters and then
    // get their UI information.
#if 1
    if(_CrtRender.GetScene())
    {
        // Get the scene and setup to iterate over all the effects stored in the cfxLoader
        CrtScene *scene = _CrtRender.GetScene();


        std::map<std::string, cfxEffect*>::iterator effectIterator;
        effectIterator = scene->cfxEffects.begin();
        // Iterate over all the effects
        while(effectIterator != scene->cfxEffects.end())
        {
            // This is the effect name you would use in a UI
            CrtPrint("Effect name %s\n", effectIterator->first.c_str());
            cfxEffect *thiscfxEffect = effectIterator->second;
            CGeffect thisCGEffect = thiscfxEffect->getEffect();
            CGparameter thisCGParameter = cgGetFirstEffectParameter(thisCGEffect);
            while(thisCGParameter != NULL)
            {
                // This is the parameter name you would use in the UI
                const char *parameterName = cgGetParameterName(thisCGParameter);
                // This is for the example of how to tweek a parameter (doesn't work yet)
                if(CrtCmp(parameterName, "Amplitude"))
                {
                    // Capture the parameter and save it in a global, in a GUI you would
                    // save this handle in the widget so it would know what to tweek.
                    amplitudeGlobalParameter = thisCGParameter;
                }
#if 0
                // This is here for debugging, it iterates over all the annotations and prints them out
                // so you can see what's in them.  Normally this code will be turned off.
                CrtPrint("  Parameter name %s\n",parameterName);
                CGannotation dbgCGAnnotation = cgGetFirstParameterAnnotation(thisCGParameter);
                while(dbgCGAnnotation != NULL)
                {
                    const char *annotationName = cgGetAnnotationName(dbgCGAnnotation);
                    CrtPrint("      Annotation: %s",annotationName);
                    if(cgGetAnnotationType(dbgCGAnnotation) == CG_STRING)
                    {
                        const char *annotationString = cgGetStringAnnotationValue(dbgCGAnnotation);
                        CrtPrint(" value: %s\n",annotationString);
                    }
                    else if(cgGetAnnotationType(dbgCGAnnotation) == CG_FLOAT)
                    {
                        int nvalues;
                        const float *value = cgGetFloatAnnotationValues(dbgCGAnnotation, &nvalues);
                        CrtPrint(" value: %f\n",*value);  // Assume there is one value
                    }
                    else
                    {
                        CrtPrint("\n");
                    }
                    dbgCGAnnotation = cgGetNextAnnotation(dbgCGAnnotation);
                }
#endif
//.........这里部分代码省略.........
开发者ID:sbarthelemy,项目名称:collada-dom,代码行数:101,代码来源:main.cpp


注:本文中的CrtRender::SetUsingNormalMaps方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。