本文整理汇总了C++中CrtRender::GetScene方法的典型用法代码示例。如果您正苦于以下问题:C++ CrtRender::GetScene方法的具体用法?C++ CrtRender::GetScene怎么用?C++ CrtRender::GetScene使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CrtRender
的用法示例。
在下文中一共展示了CrtRender::GetScene方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DrawGLScene
//----------------------------------------------------------------------------------------------------
// Render routine
//----------------------------------------------------------------------------------------------------
void DrawGLScene(void)
{
// Clear The Screen And The Depth Buffer
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
CrtMaterial mat;
mat.Ambient = CrtColor3f( 1,1,1 );
mat.Diffuse = CrtColor3f( 1,1,1 );
glMaterialfv( GL_FRONT_AND_BACK, GL_DIFFUSE, (GLfloat *)&mat.Diffuse );
glMaterialfv( GL_FRONT_AND_BACK, GL_AMBIENT, (GLfloat *)&mat.Ambient );
glMaterialfv( GL_FRONT_AND_BACK, GL_SPECULAR, (GLfloat *)&mat.Specular );
glMaterialf( GL_FRONT_AND_BACK, GL_SHININESS, (GLfloat )mat.Shininess );
if(_CrtRender.GetScene())
_CrtRender.Render();
glutSwapBuffers();
}
示例2: WinMain
//.........这里部分代码省略.........
{
*out = *in;
}
in++;
out++;
}
// Should throw an error if i>= 512, but we don't have error dialongs in the code yet so just let it try to load and fail
if(i < 511)
*out = NULL;
time_t seconds = time (NULL);
clock_t clocka = clock ();
cleaned_file_name = file;
// Load the file name provided on the command line
if ( !_CrtRender.Load( cleaned_file_name ))
{
exit(0);
}
time_t loadtime = time (NULL) - seconds;
int clockload = (int) clock () - clocka;
CrtPrint("\nLOAD TIME OF %s\n", file);
CrtPrint("IS %d SECONDS\n", loadtime);
CrtPrint("IS %d CLOCK TICKS\n\n", clockload);
// This block of code shows how to enumerate all the effects, get their parameters and then
// get their UI information.
#if 1
{
// 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)
{
示例3: 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
//.........这里部分代码省略.........