Quote: "In addition, it'd be nice if someone could throw together some code that I could use for testing this - I don't use this plug-in much"
IMHO it should replace the current DBPro text and drawing commands. The FPS increase is rediculous.
So IanM, do you have some kind of program that searches for your name on the threads or do you actually read each one? I am surprised I got your attention at all!
Here is the code I came up with for the viewport. I am not sure if I know enough c++ to do what you want. I am just making stuff up and surprised it is actually working...
void D3D_SetViewport(int x, int y, int w, int h)
{
g_pCustomViewport.X = x;
g_pCustomViewport.Y = y;
g_pCustomViewport.Width = w;
g_pCustomViewport.Height = h;
// TODO: Should these be CameraNear/Far?
g_pCustomViewport.MinZ = 0.0f;
g_pCustomViewport.MaxZ = 1.0f;
g_bCustomViewport = true;
g_pD3DDevice->SetViewport(&g_pCustomViewport);
}
void D3D_ResetViewport()
{
g_bCustomViewport = false;
g_pD3DDevice->SetViewport(&g_pDefaultViewPort);
}
Then each drawing command checks for that custom viewport:
if (g_bCustomViewport)
g_pD3DDevice->SetViewport(&g_pCustomViewport);
else
{
g_pViewPort.X = 0;
g_pViewPort.Y = 0;
g_pViewPort.Width = g_pGlob->dwWindowWidth;
g_pViewPort.Height = g_pGlob->dwWindowHeight;
// TODO: Should these be CameraNear/Far?
g_pViewPort.MinZ = 0.0f;
g_pViewPort.MaxZ = 1.0f;
g_pD3DDevice->SetViewport(&g_pViewPort);
}
g_pTextSprite->Begin(D3DXSPRITE_ALPHABLEND | D3DXSPRITE_SORT_DEPTH_BACKTOFRONT);
...
I really like being able to specify the bounds as well so you can can "clip" your drawing commands to a certain area, but the code for when
g_bCustomViewport is false could be fixed with your surface command suggestion.
Edit: I can try to cook up some code for testing the surface thingy, but I have not ventured into 3D yet so the ortho projection example is up to the other guys.
Edit2: I cannot come up with an example showing text being drawn wrong on different surfaces since it is actually working properly now (using Cloggy's DLL, not mine). Also, the built in Text command appears to have gotten an upgrade as well, as the FPS difference no longer exists. You change something in the latest 7.5 update?
Edit3: This is the code that they were using earlier to test the plugin. The fix Cloggy implemented fixed this example for most people, Agent still had the problem even after it was fixed (See his screenshot at the top of this page)
sync on
sync rate 0
set text font "ariel"
set text size 30
d3d_font 1, "ariel", 30, 0, 0, 0
d3d_font 2, "ariel", 30, 0, 0, 1
create bitmap 1, 420, 150
text 0, 0, "Standard DBP text"
d3d_startText
d3d_text 1, 0, 35, 0, "D3D Text Parameter 0"
d3d_text 2, 0, 70, 0, "D3D Text Parameter 1"
d3d_endText
get image 1, 0, 0, 420, 150, 1
delete bitmap 1
repeat
paste image 1, 100, 0, 1
sync
until spacekey()
Edit4: Also, Cloggy updated the plugin in
this post which fixed alot of problems. This new version is 3.7.1.1. The source code on the website is 3.7.1, which lacks the fixes he describes in that post.
And, if you do manage to fix all these problems, can you re-post the source code for us curious types?