New Release D3D9Client Development

You don't even need to edit the config file, D3D9 just puts it on there for us or what? Oh and the dss and then dds HUH !

Sorry not a pro at this yet
 
Yes, just add "_norm" to filename, making the second file: for example, file like "redgit.dds" has to have "redgit_norm.dds". I have plugin in paint.net Program which easily makes those files (they look blue-pink colored).
 
Last edited:
thanks!
this will really help me out

But I was also wondering is it possible to make a displacement map in orbiter or is that just dreaming? and does that even belong in this thread?
 
I am trying to compile my Camera MFD to Orbiter 2010, but I couldn't find the GC API in the D3D9 client Orbiter 2010 version. How can I use the custom cameras in Orbiter 2010?
 
GC API is currently only available for Orbiter 2016 and Orbiter BETA.
From memory, I can not say whether it can be back-ported to Orbiter 2010.
Even if it could be done, I think it might only be a feature-reduced set and therefore most probably not going to happen. Sorry.
 
GC API is currently only available for Orbiter 2016 and Orbiter BETA.
From memory, I can not say whether it can be back-ported to Orbiter 2010.
Even if it could be done, I think it might only be a feature-reduced set and therefore most probably not going to happen. Sorry.
There is a setting to control custom cameras in D3D9 client for Orbiter 2010. How can it be used without the API?
 
Good point. The documentation is not up to date with that setting.
After looking at the source-code[1] I remember that for Orbiter 2010 there is a predecessor to the GC API: OGCI
The interface is declared in Orbitersdk\include\OGCI.h and is defined in Orbitersdk\include\OGCI.cpp

Maybe you can find what you need in there.

[1] ...which is always the best documentation ;)
 
Good point. The documentation is not up to date with that setting.
After looking at the source-code[1] I remember that for Orbiter 2010 there is a predecessor to the GC API: OGCI
The interface is declared in Orbitersdk\include\OGCI.h and is defined in Orbitersdk\include\OGCI.cpp

Maybe you can find what you need in there.

[1] ...which is always the best documentation ;)
The problem is that these files don't exist in the last D3D9 client for Orbiter 2010. It doesn't even have an Orbitersdk folder in the archive. Can you upload everything I need for me? I assume it's only the header and source file (no library because the source file is included). It would be great to include the documentation too (if they aren't already in the interface).

EDIT: Nevermind I found the files in the older version (R15). Looks like they will have what I need. Thank you!
Abdullah, thanks for your efforts!
I agree too thank you for doing this Abdullah.
No problem :giggle:
 
Last edited:
Everything seems to be working fine, except that I can't see any vessel on the MFD:

E4DoiPG.png


Here is the code:
C++:
// Header
class Camera_MFD : public MFD2, public CameraMFD
{
public:
    Camera_MFD(DWORD w, DWORD h, VESSEL *vessel, UINT mfd);
    bool Update(oapi::Sketchpad *skp);
private:
    SURFHANDLE hRenderSrf = nullptr; // 3D render target
    CAMERAHANDLE hCamera = nullptr;  // Custom camera handle used to render views into surfaces and textures
    void setCustomCamera();
};

// Source Code
Camera_MFD::Camera_MFD(DWORD w, DWORD h, VESSEL* vessel, UINT mfd) : MFD2(w, h, vessel)
{
    if (ogciInitialize()) {
        // Create 3D render target
        hRenderSrf = ogciCreateSurfaceEx(W, H, OAPISURFACE_TEXTURE  | OAPISURFACE_RENDERTARGET |
                                               OAPISURFACE_RENDER3D | OAPISURFACE_NOMIPMAPS);
        // Clear the surface
        oapiClearSurface(hRenderSrf);

        setCustomCamera();
    }
}

bool Camera_MFD::Update(oapi::Sketchpad *skp)
{
    // Helper for static texts
    auto SKPTEXT = [skp](int x, int y, const char* str) { skp->Text(x, y, str, strlen(str)); };

    if (hRenderSrf && ogciSketchpadVersion(skp) == SKETCHPAD_DIRECTX) {
        // Blit the camera view into the sketchpad.
        ogciSketchBlt(skp, hRenderSrf, 0, 0);
    }
    else {
        ogciRequestDXSketchpad(skp);
    }
}

// Here is Orbiter 2016 code for comparison
bool Camera_MFD::Update(oapi::Sketchpad *skp)
{
    // Helper for static texts
    auto SKPTEXT = [skp](int x, int y, const char* str) { skp->Text(x, y, str, strlen(str)); };

    if (hRenderSrf && gcSketchpadVersion(skp) == 2) {
        Sketchpad2* skp2 = static_cast<Sketchpad2*>(skp);

        // Blit the camera view into the sketchpad.
        RECT sr = { 0, 0, LONG(W), LONG(H) };
        skp2->CopyRect(hRenderSrf, &sr, 0, 0);
    }
}
// End of Orbiter 2016 code

void Camera_MFD::setCustomCamera()
{
    hCamera = ogciSetupCustomCamera(hCamera, data->hVessel, camData.pos, dir, rot, camData.fov * RAD, hRenderSrf, 0xFF);
}
 
It seems like I can't see the vessel that created the camera only, but I can see other vessels. This happens only in Orbiter 2010. I can see the vessel that created the camera in Orbiter 2016 without a problem.
 
Hi Jarmonik,

As discussed here, I have a HUD which renders clearly in MOGE but only very faintly in your Dx9 client.

Admittedly I'm achieving this with Vinka's old Spacecraft 4, which might be the problem.

As per Urwumpe's suggestion in that thread, would it be possible to include some HUD rendering options in your client which may solve the issue?
 
It seems like I can't see the vessel that created the camera only, but I can see other vessels. This happens only in Orbiter 2010. I can see the vessel that created the camera in Orbiter 2016 without a problem.

Abdullah,
I can't appreciate the subtleties of coding but from my perspective, the problem you've outlined developing Camera MFD 2010 may not be an issue. In our add-ons, Gattispilot and I have used Camera MFD to allow the flight crew to "see" outside the cockpit during proximity maneuvers (VTOL approach to landing, docking approach) when the ship's structure obstructs the view from the cockpit. Not seeing the craft that originates the camera point of view isn't an issue as long as it shows whatever vessel or structure it's pointed at.
 
This might be a bit out of the left field but, is there anyway to generate 3D exhausts from the existing 2D textures? I really think that would add to the immersion, instead of being flat 2D images.
 

Attachments

  • 1602278919649.png
    1602278919649.png
    1.3 MB · Views: 25
This might be a bit out of the left field but, is there anyway to generate 3D exhausts from the existing 2D textures? I really think that would add to the immersion, instead of being flat 2D images.
That would be very nice. The logical extension of this will be rendered engine exhaust heat, smoke and flames. I guess it could be done in D3D9, more work for Jarmonik.
 
I would like to have some local light shadows...
 
Let me ask about 2010 d3d9. it seems the HUD doesn't display the info. Is there a setting?
ura4638.jpg

GLzgS2H.jpg
 
What is weird. Is a lot of vessels the HUD messages work. But the Moon Base Alpha stuff it doesn't. Also some keys don't work,.... . They all didn't work then I would say D3D9 was the issue. But I have some that work. No clue
 
Back
Top