More movie texture work. Changed plib's release CRT version to "Multithreaded DLL".

This commit is contained in:
Chris Danford
2002-11-28 20:48:00 +00:00
parent 4e4c143223
commit 04e2c0b68c
12 changed files with 50 additions and 35 deletions
+29 -27
View File
@@ -56,23 +56,6 @@ private:
bool frame_is_new; // true if frame hasn't let been requested bool frame_is_new; // true if frame hasn't let been requested
public: public:
void Update( float fDeltaTime )
{
secsIntoPlay += fDeltaTime;
while( secsIntoPlay > streamSecs )
{
secsIntoPlay -= streamSecs;
}
int this_frame = secsIntoPlay/streamSecs*numFrames;
if( last_frame != this_frame )
{
frame_is_new = true;
GetFrame( this_frame );
last_frame = this_frame;
}
}
int GetVideoWidth() { return videoWidth; } int GetVideoWidth() { return videoWidth; }
int GetVideoHeight() { return videoHeight; } int GetVideoHeight() { return videoHeight; }
int GetFrameWidth() { return frameWidth; } int GetFrameWidth() { return frameWidth; }
@@ -91,11 +74,8 @@ public:
AVIFileInit(); // Opens The AVIFile Library AVIFileInit(); // Opens The AVIFile Library
// Opens The AVI Stream // Opens The AVI Stream
if (AVIStreamOpenFromFile(&pavi, sFile, streamtypeVIDEO, 0, OF_READ, NULL) !=0) if (AVIStreamOpenFromFile(&pavi, sFile, streamtypeVIDEO, 0, OF_READ, NULL) !=0 )
{ throw RageException( "Failed To Open The AVI Stream" );
// An Error Occurred Opening The Stream
MessageBox (HWND_DESKTOP, "Failed To Open The AVI Stream", "Error", MB_OK | MB_ICONEXCLAMATION);
}
AVIStreamInfo(pavi, &psi, sizeof(psi)); // Reads Information About The Stream Into psi AVIStreamInfo(pavi, &psi, sizeof(psi)); // Reads Information About The Stream Into psi
videoWidth=psi.rcFrame.right-psi.rcFrame.left; // Width Is Right Side Of Frame Minus Left videoWidth=psi.rcFrame.right-psi.rcFrame.left; // Width Is Right Side Of Frame Minus Left
@@ -121,10 +101,7 @@ public:
pgf=AVIStreamGetFrameOpen(pavi, NULL); // Create The PGETFRAME Using Our Request Mode pgf=AVIStreamGetFrameOpen(pavi, NULL); // Create The PGETFRAME Using Our Request Mode
if (pgf==NULL) if (pgf==NULL)
{ throw RageException( "Failed To Open The AVI Frame" );
// An Error Occurred Opening The Frame
MessageBox (HWND_DESKTOP, "Failed To Open The AVI Frame", "Error", MB_OK | MB_ICONEXCLAMATION);
}
} }
~AviRenderer(void) // Properly Closes The Avi File ~AviRenderer(void) // Properly Closes The Avi File
@@ -136,6 +113,24 @@ public:
AVIFileExit(); // Release The File AVIFileExit(); // Release The File
} }
void Update( float fDeltaTime )
{
secsIntoPlay += fDeltaTime;
while( secsIntoPlay > streamSecs )
{
secsIntoPlay -= streamSecs;
}
int this_frame = secsIntoPlay/streamSecs*numFrames;
if( last_frame != this_frame )
{
frame_is_new = true;
GetFrame( this_frame );
last_frame = this_frame;
}
}
void flipIt(void* buffer) // Flips The Red And Blue Bytes (256x256) void flipIt(void* buffer) // Flips The Red And Blue Bytes (256x256)
{ {
void* b = buffer; // Pointer To The Buffer void* b = buffer; // Pointer To The Buffer
@@ -181,7 +176,7 @@ public:
// 1:1 copy into the new surface // 1:1 copy into the new surface
DrawDibDraw (hdd, hdc, 0, 0, videoWidth, videoHeight, lpbi, pdata, 0, 0, videoWidth, videoHeight, 0); DrawDibDraw (hdd, hdc, 0, 0, videoWidth, videoHeight, lpbi, pdata, 0, 0, videoWidth, videoHeight, 0);
// flipIt(data); // Swap The Red And Blue Bytes (GL Compatability) flipIt(data); // Swap The Red And Blue Bytes (GL Compatability)
} }
}; };
@@ -310,16 +305,23 @@ void RageMovieTexture::Create()
unsigned int RageMovieTexture::GetGLTextureID() unsigned int RageMovieTexture::GetGLTextureID()
{ {
if( pAviRenderer->IsNewFrameReady() )
{
unsigned char* data = pAviRenderer->GetData(); unsigned char* data = pAviRenderer->GetData();
// Update The Texture // Update The Texture
glBindTexture( GL_TEXTURE_2D, m_uGLTextureID ); glBindTexture( GL_TEXTURE_2D, m_uGLTextureID );
glPixelStorei(GL_UNPACK_ROW_LENGTH, m_iTextureWidth); glPixelStorei(GL_UNPACK_ROW_LENGTH, m_iTextureWidth);
glTexSubImage2D (GL_TEXTURE_2D, 0, 0, 0, m_iTextureWidth, m_iTextureHeight, GL_RGB, GL_UNSIGNED_BYTE, data); glTexSubImage2D (GL_TEXTURE_2D, 0, 0, 0, m_iTextureWidth, m_iTextureHeight, GL_RGB, GL_UNSIGNED_BYTE, data);
}
return m_uGLTextureID; return m_uGLTextureID;
} }
void RageMovieTexture::Update( float fDeltaTime )
{
pAviRenderer->Update( fDeltaTime );
}
void RageMovieTexture::Play() void RageMovieTexture::Play()
{ {
+1
View File
@@ -22,6 +22,7 @@ class RageMovieTexture : public RageTexture
public: public:
RageMovieTexture( CString sFilePath, RageTexturePrefs prefs ); RageMovieTexture( CString sFilePath, RageTexturePrefs prefs );
virtual ~RageMovieTexture(); virtual ~RageMovieTexture();
virtual void Update( float fDeltaTime );
virtual void Invalidate() { m_uGLTextureID = 0; } virtual void Invalidate() { m_uGLTextureID = 0; }
virtual void Reload( RageTexturePrefs prefs ); virtual void Reload( RageTexturePrefs prefs );
+1
View File
@@ -46,6 +46,7 @@ class RageTexture
public: public:
RageTexture( CString sFilePath, RageTexturePrefs prefs ); RageTexture( CString sFilePath, RageTexturePrefs prefs );
virtual ~RageTexture() = 0; virtual ~RageTexture() = 0;
virtual void Update( float fDeltaTime ) {}
virtual void Reload( RageTexturePrefs prefs ) = 0; virtual void Reload( RageTexturePrefs prefs ) = 0;
virtual void Invalidate() { } /* only called by RageTextureManager::InvalidateTextures */ virtual void Invalidate() { } /* only called by RageTextureManager::InvalidateTextures */
virtual unsigned int GetGLTextureID() = 0; // accessed by RageDisplay virtual unsigned int GetGLTextureID() = 0; // accessed by RageDisplay
+9
View File
@@ -43,6 +43,15 @@ RageTextureManager::~RageTextureManager()
} }
} }
void RageTextureManager::Update( float fDeltaTime )
{
for( std::map<CString, RageTexture*>::iterator i = m_mapPathToTexture.begin();
i != m_mapPathToTexture.end(); ++i)
{
RageTexture* pTexture = i->second;
pTexture->Update( fDeltaTime );
}
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Load/Unload textures from disk // Load/Unload textures from disk
+1
View File
@@ -22,6 +22,7 @@ class RageTextureManager
{ {
public: public:
RageTextureManager( int iTextureColorDepth, int iSecsBeforeUnload ); RageTextureManager( int iTextureColorDepth, int iSecsBeforeUnload );
virtual void Update( float fDeltaTime );
~RageTextureManager(); ~RageTextureManager();
RageTexture* LoadTexture( CString sTexturePath, RageTexturePrefs prefs ); RageTexture* LoadTexture( CString sTexturePath, RageTexturePrefs prefs );
+1 -1
View File
@@ -37,7 +37,7 @@ ScreenSandbox::ScreenSandbox()
m_quad.SetDiffuse( RageColor(1,1,1,1) ); m_quad.SetDiffuse( RageColor(1,1,1,1) );
this->AddChild( &m_quad ); this->AddChild( &m_quad );
m_sprite.Load( "C:\\stepmania\\stepmania\\RandomMovies\\face2.avi" ); m_sprite.Load( "C:\\stepmania\\stepmania\\RandomMovies\\cm301[1].avi" );
m_sprite.SetXY( CENTER_X, CENTER_Y ); m_sprite.SetXY( CENTER_X, CENTER_Y );
this->AddChild( &m_sprite ); this->AddChild( &m_sprite );
+1
View File
@@ -491,6 +491,7 @@ void GameLoop()
if( INPUTMAN->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD, DIK_GRAVE) ) ) if( INPUTMAN->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD, DIK_GRAVE) ) )
fDeltaTime /= 4; fDeltaTime /= 4;
TEXTUREMAN->Update( fDeltaTime );
MUSIC->Update( fDeltaTime ); MUSIC->Update( fDeltaTime );
SCREENMAN->Update( fDeltaTime ); SCREENMAN->Update( fDeltaTime );
NETWORK->Update( fDeltaTime ); NETWORK->Update( fDeltaTime );
Binary file not shown.
+1 -1
View File
@@ -41,7 +41,7 @@ RSC=rc.exe
# PROP Intermediate_Dir "Release" # PROP Intermediate_Dir "Release"
# PROP Target_Dir "" # PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /Zi /O2 /I "..\util" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /FD /c # ADD CPP /nologo /MD /W3 /GX /Zi /O2 /I "..\util" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /FD /c
# SUBTRACT CPP /YX # SUBTRACT CPP /YX
# ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG"
+1 -1
View File
@@ -41,7 +41,7 @@ RSC=rc.exe
# PROP Intermediate_Dir "Release" # PROP Intermediate_Dir "Release"
# PROP Target_Dir "" # PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /Zi /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /FD /c # ADD CPP /nologo /MD /W3 /GX /Zi /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /FD /c
# SUBTRACT CPP /YX # SUBTRACT CPP /YX
# ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG"
Binary file not shown.
Binary file not shown.