Quick Sign In:  

Forum: VirtualDJ Plugins

Topic: VirtualDJ Video Plugins

This topic is old and might contain outdated or incorrect information.

djcelPRO InfinityModeratorMember since 2004
Since v3.1, there are two kinds of video plugins:
* effect
* transition
 

Posted Sun 07 Aug 05 @ 10:59 pm
djcelPRO InfinityModeratorMember since 2004
Default values of TVertex:
vertex[0].position.x=-1.f;vertex[0].position.y=1.f;vertex[0].position.z=0.5f;
vertex[1].position.x=1.f;vertex[1].position.y=1.f;vertex[1].position.z=0.5f;
vertex[2].position.x=-1.f;vertex[2].position.y=-1.f;vertex[2].position.z=0.5f;
vertex[3].position.x=1.f;vertex[3].position.y=-1.f;vertex[3].position.z=0.5f;
vertex[0].color=D3DCOLOR_RGBA(0xFF,0xFF,0xFF,0xFF);
vertex[1].color=D3DCOLOR_RGBA(0xFF,0xFF,0xFF,0xFF);
vertex[2].color=D3DCOLOR_RGBA(0xFF,0xFF,0xFF,0xFF);
vertex[3].color=D3DCOLOR_RGBA(0xFF,0xFF,0xFF,0xFF);
tx=(float)ImageWidth/(float)TextureWidth;
ty=(float)ImageHeight/(float)TextureHeight;
vertex[0].tu=0.f;vertex[0].tv=0.f;
vertex[1].tu=tx;vertex[1].tv=0.f;
vertex[2].tu=0.f;vertex[2].tv=ty;
vertex[3].tu=tx;vertex[3].tv=ty;

NB: 0xFF = 255

x : to the right
y : to the up
z : to the back
 

Posted Mon 08 Aug 05 @ 6:06 pm
djcelPRO InfinityModeratorMember since 2004
For Transition plugins:
virtual HRESULT __stdcall Compose(int crossfader,HRESULT(__stdcall *RenderSurface[2])(),TVertex *vertices[2])=0;

crossfader : value of the video crossfader

RenderSurface[0]() : function to show the left deck video
RenderSurface[1]() : function to show the right deck video

vertices[0] : vertices for left video
So you have for left deck:
vertices[0][0] : top left corner
vertices[0][1] : top right corner
vertices[0][2] : bottom left corner
vertices[0][3] : bottom right corner

vertices[1] : vertices for right video
So you have for right deck:
vertices[1][0] : top left corner
vertices[1][1] : top right corner
vertices[1][2] : bottom left corner
vertices[1][3] : bottom right corner

Be careful !!
you must restore the vertices if you modify them, and save and restore any directX state you alter during this function. By default, you have:
D3DDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
D3DDevice->SetRenderState(D3DRS_ZENABLE, FALSE);
D3DDevice->SetRenderState(D3DRS_LIGHTING, FALSE);
D3DDevice->SetRenderState(D3DRS_ALPHATESTENABLE, FALSE);
D3DDevice->SetRenderState(D3DRS_MULTISAMPLEANTIALIAS, FALSE);
D3DDevice->SetRenderState(D3DRS_STENCILENABLE, FALSE);

 

Posted Mon 08 Aug 05 @ 11:08 pm
djcelPRO InfinityModeratorMember since 2004
For effet plugins:
vertices[0] : top left corner
vertices[1] : top right corner
vertices[2] : bottom left corner
vertices[3] : bottom right corner
 

Posted Mon 08 Aug 05 @ 11:16 pm
djcelPRO InfinityModeratorMember since 2004
Some information about Direct3D (now renamed DirectGraphics) in DirectX:
(Copyright Microsoft DirectX v9.0 help)

IDirect3DDevice9 :
-------------------

Applications use the methods of the IDirect3DDevice9 interface to perform
DrawPrimitive-based rendering, create resources, work with system-level variables,
adjust gamma ramp levels, work with palettes, and create shaders.


IDirect3DTexture9 :
---------------------

Applications use the methods of the IDirect3DTexture9 interface to manipulate a texture
resource.

IDirect3DSurface9 :
--------------------

Applications use the methods of the IDirect3DSurface9 interface to query and prepare surfaces.
 

Posted Sat 13 Aug 05 @ 2:27 pm
djcelPRO InfinityModeratorMember since 2004
Direct3D Help:

* To write text, you can use this example:

(police: height=15, bold, "System")
(text="VirtualDJ")

ID3DXFont* g_pFont = NULL;

D3DXCreateFont( D3DDevice, 15, 0, FW_BOLD, 1, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "System", &g_pFont );

RECT rc;

// Position on the screen
SetRect( &rc, 15, 15, 0, 0 );

//Show the text, strg, on the screen with a specific color (here yellow)
// Pass in DT_NOCLIP so we don't have to calc the bottom/right of the rect
g_pFont->DrawText( NULL, "VirtualDJ", -1, &rc, DT_NOCLIP, D3DXCOLOR( 1.0f, 1.0f, 0.0f, 1.0f ));


* To show a picture, you can use this example: (based on surfaces)
#define DIRECT3D_VERSION 0x9000
#include < d3dx9.h> // We need this header (and not d3d9.h) because of D3DXLoadSurfaceFromFile()

#pragma comment(lib, "d3dx9.lib")


IDirect3DSurface9 *NewSurface;


//--------------------------------------------------------------------------------------------------------
// Init

HRESULT hr;
D3DDISPLAYMODE dm;
hr=D3DDevice->GetDisplayMode(NULL,&dm);
if(FAILED(hr)) dm.Format=D3DFMT_X8R8G8B8;

hr=D3DDevice->CreateRenderTarget(ImageWidth,ImageHeight,dm.Format,D3DMULTISAMPLE_NONE,0, false,&NewSurface,NULL);
if(FAILED(hr)) return hr;

hr=D3DXLoadSurfaceFromFile(NewSurface,NULL,NULL, "picture.jpg" ,NULL, D3DX_DEFAULT, 0,NULL );
if( FAILED(hr) ) return hr;

//----------------------------------------------------------------------------------------------------
// OnDraw(IDirect3DTexture9 *texture,TVertex *vertices)
{
HRESULT hr;
IDirect3DSurface9 *VideoSurface=NULL; // The video surface

hr=texture->GetSurfaceLevel(0,&VideoSurface);
if(FAILED(hr)) return hr;

hr=D3DDevice->StretchRect(NewSurface,NULL,VideoSurface,NULL,D3DTEXF_NONE);
VideoSurface->Release();
if(FAILED(hr)) return hr;
return S_FALSE;
}
//-----------------------------------------------------------------------------------------------
// Exit
if(NewSurface) NewSurface->Release();
 

Posted Sat 19 Aug 06 @ 6:28 pm
djcelPRO InfinityModeratorMember since 2004
Logics of Video Effects in the new SDK of VirtualDJ v4.x

1) OnLoad()
2) OnGetPluginInfo()

3)OnDxInit()

4) OnStart()
5) OnStop()

6) OnDxClose()

7) Release()

 

Posted Sun 20 Aug 06 @ 12:13 pm
djcelPRO InfinityModeratorMember since 2004
Video Transition "Cube":

D3DMATRIX newProjection={1,0,0,0, 0,1,0,0, 0,0,1.25,1, 0,0,-0.625,0};

totally equals to:

D3DXMATRIX newProjection;
D3DXMatrixPerspectiveLH( &newProjection, 1.0f, 1.0f, 0.5, 2.5 );
 

Posted Tue 29 Aug 06 @ 7:14 pm
djcelPRO InfinityModeratorMember since 2004
 

Posted Fri 01 Sep 06 @ 3:05 pm
djcelPRO InfinityModeratorMember since 2004
By default:

1) In windows mode: size of the image (in pixels):
ImageWidth= 320
ImageHeight=240

2) Details about the coordinates of the textures:
tx=1.0f => TextureWidth=ImageWidth (in pixels)
ty=1.0f => TextureHeight=ImageHeight (in pixels)


Example: for a zoom, we need TextureWidth >= ImageWidth and TextureHeight >= ImageHeight
=> tx < 1.0f and ty < 1.0f

NB:
tu=(1+x)/2
tv=(1-x)/2
 

Posted Fri 01 Sep 06 @ 11:21 pm


(Old topics and forums are automatically closed)