@@ -313,9 +313,6 @@ void CVideoMaterial::CreateVideoMaterial( const char* pMaterialName )
313313 m_textureWidth = ALIGN_VALUE (m_videoWidth, 8 );
314314 m_textureHeight = ALIGN_VALUE (m_videoHeight, 8 );
315315
316- // Warning("\nm_textureWidth: %d\nm_textureHeight: %d\nm_videoWidth: %d\nm_videoHeight: %d\n", m_textureWidth, m_textureHeight, m_videoWidth, m_videoHeight);
317-
318-
319316 // create the textures
320317 m_yTexture.InitProceduralTexture ( ytexture, " VideoCacheTextures" , m_textureWidth, m_textureHeight, IMAGE_FORMAT_I8 , tex_flags );
321318 // CB and CR are half the size of the Y (the brightness)
@@ -329,31 +326,6 @@ void CVideoMaterial::CreateVideoMaterial( const char* pMaterialName )
329326 m_crTexture->SetTextureRegenerator ( m_crTextureRegen );
330327 m_cbTexture->SetTextureRegenerator ( m_cbTextureRegen );
331328
332-
333- // ---------------------------
334- // material
335- //
336- // Use the Bik shader as it deals with YUV420
337- KeyValues* pVMTKeyValues = new KeyValues ( " Bik" );
338- pVMTKeyValues->SetString ( " $ytexture" , ytexture );
339- pVMTKeyValues->SetString ( " $cbtexture" , cbtexture );
340- pVMTKeyValues->SetString ( " $crtexture" , crtexture );
341- pVMTKeyValues->SetInt ( " $nofog" , 1 );
342- pVMTKeyValues->SetInt ( " $spriteorientation" , 3 );
343- pVMTKeyValues->SetInt ( " $translucent" , 1 );
344- pVMTKeyValues->SetInt ( " $nolod" , 1 );
345- pVMTKeyValues->SetInt ( " $vertexcolor" , 1 );
346- pVMTKeyValues->SetInt ( " $vertexalpha" , 1 );
347- pVMTKeyValues->SetInt ( " $nomip" , 1 );
348- m_videoMaterial.Init ( pMaterialName, pVMTKeyValues );
349-
350- // Refresh the material vars because apparently init doesn't do this
351- // and retains the previous video's frame
352- m_videoMaterial->Refresh ();
353-
354- m_videoReady = true ;
355- m_videoStarted = false ;
356-
357329 // update the procedural texture with the first frame of the video
358330 WebMFrame video_frame;
359331 VPXDecoder::Image image;
@@ -376,8 +348,29 @@ void CVideoMaterial::CreateVideoMaterial( const char* pMaterialName )
376348 break ;
377349 }
378350 }
379-
380351 m_demuxer->resetVideo ();
352+
353+ // ---------------------------
354+ // material
355+ // Use the Bik shader as it deals with YUV420
356+ KeyValues* pVMTKeyValues = new KeyValues ( " Bik" );
357+ pVMTKeyValues->SetString ( " $ytexture" , ytexture );
358+ pVMTKeyValues->SetString ( " $cbtexture" , cbtexture );
359+ pVMTKeyValues->SetString ( " $crtexture" , crtexture );
360+ pVMTKeyValues->SetInt ( " $nofog" , 1 );
361+ pVMTKeyValues->SetInt ( " $spriteorientation" , 3 );
362+ pVMTKeyValues->SetInt ( " $translucent" , 1 );
363+ pVMTKeyValues->SetInt ( " $nolod" , 1 );
364+ pVMTKeyValues->SetInt ( " $vertexcolor" , 1 );
365+ pVMTKeyValues->SetInt ( " $vertexalpha" , 1 );
366+ pVMTKeyValues->SetInt ( " $nomip" , 1 );
367+ m_videoMaterial.Init ( pMaterialName, pVMTKeyValues );
368+ // Refresh the material vars because apparently init doesn't do this
369+ // and retains the previous video's frame
370+ m_videoMaterial->Refresh ();
371+
372+ m_videoReady = true ;
373+ m_videoStarted = false ;
381374}
382375
383376const char *CVideoMaterial::GetVideoFileName ()
0 commit comments