本文整理汇总了C++中AssetManager::GetTexture方法的典型用法代码示例。如果您正苦于以下问题:C++ AssetManager::GetTexture方法的具体用法?C++ AssetManager::GetTexture怎么用?C++ AssetManager::GetTexture使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AssetManager
的用法示例。
在下文中一共展示了AssetManager::GetTexture方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(void)
{
// Make sure these four lines are put first since some of the
// other classes need the managers to be initialised so they
// can pick up the correct data.
SPS2Manager.Initialise(4096); // 4096 * 4K Pages = 16MB Total
VIFStaticDMA.Initialise(3072); // 1536 * 4K Pages = 6MB Static DMA
VIFDynamicDMA.Initialise(256); // 256 * 4K Pages * 2 Buffers =
// 2MB Dynamic DMA
Pipeline.Initialise(); // Initialise graphics pipline class
// Initialise Lighting
// Three lights and Ambient light
// Direction vector Colour
Pipeline.SetLight1(Vector4( 0.0f, 0.5f, -1.0f, 0.0f), Vector4( 0.0f, 0.0f, 128.0f, 0.0f));
Pipeline.SetLight2(Vector4( 1.0f, -0.5f, -1.0f, 0.0f), Vector4( 0.0f, 128.0f, 0.0f, 0.0f));
Pipeline.SetLight3(Vector4( -1.0f, -0.5f, -1.0f, 0.0f), Vector4( 128.0f, 0.0f, 0.0f, 0.0f));
// Colour
Pipeline.SetAmbient(Vector4(50.0f,50.0f,50.0f,50.0f));
// Terrain to render
CTerrain Terrain;
// Performance timer - call after SPS2Manager.Initialise()
CTimer Timer;
// Set up audio devices
AudioDevice DSP0(0);
// Set up music in sound buffer 0
SoundSample music("go_cart", &DSP0);
// Play the music!
music.Play();
// Initialise control pad 0
if(!pad_init(PAD_0, PAD_INIT_LOCK | PAD_INIT_ANALOGUE | PAD_INIT_PRESSURE))
{
printf("Failed to initialise control pad\n");
pad_cleanup(PAD_0);
exit(0);
}
enable_actuator(0, 1, 1);
// Initialise the VU1 manager class
CVU1MicroProgram VU1MicroCode(&VU_vu1code_start, &VU_vu1code_end);
// Upload the microcode
VU1MicroCode.Upload();
// Register our signal function for every possible signal (i.e. ctrl + c)
for(int sig=0; sig<128; sig++)
signal(sig, sig_handle);
// Set up the DMA packet to clear the screen. We want to clear to blue.
SPS2Manager.InitScreenClear(0, 0x25, 0x50);
// Set Up Camera --------------------------------------------------------------
Pipeline.PositionCamera(Vector4(0.0f, 55.0f, 80.0f, 1.0f), Vector4(0.0f, 40.0f, 0.0f, 1.0f));
// Load in texture and models ----------------------------------------------
// Set up asset loader
AssetManager assetManager;
assetManager.Initialize();
// Terrain texture
CTexture* terrainTexture = assetManager.GetTexture("terrain");
// Set up game manager
GameManager* gameManager = new GameManager;
gameManager->Initialize();
// The main Render loop -------------------------------------------------------
while(g_bLoop)
{
// Process Audio
DSP0.HandleAudio();
VIFDynamicDMA.Fire();
// Update Control Pad
pad_update(PAD_0);
Pipeline.Update(0, 0, 0, 0, 0);
// Logic
g_bLoop = gameManager->Logic();
// Render
SPS2Manager.BeginScene();
// Render terrain
AssetManager::GetSingleton().LoadTexture(terrainTexture);
Matrix4x4 matWorld, matTrans, matScale;
matTrans.Translation(0.0f, -30.0f, 0.0f);
matScale.Scaling(20.0f);
matWorld = matScale * matTrans;
Terrain.SetWorldMatrix(matWorld);
//.........这里部分代码省略.........