More movie texture work. Changed plib's release CRT version to "Multithreaded DLL".
This commit is contained in:
@@ -56,23 +56,6 @@ private:
|
||||
bool frame_is_new; // true if frame hasn't let been requested
|
||||
|
||||
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 GetVideoHeight() { return videoHeight; }
|
||||
int GetFrameWidth() { return frameWidth; }
|
||||
@@ -91,11 +74,8 @@ public:
|
||||
AVIFileInit(); // Opens The AVIFile Library
|
||||
|
||||
// Opens The AVI Stream
|
||||
if (AVIStreamOpenFromFile(&pavi, sFile, streamtypeVIDEO, 0, OF_READ, NULL) !=0)
|
||||
{
|
||||
// An Error Occurred Opening The Stream
|
||||
MessageBox (HWND_DESKTOP, "Failed To Open The AVI Stream", "Error", MB_OK | MB_ICONEXCLAMATION);
|
||||
}
|
||||
if (AVIStreamOpenFromFile(&pavi, sFile, streamtypeVIDEO, 0, OF_READ, NULL) !=0 )
|
||||
throw RageException( "Failed To Open The AVI Stream" );
|
||||
|
||||
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
|
||||
@@ -121,10 +101,7 @@ public:
|
||||
|
||||
pgf=AVIStreamGetFrameOpen(pavi, NULL); // Create The PGETFRAME Using Our Request Mode
|
||||
if (pgf==NULL)
|
||||
{
|
||||
// An Error Occurred Opening The Frame
|
||||
MessageBox (HWND_DESKTOP, "Failed To Open The AVI Frame", "Error", MB_OK | MB_ICONEXCLAMATION);
|
||||
}
|
||||
throw RageException( "Failed To Open The AVI Frame" );
|
||||
}
|
||||
|
||||
~AviRenderer(void) // Properly Closes The Avi File
|
||||
@@ -136,6 +113,24 @@ public:
|
||||
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* b = buffer; // Pointer To The Buffer
|
||||
@@ -181,7 +176,7 @@ public:
|
||||
// 1:1 copy into the new surface
|
||||
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 char* data = pAviRenderer->GetData();
|
||||
if( pAviRenderer->IsNewFrameReady() )
|
||||
{
|
||||
unsigned char* data = pAviRenderer->GetData();
|
||||
|
||||
// Update The Texture
|
||||
glBindTexture( GL_TEXTURE_2D, m_uGLTextureID );
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, m_iTextureWidth);
|
||||
glTexSubImage2D (GL_TEXTURE_2D, 0, 0, 0, m_iTextureWidth, m_iTextureHeight, GL_RGB, GL_UNSIGNED_BYTE, data);
|
||||
// Update The Texture
|
||||
glBindTexture( GL_TEXTURE_2D, m_uGLTextureID );
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, m_iTextureWidth);
|
||||
glTexSubImage2D (GL_TEXTURE_2D, 0, 0, 0, m_iTextureWidth, m_iTextureHeight, GL_RGB, GL_UNSIGNED_BYTE, data);
|
||||
}
|
||||
|
||||
return m_uGLTextureID;
|
||||
}
|
||||
|
||||
void RageMovieTexture::Update( float fDeltaTime )
|
||||
{
|
||||
pAviRenderer->Update( fDeltaTime );
|
||||
}
|
||||
|
||||
void RageMovieTexture::Play()
|
||||
{
|
||||
|
||||
@@ -22,6 +22,7 @@ class RageMovieTexture : public RageTexture
|
||||
public:
|
||||
RageMovieTexture( CString sFilePath, RageTexturePrefs prefs );
|
||||
virtual ~RageMovieTexture();
|
||||
virtual void Update( float fDeltaTime );
|
||||
virtual void Invalidate() { m_uGLTextureID = 0; }
|
||||
virtual void Reload( RageTexturePrefs prefs );
|
||||
|
||||
|
||||
@@ -46,6 +46,7 @@ class RageTexture
|
||||
public:
|
||||
RageTexture( CString sFilePath, RageTexturePrefs prefs );
|
||||
virtual ~RageTexture() = 0;
|
||||
virtual void Update( float fDeltaTime ) {}
|
||||
virtual void Reload( RageTexturePrefs prefs ) = 0;
|
||||
virtual void Invalidate() { } /* only called by RageTextureManager::InvalidateTextures */
|
||||
virtual unsigned int GetGLTextureID() = 0; // accessed by RageDisplay
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -22,6 +22,7 @@ class RageTextureManager
|
||||
{
|
||||
public:
|
||||
RageTextureManager( int iTextureColorDepth, int iSecsBeforeUnload );
|
||||
virtual void Update( float fDeltaTime );
|
||||
~RageTextureManager();
|
||||
|
||||
RageTexture* LoadTexture( CString sTexturePath, RageTexturePrefs prefs );
|
||||
|
||||
@@ -37,7 +37,7 @@ ScreenSandbox::ScreenSandbox()
|
||||
m_quad.SetDiffuse( RageColor(1,1,1,1) );
|
||||
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 );
|
||||
this->AddChild( &m_sprite );
|
||||
|
||||
|
||||
@@ -491,6 +491,7 @@ void GameLoop()
|
||||
if( INPUTMAN->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD, DIK_GRAVE) ) )
|
||||
fDeltaTime /= 4;
|
||||
|
||||
TEXTUREMAN->Update( fDeltaTime );
|
||||
MUSIC->Update( fDeltaTime );
|
||||
SCREENMAN->Update( fDeltaTime );
|
||||
NETWORK->Update( fDeltaTime );
|
||||
|
||||
Binary file not shown.
@@ -41,7 +41,7 @@ RSC=rc.exe
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Target_Dir ""
|
||||
# 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
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
|
||||
@@ -41,7 +41,7 @@ RSC=rc.exe
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Target_Dir ""
|
||||
# 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
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user