[Scummvm-git-logs] scummvm master -> 136886c4fe810d506f9c7ecd7ed13008336bba23
neuromancer
noreply at scummvm.org
Tue Dec 10 21:14:02 UTC 2024
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
136886c4fe FREESCAPE: improved sensor rendering
Commit: 136886c4fe810d506f9c7ecd7ed13008336bba23
https://github.com/scummvm/scummvm/commit/136886c4fe810d506f9c7ecd7ed13008336bba23
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-12-10T22:14:48+01:00
Commit Message:
FREESCAPE: improved sensor rendering
Changed paths:
engines/freescape/area.cpp
engines/freescape/gfx_tinygl.cpp
engines/freescape/objects/sensor.cpp
engines/freescape/objects/sensor.h
diff --git a/engines/freescape/area.cpp b/engines/freescape/area.cpp
index 039bac55de9..ba5c4071ac8 100644
--- a/engines/freescape/area.cpp
+++ b/engines/freescape/area.cpp
@@ -255,7 +255,7 @@ void Area::draw(Freescape::Renderer *gfx, uint32 animationTicks, Math::Vector3d
continue;
}
- if (obj->isPlanar() && (obj->getType() != ObjectType::kSensorType))
+ if (obj->isPlanar())
planarObjects.push_back(obj);
else
nonPlanarObjects.push_back(obj);
diff --git a/engines/freescape/gfx_tinygl.cpp b/engines/freescape/gfx_tinygl.cpp
index 8f1c7ada75e..bf224e7d76e 100644
--- a/engines/freescape/gfx_tinygl.cpp
+++ b/engines/freescape/gfx_tinygl.cpp
@@ -171,6 +171,8 @@ void TinyGLRenderer::positionCamera(const Math::Vector3d &pos, const Math::Vecto
}
void TinyGLRenderer::renderSensorShoot(byte color, const Math::Vector3d sensor, const Math::Vector3d player, const Common::Rect viewArea) {
+ tglEnable(TGL_BLEND);
+ tglBlendFunc(TGL_ONE_MINUS_DST_COLOR, TGL_ZERO);
tglColor3ub(255, 255, 255);
polygonOffset(true);
tglEnableClientState(TGL_VERTEX_ARRAY);
@@ -180,6 +182,7 @@ void TinyGLRenderer::renderSensorShoot(byte color, const Math::Vector3d sensor,
tglDrawArrays(TGL_LINES, 0, 2);
tglDisableClientState(TGL_VERTEX_ARRAY);
polygonOffset(false);
+ tglDisable(TGL_BLEND);
}
void TinyGLRenderer::renderPlayerShootBall(byte color, const Common::Point position, int frame, const Common::Rect viewArea) {
diff --git a/engines/freescape/objects/sensor.cpp b/engines/freescape/objects/sensor.cpp
index 69fb9f84aca..1a54e548b0f 100644
--- a/engines/freescape/objects/sensor.cpp
+++ b/engines/freescape/objects/sensor.cpp
@@ -37,7 +37,15 @@ Sensor::Sensor(
_objectID = objectID_;
_origin = origin_;
_rotation = rotation_;
- _size = Math::Vector3d(3, 3, 3);
+
+ if (axis_ == 0x01 || axis_ == 0x02)
+ _size = Math::Vector3d(0, 3, 3);
+ else if (axis_ == 0x04 || axis_ == 0x08)
+ _size = Math::Vector3d(3, 0, 3);
+ else if (axis_ == 0x10 || axis_ == 0x20)
+ _size = Math::Vector3d(3, 3, 0);
+ else
+ error("Invalid axis %x", axis_);
_colours = new Common::Array<uint8>;
for (int i = 0; i < 6; i++)
_colours->push_back(color_);
@@ -56,14 +64,18 @@ Sensor::Sensor(
_isShooting = false;
}
+void Sensor::scale(int factor) {
+ _origin = _origin / factor;
+ _size = _size / factor;
+};
+
Object *Sensor::duplicate() {
Sensor *sensor = new Sensor(_objectID, _origin, _rotation, (*_colours)[0], _firingInterval, _firingRange, _axis, _flags, _condition, _conditionSource);
return sensor;
}
void Sensor::draw(Freescape::Renderer *gfx, float offset) {
- Math::Vector3d origin(_origin.x() - 1, _origin.y() - 1, _origin.z() - 1);
- gfx->renderCube(_origin, _size, _colours, nullptr);
+ gfx->renderCube(_origin, _size, _colours, nullptr, offset);
}
bool Sensor::playerDetected(const Math::Vector3d &position, Area *area) {
diff --git a/engines/freescape/objects/sensor.h b/engines/freescape/objects/sensor.h
index bb8ff22de3c..933a3e232ed 100644
--- a/engines/freescape/objects/sensor.h
+++ b/engines/freescape/objects/sensor.h
@@ -57,7 +57,7 @@ public:
bool isDrawable() override { return true; }
bool isPlanar() override { return true; }
bool isShooting() { return _isShooting; }
- void scale(int factor) override { _origin = _origin / factor; };
+ void scale(int factor) override;
Object *duplicate() override;
ObjectType getType() override { return kSensorType; };
More information about the Scummvm-git-logs
mailing list