Skip to content

Commit e76da89

Browse files
committed
WIP: Render Movie
1 parent f2c3ebd commit e76da89

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

OpenJPOG/Source/Movie/ABINKMoviePlayer.cpp

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,19 @@ TBOOL ABINKMoviePlayer::Render()
154154
if (!FrameReady()) {
155155
return TFALSE;
156156
}
157-
TSpriteShader *pShader = AGUISystem::GetGUISystem()->GetShader();
157+
AGUISystem *system = AGUISystem::GetGUISystem();
158+
TSpriteShader *pShader = system->GetShader();
159+
TFLOAT height = system->GetScreen()->GetHeight() / 448.0f;
160+
TFLOAT width = system->GetScreen()->GetWidth() / 640.0f;
161+
pShader->SetColour(TGUIColour());
158162
for (int i = 0; i < MAX_TILES; i++) {
163+
pShader->SetMaterial(m_aRects[i].pMaterial);
164+
pShader->RenderTriStrip(
165+
m_aRects[i].m_iPosX * width + (-0.0f), m_aRects[i].m_iPosY * height + (-0.0f),
166+
m_aRects[i].m_iWidth * width + (-0.0f), m_aRects[i].m_iHeight * height + (-0.0f),
167+
-10.0f,
168+
m_aRects[i].m_vPos(0), m_aRects[i].m_vPos(1),
169+
m_aRects[i].m_vUV(0), m_aRects[i].m_vUV(1));
159170
}
160171
}
161172

@@ -165,15 +176,21 @@ TBOOL ABINKMoviePlayer::RenderToTexture(TTextureResource *a_pTexture)
165176
if (m_hBink) {
166177
m_iWidth = m_hBink->Width;
167178
m_iHeight = m_hBink->Height;
168-
if (a_pTexture && !m_bHasMovieStopped) {
179+
if (a_pTexture && !m_bHasMovieStopped && !m_bDrawingFrame) {
169180
if (s_iPlayForegroundFast) {
170181
BinkDoFrame(m_hBink);
171182
BinkNextFrame(m_hBink);
172183
return FALSE;
173184
}
174185
m_iFrameCount++;
186+
TTextureResourceHAL *pTextureRes = static_cast<TTextureResourceHAL *>(a_pTexture);
187+
IDirect3DTexture8 *pTexture = pTextureRes->GetD3DTexture();
188+
D3DLOCKED_RECT rect;
175189
// TODO: Do some Texture stuff
176190
BinkDoFrame(m_hBink);
191+
pTexture->LockRect(0, &rect, TNULL, 0);
192+
BinkCopyToBuffer(m_hBink, rect.pBits, rect.Pitch, m_hBink->Height, 0, 0, 3);
193+
pTexture->UnlockRect(0);
177194
if (m_iFrameCount == m_hBink->Frames) {
178195
}
179196
}

0 commit comments

Comments
 (0)