# New ReleaseD3D9Client Development

#### JMW

Here is an answer that is for way previous versions but might give you a start....

Part quote:
:tiphat:
SOURSE: Decompiling by IDA...
ANSWER: In the "device" night vision is realized by means of ambient_color change. Easily and simply . Only it is necessary to reach orbiter's call IDirect3DDevice7::SetRenderState function interception .
Substitution

Code:
DWORD __stdcall fqSetRenderState (DWORD p,D3DRENDERSTATETYPE dwRenderStateType,  DWORD dwRenderState)
{
if(dwRenderStateType == D3DRENDERSTATE_AMBIENT)
{
ISC.d3dcol_ambient_Save = dwRenderState;
if(ISC.sToPoR &&  ISC.bSubstRwork && ISC.bStep2)
if(ISC.d3dcol_ambient)
dwRenderState =ISC.d3dcol_ambient; //0x0FF00FF00;
}
LPDIRECT3DDEVICE7 tr = (LPDIRECT3DDEVICE7)((DWORD*)p)[1];
return tr->SetRenderState(dwRenderStateType,dwRenderState);
}
Return of old value
Code:
DWORD __stdcall fqEndScene(DWORD p)
{
LPDIRECT3DDEVICE7 tr = (LPDIRECT3DDEVICE7)((DWORD*)p)[1];
LPDIRECT3DDEVICE7 fq = (LPDIRECT3DDEVICE7)p;
if (ISC.sToPoR && ISC.bSubstRwork)
{
DWORD rez;
rez = tr->EndScene();
fq->SetRenderTarget(ISC.CorePr_RenSurf,0);
fq->SetViewport(&ISC.ViewPort_Save);
tr->SetTransform(D3DTRANSFORMSTATE_VIEW,&ISC.ViewTransformMatrix_Save);
tr->SetRenderState(D3DRENDERSTATE_AMBIENT,ISC.d3dcol_ambient_Save);
return rez;
}
return tr->EndScene();
}
PS Core principle of work of the CameraMFD - interception DX calls.

#### 4throck

##### Enthusiast !
Trying to use the Beta version ( for Orbiter beta ) and I get an error:
Orbiter opens a windows error window, with:

can't find entry point
[email protected]@[email protected]@[email protected] in DLL
...\modules\plugin\D3D9Client.dll

Any clue ?

#### martins

##### Orbiter Founder
Orbiter Founder
The unmangled name of that symbol is

public: virtual bool __thiscall oapi::Sketchpad::TextW(int,int,wchar_t *const,int)

That was added recently to accommodate extended character sets for labels. Maybe you need a more recent D3D9 client for Orbiter beta.

#### jarmonik

Beta Tester
New Release

Here's a latest version of the client. It's build by using an automated build script, so, let's hope the automatics got it right.

- There are vessel and ground shadow quality improvements.
- In external view mode a focus vessel can be changed by [LMB + Ctrl + Shift] (i.e. Left clicking the vessel while holding [Ctrl + Shift])
- All custom cameras are now operational near the main camera. (i.e. No longer tied to a focus vessel). "near" is 15km at sea level and 500km at orbit.
- Felix24's translucency effects are updated to support vessel shadowing.

Prebuild binary of the DockingCamera only works with Orbiter BETA. Can be attached to Shutte arm and Docking ports of focus or remote vessel.
.

#### Attachments

• DockingCamera.zip
215.2 KB · Views: 30
• D3D9ClientR3.2-forOrbiter2016(r995).zip
1.5 MB · Views: 111
• D3D9ClientBeta28.0-forBETA r84(r996M).zip
1.7 MB · Views: 42

#### Donamy

Donator
Beta Tester
I'm using the 2016 D9, but the 2016 cameraMFD crashes when I try to select it. When I choose the Betacamera cameraMFD, it works.

What is LMB ?

Last edited:

#### jarmonik

Beta Tester
I'm using the 2016 D9, but the 2016 cameraMFD crashes when I try to select it. When I choose the Betacamera cameraMFD, it works.

It doesn't work due to virtual table missmatch. But here's build for Orbiter 2016.

#### Attachments

• DockingCamera2016.zip
215.4 KB · Views: 46

#### Donamy

Donator
Beta Tester
Could you put the cross hairs back ?:hail:

Here is an answer that is for way previous versions but might give you a start....

Sadly I don't have any experience in DirectX 9 programming. I am not sure if this way can work on D3D9. I hope that someone from D3D9 team would help.

#### kuddel

##### Donator
Donator
Could you put the cross hairs back ?:hail:
The one with the cross, that was probably my "Camera MFD", not Jarmonik's "DockingCamera" MFD...
I know it starts getting confusing, and to add more to it, there is abdullah radwan's one which is just another one...

If you were asking for my "CameraMFD", you might have to wait a little, as my machine is currently not behaving well and I need to fix that first before I can build anything...

#### 4throck

##### Enthusiast !
The unmangled name of that symbol is

public: virtual bool __thiscall oapi::Sketchpad::TextW(int,int,wchar_t *const,int)

That was added recently to accommodate extended character sets for labels. Maybe you need a more recent D3D9 client for Orbiter beta.

With the latest client, I get a similar error window, now mentioning:
[email protected]@[email protected]@[email protected]@@Z

I was never able to get the Beta Client to work on the Beta... Not even on the earlier versions.

#### martins

##### Orbiter Founder
Orbiter Founder
I was never able to get the Beta Client to work on the Beta... Not even on the earlier versions.
Well the general problem here is that whenever I add to the graphics API and reference that addition from Orbiter, some poor soul on the D3D9 team has to implement that as well, which naturally won't be instantaneous - although Jarmo and Kuddel do a pretty marvellous job of keeping things in sync :thumbup:

The D3D9 client releases for Orbiter beta most likely will tell you which Orbiter SVN commit they have been linked against. You just have to make sure that you check out that particular commit from the Orbiter SVN repository, rather than the latest (HEAD) commit.
With the latest client, I get a similar error window, now mentioning:
[email protected]@[email protected]@[email protected]@@Z
Just for information, this symbol refers to

public: unsigned long __thiscall oapi::GraphicsClient::GetSurfaceMarkerLegend(void *, struct oapi::GraphicsClient::LABELTYPE const * *) const

#### kuddel

##### Donator
Donator
The latest build (here) of D3D9Client for Orbiter BETA (D3D9ClientBeta28.0-forBETA r84(r996M).zip) was linked against rev 84 of Orbiter (which equals current HEAD).
But that was the case for at least a Month, so you probably have the latest D3D9Client, but haven't the latest Orbiter BETA...

---------- Post added at 14:39 ---------- Previous post was at 14:26 ----------

Easiest to check if Orbiter and D3D9Client fit, is to look for this in your Orbiter.log:
Code:
**** Orbiter.log
000000.000: Build Sep  5 2018 [v.[B][U]180905[/U][/B]]
...
000000.000: Module D3D9Client.dll ........ [Build 181023, API [B][U]180811[/U][/B]]
...

#### fred18

Donator
- All custom cameras are now operational near the main camera. (i.e. No longer tied to a focus vessel). "near" is 15km at sea level and 500km at orbit.

That's a great starting point, the day it will be possible to see what another vessel sees from any distance it would be the most beautiful addition for my work.
keep up the good work

#### 4throck

##### Enthusiast !
Thanks for the help, for some reason SVN updates to
000000.000: Build Aug 28 2016 [v.160828]

I have it set to HEAD, it reads revision 84, but I seem to be getting older files.
Anyway the problem is certainty on my end :blush:

#### Ripley

##### Tutorial translator
Donator
...I seem to be getting older files.
Anyway the problem is certainty on my end :blush:
Time for a "SVN cleanup"? (from context menu)

---------- Post added at 18:25 ---------- Previous post was at 17:27 ----------

...What is LMB ?
Left Mouse Button.

Last edited:

#### Donamy

Donator
Beta Tester
Figuring out this awesome camera. i.e. focused vessel is Cupola, press F1 for cockpit view, select generic camera, change "VES" to TVstanchion1 view. Looks beautiful !! Press F8 for VC view. Camera view reverts back to Cupola attachment.

Could you make it so the camera retains the different vessel view, when switched to VC mode in Spacecraft3/4 ?

#### Chris74

##### New member
sorry for the noob question.
do celestial bodies cast shadows on each other?
i.e. at solar eclipses, does Moon cast a visible, moving shadow onto Earths surface? :hmm:

thx :thumbup:

Here's a latest version of the client. It's build by using an automated build script, so, let's hope the automatics got it right.

#### DaveS

##### Space Shuttle Ultra Project co-developer
Donator
Beta Tester
sorry for the noob question.
do celestial bodies cast shadows on each other?
i.e. at solar eclipses, does Moon cast a visible, moving shadow onto Earths surface? :hmm:

thx :thumbup:
No, they don't. So no eclipses.

#### Donamy

Donator
Beta Tester
These cameras are fun to use. Could you add no near clipping to the cockpit view ?

#### Attachments

• new camera views.jpg
198.8 KB · Views: 77

#### Chris74

##### New member
No, they don't. So no eclipses.

lol thx meanwhile i figured it out too, after munching thru like 50 threads about REAL solar eclipse observations, which i have absolutely no clue about what on EARTH are those doing in a forum about a spaceflight simulator...

(sorry OP for the off )

but its kinda weird that no eclipses in 2018, not?