BlitzMovie 1.2 release and map editor news

Blitz3D Forums/Blitz3D Userlibs/BlitzMovie 1.2 release and map editor news

It seems as soon as I use a texture instead of an image for BLITZMOVIE_OpenDecodeToDX/Surface, I get the MAV. I can play this 512*512 Movie without any problem when I use an image-handle instead. I guess it's not the movie format. Probably the Hardware: Radeon 9200SE.

Here's the code I successfully use to play a small (320*240) Movie and scale it up to screen size in realtime, plus some Fake TV Scanlines to make the rough Resolution less obvious:

; BlitzMovie Decode To Blitz3D Image Demo
; (c) 2005 Harriman Software
; www.harrimansoftware.com/blitzmovie

; Many thanks to tom@... for the information on how to get at
; the IDirectDrawSurface7 contained in a Blitz3D image or texture.


;Added Fullscreen Scaling by jfk

; This example will play any movie at Fullscreen size. It is using a Pseudo TV-Scanline Effect
; that will magicly enhance the look of very small movies that are played in Fullscreen
; Mode.
; However, on TFT Crystal Displays you should set gr_w and gr_h to your physical Screen 
; Resolution to prevent an ugly Moiree Effect from the TV-Scanline effect.

AppTitle "BlitzMovie Decode To Blitz3D Image Demo (C) 2005 Harriman Software"
gr_w=1024
gr_h=768
Graphics3D gr_w, gr_h, 32, 1
gr_w=GraphicsWidth()
gr_h=GraphicsHeight()

SetBuffer BackBuffer()

; init myResizeImage(img,w,h)
Global myResizeCamera=CreateCamera() 
CameraClsMode myResizeCamera,0,1
Global myResizeQuad=CreateQuad()
Global myResizeTex=CreateTexture(1024,1024,256 Or 16 Or 32)
EntityTexture myResizeQuad,myResizeTex
EntityFX myResizeQuad,1
CameraRange myResizeCamera,0.01,100
TranslateEntity myResizeCamera,(1.0/1024.0),-(1.0/1024.0),-1.0
EntityParent myResizeQuad,myResizeCamera,1
; end of init myResizeImage(img,w,h)


movie_to_play$="mymovie.avi"

; just open it with Blitzes OpenMovie Command to get its size, then close it again :)
dummy=OpenMovie(movie_to_play$)
m_width=MovieWidth(dummy)
m_height=MovieHeight(dummy)
CloseMovie dummy
Delay 200


; create an image that we'll be decoding the movie to
Global image = CreateImage(m_width,m_height)

; Open the movie in decode to Blitz3D dx7 surface mode
result = BLITZMOVIE_OpenDecodeToDX7Surface( movie_to_play$, image)
If Not result
	BLITZMOVIE_Close()
	RuntimeError "Error loading movie! Quitting..."
EndIf

; play the movie
result = BLITZMOVIE_Play()
If Not result
	BLITZMOVIE_Close()
	RuntimeError "Error playing movie! Quitting..."
EndIf

Global width = BLITZMOVIE_GetWidth()
Global height = BLITZMOVIE_GetHeight()


While BLITZMOVIE_IsPlaying() And (Not KeyHit(1))			
    Delay 1
    dummy=myProjectImage(image,gr_w, gr_h)
	scanlines(gr_h) ; a TV Effect
	Flip 0
Wend

BLITZMOVIE_Stop()
BLITZMOVIE_Close()
FreeImage(image)

End

Function scanlines(h)
 Color 0,0,0
 w=GraphicsWidth()-1
 For i=0 To h Step 4
  Rect 0,i,w,3,0
 Next
End Function



Function myProjectImage(img,w#,h#)
; copies an image To a texture of a quad that is placed in front of a cam and then scaled to w,h
 img_w#=ImageWidth(img)
 img_h#=ImageHeight(img)
 If img_w>1024 Then img_w=1024
 If img_h>1024 Then img_h=1024
 If img_w<1 Then img_w=1
 If img_h<1 Then img_h=1

 If w>1024 Then w=1024
 If h>1024 Then h=1024
 If w<1 Then w=1
 If h<1 Then h=1

 w_rel#=w#/img_w#
 h_rel#=h#/img_h#
 g_rel#=1024.0/GraphicsWidth()

 CopyRect 0,0,img_w,img_h,512-(img_w/2.0),512-(img_h/2.0),ImageBuffer(img),TextureBuffer(myResizeTex)
 ScaleEntity myResizeQuad,w_rel*g_rel,h_rel*g_rel,0.0001
 RenderWorld()
End Function



Function CreateQuad()
  ; creates a quad, facing to the right side
  mesh=CreateMesh()
  surf=CreateSurface(mesh)
  v0=AddVertex(surf, -1.0,   1.0,0, 0,0 )
  v1=AddVertex(surf,  1.0,   1.0,0, 1,0 )
  v2=AddVertex(surf,  1.0,  -1.0,0, 1,1 )
  v3=AddVertex(surf, -1.0,  -1.0,0, 0,1 )
  AddTriangle(surf,v0,v1,v2)
  AddTriangle(surf,v0,v2,v3)
  UpdateNormals mesh
  Return mesh
End Function