Here is a new issue. The mfd brightness. The code from the Atlantis uses x direction movement. But the mfd on the side behind the wall needs Z movement.
So I redid the code using the z difference. I do hit it but the mfd goes dim instantly. AND no getting it bright
button push area
oapiVCSetAreaClickmode_Quadrilateral(AID_MFDA_BRT, _V(1.3817, 2.2164, 13.489), _V(1.3809, 2.2164, 13.463), _V(1.3634, 2.2148, 13.489), _V(1.3634, 2.2118, 13.461));
// handle MFD brightness buttons
case AID_CDR1_BRT:
case AID_PLT1_BRT:
case AID_MFD1_BRT:
//case AID_MFDA_BRT:
//case AID_MFDA_BRT:
{
static double t0, brt0;
static bool up;
int mfd = id - AID_CDR1_BRT;
if (event & PANEL_MOUSE_LBDOWN) {
up = (p.x >= 0.5);
t0 = oapiGetSysTime();
brt0 = mfdbright[mfd];
}
else if (event & PANEL_MOUSE_LBPRESSED) {
double dt = oapiGetSysTime() - t0;
double brt, dbrt = dt * 0.2;
if (up) brt = min(1.0, brt0 + dbrt);
else brt = max(0.25, brt0 - dbrt);
mfdbright[mfd] = brt;
if (vis) {
MATERIAL mat;
memset(&mat, 0, sizeof(MATERIAL));
mat.emissive.r = mat.emissive.g = mat.emissive.b = (float)brt;
mat.emissive.a = 1.0f;
DEVMESHHANDLE hMesh = GetDevMesh(vis, mesh_vc);
oapiSetMaterial(hMesh, 20 + mfd, &mat);
}
}
} return true;
case AID_MFDA_BRT:
//case AID_MFDA_BRT:
{
static double t0, brt0;
static bool up;
int mfd = 16;
if (event & PANEL_MOUSE_LBDOWN) {
up = (p.z >= 0.5);
t0 = oapiGetSysTime();
brt0 = mfdbright[mfd];
sprintf(oapiDebugString(), "Z: %2.5f ", p.z);
}
else if (event & PANEL_MOUSE_LBPRESSED) {
double dt = oapiGetSysTime() - t0;
double brt, dbrt = dt * 0.2;
if (up) brt = min(1.0, brt0 + dbrt);
else brt = max(0.25, brt0 - dbrt);
mfdbright[mfd] = brt;
if (vis) {
MATERIAL mat;
memset(&mat, 0, sizeof(MATERIAL));
mat.emissive.r = mat.emissive.g = mat.emissive.b = (float)brt;
mat.emissive.a = 1.0f;
DEVMESHHANDLE hMesh = GetDevMesh(vis, mesh_vc);
oapiSetMaterial(hMesh, 26, &mat);
}
}
} return true;
The p.z value is also 0.00000. I put that code debug line in the other and the x value changes