mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-27 21:54:15 +00:00
MYST3: Draw a rect where the movies should be in the scene
This commit is contained in:
parent
ba20bb15e5
commit
9fde449c9e
@ -18,9 +18,6 @@
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*
|
||||
* $URL$
|
||||
* $Id$
|
||||
*
|
||||
*/
|
||||
|
||||
#include "engines/advancedDetector.h"
|
||||
|
@ -33,7 +33,7 @@ void DirectorySubEntry::readFromStream(Common::SeekableReadStream &inStream) {
|
||||
_size = inStream.readUint32LE();
|
||||
_metadataSize = inStream.readUint16LE();
|
||||
_face = inStream.readByte();
|
||||
_type = inStream.readByte();
|
||||
_type = static_cast<ResourceType>(inStream.readByte());
|
||||
|
||||
if (_metadataSize == 0) return;
|
||||
|
||||
@ -67,14 +67,14 @@ void DirectorySubEntry::dumpToFile(Common::SeekableReadStream &inStream, uint16
|
||||
char fileName[255];
|
||||
|
||||
switch (_type) {
|
||||
case 0:
|
||||
case 5:
|
||||
case kCubeFace:
|
||||
case kSpotItem:
|
||||
sprintf(fileName, "dump/%d-%d.jpg", index, _face);
|
||||
break;
|
||||
case 1:
|
||||
case kFaceMask:
|
||||
sprintf(fileName, "dump/%d-%d.mask", index, _face);
|
||||
break;
|
||||
case 8:
|
||||
case kMovie:
|
||||
sprintf(fileName, "dump/%d.bik", index);
|
||||
break;
|
||||
default:
|
||||
|
@ -33,24 +33,13 @@ struct SpotItemData {
|
||||
struct VideoData {
|
||||
Graphics::Vector3d v1;
|
||||
Graphics::Vector3d v2;
|
||||
uint32 u;
|
||||
uint32 v;
|
||||
uint32 width;
|
||||
uint32 height;
|
||||
int32 u;
|
||||
int32 v;
|
||||
int32 width;
|
||||
int32 height;
|
||||
};
|
||||
|
||||
class DirectorySubEntry {
|
||||
private:
|
||||
uint32 _offset;
|
||||
uint32 _size;
|
||||
uint16 _metadataSize;
|
||||
byte _face;
|
||||
byte _type;
|
||||
|
||||
// Metadata
|
||||
SpotItemData _spotItemData;
|
||||
VideoData _videoData;
|
||||
|
||||
public:
|
||||
enum ResourceType {
|
||||
kCubeFace = 0,
|
||||
@ -65,9 +54,20 @@ class DirectorySubEntry {
|
||||
void dumpToFile(Common::SeekableReadStream &inStream, uint16 index);
|
||||
Common::MemoryReadStream *dumpToMemory(Common::SeekableReadStream &inStream) const;
|
||||
uint16 getFace() { return _face; }
|
||||
ResourceType getType() { return static_cast<ResourceType>(_type); }
|
||||
const SpotItemData &getSpotItemData() { return _spotItemData; }
|
||||
const VideoData &getVideoData() { return _videoData; }
|
||||
ResourceType getType() { return _type; }
|
||||
const SpotItemData &getSpotItemData() const { return _spotItemData; }
|
||||
const VideoData &getVideoData() const { return _videoData; }
|
||||
|
||||
private:
|
||||
uint32 _offset;
|
||||
uint32 _size;
|
||||
uint16 _metadataSize;
|
||||
byte _face;
|
||||
ResourceType _type;
|
||||
|
||||
// Metadata
|
||||
SpotItemData _spotItemData;
|
||||
VideoData _videoData;
|
||||
};
|
||||
|
||||
} // end of namespace Myst3
|
||||
|
@ -45,8 +45,57 @@ void NodeCube::load(Archive &archive, uint16 index) {
|
||||
delete jpegStream;
|
||||
}
|
||||
}
|
||||
|
||||
// HACK: To load some of the movies of a frame
|
||||
loadMovie(archive, index + 10000);
|
||||
loadMovie(archive, index + 11000);
|
||||
loadMovie(archive, index + 20000);
|
||||
}
|
||||
|
||||
void NodeCube::loadMovie(Archive &archive, uint16 id) {
|
||||
static const float scale = 50.0f;
|
||||
|
||||
const DirectorySubEntry *binkDesc = archive.getDescription(id, 0, DirectorySubEntry::kMovie);
|
||||
|
||||
if (!binkDesc)
|
||||
return;
|
||||
|
||||
Common::MemoryReadStream *binkStream = archive.getData(binkDesc);
|
||||
const VideoData &videoData = binkDesc->getVideoData();
|
||||
|
||||
Graphics::Vector3d planeDirection = videoData.v1;
|
||||
planeDirection.normalize();
|
||||
|
||||
Graphics::Vector3d u;
|
||||
u.set(planeDirection.z(), 0.0f, -planeDirection.x());
|
||||
u.normalize();
|
||||
|
||||
Graphics::Vector3d v = Graphics::cross(planeDirection, u);
|
||||
v.normalize();
|
||||
|
||||
Graphics::Vector3d planeOrigin = planeDirection * scale;
|
||||
|
||||
float left = (videoData.u - 320) * 0.003125f;
|
||||
float right = (videoData.u + videoData.width - 320) * 0.003125f;
|
||||
float top = (320 - videoData.v) * 0.003125f;
|
||||
float bottom = (320 - videoData.v - videoData.height) * 0.003125f;
|
||||
|
||||
Graphics::Vector3d vLeft = scale * left * u;
|
||||
Graphics::Vector3d vRight = scale * right * u;
|
||||
Graphics::Vector3d vTop = scale * top * v;
|
||||
Graphics::Vector3d vBottom = scale * bottom * v;
|
||||
|
||||
Movie movie;
|
||||
|
||||
movie.pTopLeft = planeOrigin + vTop + vLeft;
|
||||
movie.pBottomLeft = planeOrigin + vBottom + vLeft;
|
||||
movie.pBottomRight = planeOrigin + vBottom + vRight;
|
||||
movie.pTopRight = planeOrigin + vTop + vRight;
|
||||
|
||||
_movies.push_back(movie);
|
||||
|
||||
delete binkStream;
|
||||
}
|
||||
|
||||
void NodeCube::draw() {
|
||||
// Size of the cube
|
||||
@ -106,6 +155,23 @@ void NodeCube::draw() {
|
||||
glEnd();
|
||||
|
||||
glDepthMask(GL_TRUE);
|
||||
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glEnable(GL_BLEND);
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
|
||||
for (uint i = 0; i < _movies.size(); i++) {
|
||||
glBegin(GL_POLYGON);
|
||||
glColor4f(0.0f, 0.5f, 0.0f, 0.2f);
|
||||
glVertex3f(-_movies[i].pTopLeft.x(), _movies[i].pTopLeft.y(), _movies[i].pTopLeft.z());
|
||||
glVertex3f(-_movies[i].pBottomLeft.x(), _movies[i].pBottomLeft.y(), _movies[i].pBottomLeft.z());
|
||||
glVertex3f(-_movies[i].pBottomRight.x(), _movies[i].pBottomRight.y(), _movies[i].pBottomRight.z());
|
||||
glVertex3f(-_movies[i].pTopRight.x(), _movies[i].pTopRight.y(), _movies[i].pTopRight.z());
|
||||
glEnd();
|
||||
}
|
||||
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glDisable(GL_BLEND);
|
||||
}
|
||||
|
||||
} /* namespace Myst3 */
|
||||
|
@ -27,6 +27,13 @@
|
||||
|
||||
namespace Myst3 {
|
||||
|
||||
struct Movie {
|
||||
Graphics::Vector3d pTopLeft;
|
||||
Graphics::Vector3d pBottomLeft;
|
||||
Graphics::Vector3d pBottomRight;
|
||||
Graphics::Vector3d pTopRight;
|
||||
};
|
||||
|
||||
class NodeCube: public Myst3::Node {
|
||||
public:
|
||||
NodeCube();
|
||||
@ -34,6 +41,11 @@ public:
|
||||
|
||||
void load(Archive &archive, uint16 id);
|
||||
void draw();
|
||||
|
||||
void loadMovie(Archive &archive, uint16 id);
|
||||
|
||||
private:
|
||||
Common::Array<Movie> _movies;
|
||||
};
|
||||
|
||||
} /* namespace Myst3 */
|
||||
|
@ -36,7 +36,7 @@ void Scene::init(int width, int height) {
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
|
||||
|
||||
glDisable(GL_LIGHTING);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
|
@ -18,9 +18,6 @@
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*
|
||||
* $URL$
|
||||
* $Id$
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MYST3_SCENE_H
|
||||
|
Loading…
x
Reference in New Issue
Block a user