Skip to content

Commit

Permalink
Add the ability to query DCM capability from Python.
Browse files Browse the repository at this point in the history
Myst V didn't have this function either. That's interesting because, in
theory, we may be presented with a video card that doesn't support the
Direct3D caps needed to perform the effect. At this stage in the game,
everyone should support DCMs, so this is just an exercise in technical
correctness.
  • Loading branch information
Hoikas committed Mar 2, 2024
1 parent 6869cd2 commit 3e60bce
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Scripts/Python/plasma/Plasma.py
Original file line number Diff line number Diff line change
Expand Up @@ -827,6 +827,10 @@ def PtStartScreenCapture(selfKey,width=800,height=600):
"""Starts a capture of the screen"""
pass

def PtSupportsPlanarReflections() -> bool:
"""Returns if planar reflections are supported"""
...

def PtToggleAvatarClickability(on):
"""Turns on and off our avatar's clickability"""
pass
Expand Down
5 changes: 5 additions & 0 deletions Sources/Plasma/FeatureLib/pfPython/cyMisc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2541,6 +2541,11 @@ void cyMisc::EnablePlanarReflections(bool enable)
plDynamicCamMap::SetEnabled(enable);
}

bool cyMisc::ArePlanarReflectionsSupported()
{
return plDynamicCamMap::GetCapable();
}

void cyMisc::GetSupportedDisplayModes(std::vector<plDisplayMode> *res)
{
fPipeline->GetSupportedDisplayModes(res);
Expand Down
1 change: 1 addition & 0 deletions Sources/Plasma/FeatureLib/pfPython/cyMisc.h
Original file line number Diff line number Diff line change
Expand Up @@ -898,6 +898,7 @@ class cyMisc
static ST::string GetLocalizedString(const ST::string& name, const std::vector<ST::string> & arguments);

static void EnablePlanarReflections(bool enable = true);
static bool ArePlanarReflectionsSupported();
static void SetGraphicsOptions(int Width, int Height, int ColorDepth, bool Windowed, int NumAASamples, int MaxAnisotropicSamples, bool VSync);
static void GetSupportedDisplayModes(std::vector<plDisplayMode> *res);
static int GetDesktopWidth();
Expand Down
6 changes: 6 additions & 0 deletions Sources/Plasma/FeatureLib/pfPython/cyMiscGlue4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,11 @@ PYTHON_GLOBAL_METHOD_DEFINITION(PtEnablePlanarReflections, args, "Params: on\nEn
PYTHON_RETURN_NONE;
}

PYTHON_GLOBAL_METHOD_DEFINITION_NOARGS(PtSupportsPlanarReflections, "Returns if planar reflections are supported")
{
return PyBool_FromLong(cyMisc::ArePlanarReflectionsSupported() ? 1 : 0);
}

PYTHON_GLOBAL_METHOD_DEFINITION_NOARGS(PtGetSupportedDisplayModes, "Returns a list of supported resolutions")
{
std::vector<plDisplayMode> res;
Expand Down Expand Up @@ -818,6 +823,7 @@ void cyMisc::AddPlasmaMethods4(PyObject* m)
PYTHON_GLOBAL_METHOD_NOARGS(PtCheckVisLOSFromCursor)

PYTHON_GLOBAL_METHOD(PtEnablePlanarReflections)
PYTHON_GLOBAL_METHOD_NOARGS(PtSupportsPlanarReflections)
PYTHON_GLOBAL_METHOD_NOARGS(PtGetSupportedDisplayModes)
PYTHON_GLOBAL_METHOD_NOARGS(PtGetDesktopWidth)
PYTHON_GLOBAL_METHOD_NOARGS(PtGetDesktopHeight)
Expand Down

0 comments on commit 3e60bce

Please sign in to comment.