A canvas for a reimplementation of the memorable 3DMov demo, this time using OpenGL and the Media Kit.

Stippi, an HVIF icon please ;)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22899 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
François Revol 2007-11-11 14:56:22 +00:00
parent a878b1d91c
commit 98f16eeec8
13 changed files with 690 additions and 0 deletions

93
src/apps/3dmov/3dmov.rdef Normal file
View File

@ -0,0 +1,93 @@
/*
** /Data/haiku/trunk/src/apps/3dmov/3dmov.rdef
**
** Automatically generated by BResourceParser on
** Tuesday, May 08, 2007 at 16:24:02.
**
*/
resource(1, "BEOS:APP_FLAGS") (#'APPF') $"00000000";
resource(1, "BEOS:APP_VERSION") #'APPV' array {
$"0000000000000000000000000000000000000000000000000000000000000000"
$"0000000000000000000000000000000000000000000000000000000000000000"
$"0000000000000000000000000000000000000000000000000000000000000000"
$"0000000000000000000000000000000000000000000000000000000000000000"
$"0000000000000000000000000000000000000000000000000000000000000000"
$"0000000000000000000000000000000000000000000000000000000000000000"
$"0000000000000000000000000000000000000000000000000000000000000000"
$"0000000000000000000000000000000000000000000000000000000000000000"
$"0000000000000000000000000000000000000000000000000000000000000000"
$"0000000000000000000000000000000000000000000000000000000000000000"
$"000000000000000000000000000000000000000080031200FC105760EC111000"
$"EC088BC800000000FC1057808003220080052980800294408000600380032200"
$"8005298000000002FC1057C0FC105A7C000000018003E7800000000280032200"
$"800529808002944080006003EC02ECB88005298000000000FC1057D0EC111000"
$"EC01BE200000000200000000FC105A7C000000018003E7800000000280006003"
$"000000028001DEE88001DEF8EC02ECB88004B38000000000FC1058108003E780"
$"EC01BE20EC02ECB8FC105810EC111000EC01BE7C00000001FC10582000000000"
$"EC02ECBCFFFFFFFFEC05B434FC1058B88005298080029440FC10585080019244"
$"FC1059B8EC02ECB8FC105850EC111000EC01BE7C8002A680FC105870EC111000"
$"80052980FFFFFFFFEC05B434FC10593800000004000201DC800060038003E780"
$"8005298000000000FC105890420C0000EC019C080000010043300000EC111000"
$"8004B38000000000"
};
resource(101, "BEOS:L:STD_ICON") #'ICON' array {
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00FFFFFFFFFFFFFFFFFF"
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF005D00FFFFFFFFFFFFFFFF"
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF005D5D00FFFFFFFFFFFFFFFF"
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF005D5D5D00FFFFFFFFFFFFFFFF"
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF003F5D5D5D5D00FFFFFFFFFFFFFF"
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF003F5D5D5D5D00FFFFFFFFFFFFFF"
$"FFFFFFFF000000FFFFFFFFFFFFFFFFFFFF00FA3F5D5D5D5D5D00FFFFFFFFFFFF"
$"FFFFFF005E5E5E0000FFFFFFFFFFFFFFFF00FA3F5D5D5D5D5D00FFFFFFFFFFFF"
$"FFFF005E5E5E5E5E5E0000FFFFFFFFFF00FAFA3F5D5D5D5D5D00FFFFFFFFFFFF"
$"FF005E5E5E5E5E5E5E5E5E00FFFFFFFF00FAFAFA3F5D5D5D5D5D00FFFFFFFFFF"
$"005E5E5E5E5E5E5E5E5EB200FFFFFF00FAFAFAFA3F5D5D5D5D5D00FFFFFFFFFF"
$"00B2B25E5E5E5E5E5EB22100FFFF00FAFAFAFAFA3F5D5D5D5D5D5D00FFFFFFFF"
$"002121B2B25E5E5EB2212400FFFF00FAFAFAFAFAFA3F5D5D5D5D5D00FFFFFFFF"
$"0021212021B2B2B221242500FF00FAFAFAFAFAFAFA3F5D5D5D5D5D5D00FFFFFF"
$"002121202121BE2124252500FF00FAFAFAFAFAFAFAFA3F5D5D5D5D5D00FFFFFF"
$"002121202121BE212425250000FAFAFAFAFAFAFAFAFA3F5D5D5D5D5D00FFFFFF"
$"002121202121BE212425250000FAFAFAFAFAFAFAFAFA3F5D5D5D5D5D5D00FFFF"
$"002121202121BE2124252500FF0000FAFAFA00000000003F5D5D5D5D5D0011FF"
$"002121202121BE2124252500FFFFFF0000002FEB2F302F00005D5D5D5D001111"
$"002121202121BE2124252500FFFFFF002F2B2B2B2D2D2F302F005D5D00111111"
$"002121202121BE2124252500FFFF002F2B2A2B2A2C2C2BEB2F2F0000111111FF"
$"002121202121BE2124252500FFFF002B2B2B2A2B2B2B2D2D2F2F00111111FFFF"
$"002121202121BE2124252500FF002F2B2B2A5A2B2B2B2C2D2DEB3000FFFFFFFF"
$"002121202121BE212425250011002F2B2B5A3F5A2B2C2C2D2D2F2F00FFFFFFFF"
$"002121202121BE212425250011002F2C2C2A5A2C2B2C2C2DEB2F2F00FFFFFFFF"
$"002121202121BE21242500111100302E2B2C2B2B2C2C2D2CEB2F2F0011FFFFFF"
$"FF0000212120BE2124001111FF002F2F2D2C2C2C2C2D2D2E2EEB30001111FFFF"
$"FFFFFF000021BE21001111FFFFFF00302D2D2D2C2D2DEBEB2F2F00111111FFFF"
$"FFFFFFFFFF0000001111FFFFFFFF00302EEBEBEBEBEBEB2FEB3000111111FFFF"
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00302F2FEB2FEB2F2F2F0011111111FFFF"
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000302F2F302F000011111111FFFFFF"
$"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000011111111FFFFFFFFFF"
};
resource(101, "BEOS:M:STD_ICON") #'MICN' array {
$"FFFFFFFFFFFFFFFFFFFFFF0000FFFFFF"
$"FFFFFFFFFFFFFFFFFFFF005D5D00FFFF"
$"FFFF000000FFFFFFFF005D5D5D00FFFF"
$"FF005E5E5E00FFFF00FA5D5D5D00FFFF"
$"005E5E5E5E5E00FF00FAFA5D5D5D00FF"
$"00215E5E5E250000FAFAFA5D5D5D00FF"
$"0021212025250000FAFAFA5D5D5D5D00"
$"00202121242500FAFAFAFAFA5D5D5D00"
$"00212021252400FAFA000000005D5D00"
$"00212120252500FA002B2D2F30000000"
$"00202121242500002B2B2B2D2D2F0011"
$"00212021252400002B5A2C2C2D2F00FF"
$"00212120250000002D2B2B2D2D2F0011"
$"00002120001111002F2E2C2E2E2F0011"
$"FFFF00001111FFFF0030EB2F2F001111"
$"FFFFFFFFFFFFFFFFFF00000000111111"
};
resource(1, "BEOS:APP_SIG") (#'MIMS') "application/x-vnd.Haiku-3DMov";
resource(1, "BEOS:FILE_TYPES") message { };

View File

@ -0,0 +1,35 @@
/*
-----------------------------------------------------------------------------
File: CubeView.cpp
Date: 10/20/2004
Description: 3DMov reloaded...
Author: François Revol.
Copyright 2004, yellowTAB GmbH, All rights reserved.
-----------------------------------------------------------------------------
*/
#include <opengl/GL/gl.h>
#include <opengl/GL/glu.h>
#include "CubeView.h"
CubeView::CubeView(BRect frame)
: GLMovView(frame)
{
}
CubeView::~CubeView()
{
}
void CubeView::AttachedToWindow()
{
}

32
src/apps/3dmov/CubeView.h Normal file
View File

@ -0,0 +1,32 @@
/*
-----------------------------------------------------------------------------
File: CubeView.h
Date: 10/20/2004
Description: 3DMov reloaded...
Author: François Revol.
Copyright 2004, yellowTAB GmbH, All rights reserved.
-----------------------------------------------------------------------------
*/
#ifndef _CUBEVIEW_H
#define _CUBEVIEW_H
#include "GLMovView.h"
class CubeView: public GLMovView
{
public:
CubeView(BRect frame);
~CubeView();
virtual void AttachedToWindow();
};
#endif /* _CUBEVIEW_H */

View File

@ -0,0 +1,54 @@
/*
-----------------------------------------------------------------------------
File: GLMovApp.cpp
Date: 10/20/2004
Description: 3DMov reloaded...
Author: François Revol.
Copyright 2004, yellowTAB GmbH, All rights reserved.
-----------------------------------------------------------------------------
*/
#include <Alert.h>
#include "GLMovApp.h"
#include "GLMovStrings.h"
#include "GLMovWindow.h"
GLMovApp::GLMovApp()
: BApplication("application/x-vnd.Be-3DM2")
{
}
GLMovApp::~GLMovApp()
{
}
void GLMovApp::ReadyToRun()
{
GLMovWindow *win = GLMovWindow::MakeWindow(OBJ_CUBE);
}
void GLMovApp::AboutRequested()
{
BAlert *alert;
alert = new BAlert("about", STR_ABOUT_TEXT, STR_OK);
alert->Go(NULL);
}
void GLMovApp::MessageReceived(BMessage *message)
{
}
int main(int argc, char **argv)
{
GLMovApp app;
app.Run();
return 0;
}

34
src/apps/3dmov/GLMovApp.h Normal file
View File

@ -0,0 +1,34 @@
/*
-----------------------------------------------------------------------------
File: GLMovApp.h
Date: 10/20/2004
Description: 3DMov reloaded...
Author: François Revol.
Copyright 2004, yellowTAB GmbH, All rights reserved.
-----------------------------------------------------------------------------
*/
#ifndef _GLMOVAPP_H
#define _GLMOVAPP_H
#include <Application.h>
class GLMovApp: public BApplication
{
public:
GLMovApp();
~GLMovApp();
virtual void ReadyToRun();
virtual void AboutRequested();
virtual void MessageReceived(BMessage *message);
};
#endif /* _GLMOVAPP_H */

View File

@ -0,0 +1,27 @@
/*
-----------------------------------------------------------------------------
File: GLMovStrings.h
Date: 10/20/2004
Description: 3DMov reloaded...
Author: François Revol.
Copyright 2004, yellowTAB GmbH, All rights reserved.
-----------------------------------------------------------------------------
*/
#ifndef _GLMOVMESSAGES_H
#define _GLMOVMESSAGES_H
#define MSG_OBJ1 'Obj1'
#define MSG_OBJ2 'Obj2'
#define MSG_OBJ3 'Obj3'
#define MSG_OBJ4 'Obj4'
#define MSG_PAUSE 'Paus'
#endif /* _GLMOVMESSAGES_H */

View File

@ -0,0 +1,36 @@
/*
-----------------------------------------------------------------------------
File: GLMovStrings.h
Date: 10/20/2004
Description: 3DMov reloaded...
Author: François Revol.
Copyright 2004, yellowTAB GmbH, All rights reserved.
-----------------------------------------------------------------------------
*/
#ifndef _GLMOVSTRINGS_H
#define _GLMOVSTRINGS_H
#define STR_ABOUT_TEXT "3DMov reloaded.\n\n Demonstrates OpenGL and the Media Kit."
#define STR_OK "Ok"
#define STR_MENU "File" //not really related.... "Object" ?
#define STR_CUBE "Cube"
#define STR_SPHERE "Sphere"
#define STR_PULSE "Pulse"
#define STR_BOOK "Book"
#define STR_PAUSE "Pause"
#define STR_CLOSE "Close"
#define STR_ABOUT "About 3dMov"
#define STR_QUIT "Quit"
#endif /* _GLMOVSTRINGS_H */

View File

@ -0,0 +1,35 @@
/*
-----------------------------------------------------------------------------
File: GLMovView.cpp
Date: 10/20/2004
Description: 3DMov reloaded...
Author: François Revol.
Copyright 2004, yellowTAB GmbH, All rights reserved.
-----------------------------------------------------------------------------
*/
#include <opengl/GL/gl.h>
#include <opengl/GL/glu.h>
#include "GLMovView.h"
GLMovView::GLMovView(BRect frame)
: BGLView(frame, "glview", B_FOLLOW_ALL, B_WILL_DRAW, BGL_RGB|BGL_DOUBLE)
{
}
GLMovView::~GLMovView()
{
}
void GLMovView::AttachedToWindow()
{
}

View File

@ -0,0 +1,40 @@
/*
-----------------------------------------------------------------------------
File: GLMovView.h
Date: 10/20/2004
Description: 3DMov reloaded...
Author: François Revol.
Copyright 2004, yellowTAB GmbH, All rights reserved.
-----------------------------------------------------------------------------
*/
#ifndef _GLMOVVIEW_H
#define _GLMOVVIEW_H
#include <GLView.h>
#include <MediaFile.h>
class GLMovView: public BGLView
{
public:
GLMovView(BRect frame);
~GLMovView();
virtual void AttachedToWindow();
// for mouse control
virtual void MouseDown(BPoint where);
virtual void MouseUp(BPoint where);
virtual void MouseMoved(BPoint where, uint32 code, const BMessage *a_message);
//
virtual void FileDropped(BPoint where, BMediaFile *file);
};
#endif /* _GLMOVVIEW_H */

View File

@ -0,0 +1,126 @@
/*
-----------------------------------------------------------------------------
File: GLMovWindow.cpp
Date: 10/20/2004
Description: 3DMov reloaded...
Author: François Revol.
Copyright 2004, yellowTAB GmbH, All rights reserved.
-----------------------------------------------------------------------------
*/
#include <Application.h>
#include <MenuBar.h>
#include <MenuItem.h>
#include "GLMovStrings.h"
#include "GLMovMessages.h"
#include "GLMovWindow.h"
#include "GLMovView.h"
#include "CubeView.h"
#include <stdio.h>
GLMovWindow::GLMovWindow(GLMovView *view, BRect frame, const char *title)
: BDirectWindow(frame, title, B_TITLED_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL, 0)
{
fGLView = view;
}
GLMovWindow::~GLMovWindow()
{
}
bool GLMovWindow::QuitRequested()
{
be_app->Lock();
if (be_app->CountWindows() < 2)
be_app_messenger.SendMessage(B_QUIT_REQUESTED);
be_app->Unlock();
return true;
}
void GLMovWindow::MessageReceived(BMessage *message)
{
switch (message->what) {
case MSG_OBJ1:
case MSG_OBJ2:
case MSG_OBJ3:
case MSG_OBJ4:
MakeWindow((object_type)(OBJ_CUBE + message->what - MSG_OBJ1));
break;
case 'Paus':
break;
default:
BDirectWindow::MessageReceived(message);
}
}
void GLMovWindow::DirectConnected(direct_buffer_info *info)
{
fGLView->DirectConnected(info);
}
GLMovWindow *GLMovWindow::MakeWindow(object_type obj)
{
GLMovWindow *win;
GLMovView *view;
BMenuBar *bar;
BMenu *menu;
BMenuItem *menuItem;
BRect frame(0, 0, 400-1, 400-1);
const char *title = "3dMov";
bar = new BMenuBar(frame, "menu", B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP, B_ITEMS_IN_ROW, true);
menu = new BMenu(STR_MENU);
menu->AddItem(new BMenuItem(STR_CUBE, new BMessage(MSG_OBJ1), '1'));
menu->AddItem(new BMenuItem(STR_SPHERE, new BMessage(MSG_OBJ2), '2'));
menu->AddItem(new BMenuItem(STR_PULSE, new BMessage(MSG_OBJ3), '3'));
menu->AddItem(new BMenuItem(STR_BOOK, new BMessage(MSG_OBJ4), '4'));
menu->AddItem(new BSeparatorItem);
menu->AddItem((menuItem = new BMenuItem(STR_PAUSE, new BMessage(MSG_PAUSE), 'P')));
menuItem->SetTarget(be_app_messenger);
menu->AddItem(new BMenuItem(STR_CLOSE, new BMessage(B_QUIT_REQUESTED), 'W'));
menu->AddItem(new BSeparatorItem);
menu->AddItem((menuItem = new BMenuItem(STR_ABOUT, new BMessage(B_ABOUT_REQUESTED))));
menuItem->SetTarget(be_app_messenger);
menu->AddItem((menuItem = new BMenuItem(STR_QUIT, new BMessage(B_QUIT_REQUESTED), 'Q')));
menuItem->SetTarget(be_app_messenger);
bar->AddItem(new BMenuItem(menu));
bar->ResizeToPreferred();
switch (obj) {
case OBJ_CUBE:
default:
view = new CubeView(frame.OffsetByCopy(0, bar->Bounds().Height()+1));
title = STR_CUBE;
break;
case OBJ_SPHERE:
view = new GLMovView(frame.OffsetByCopy(0, bar->Bounds().Height()+1));
title = STR_SPHERE;
break;
case OBJ_PULSE:
view = new GLMovView(frame.OffsetByCopy(0, bar->Bounds().Height()+1));
title = STR_PULSE;
break;
case OBJ_BOOK:
frame = BRect(0, 0, 600-1, 400-1);
view = new GLMovView(frame.OffsetByCopy(0, bar->Bounds().Height()+1));
title = STR_BOOK;
break;
}
view->SetViewColor(0,0,0);
frame.bottom += bar->Bounds().Height()+1;
frame.OffsetBySelf(50,50);
win = new GLMovWindow(view, frame, title);
win->AddChild(bar);
win->AddChild(view);
win->Show();
return win;
}

View File

@ -0,0 +1,46 @@
/*
-----------------------------------------------------------------------------
File: GLMovWindow.h
Date: 10/20/2004
Description: 3DMov reloaded...
Author: François Revol.
Copyright 2004, yellowTAB GmbH, All rights reserved.
-----------------------------------------------------------------------------
*/
#ifndef _GLMOVWINDOW_H
#define _GLMOVWINDOW_H
#include <DirectWindow.h>
class GLMovView;
enum object_type {
OBJ_CUBE,
OBJ_SPHERE,
OBJ_PULSE,
OBJ_BOOK,
};
class GLMovWindow: public BDirectWindow
{
public:
GLMovWindow(GLMovView *view, BRect frame, const char *title);
~GLMovWindow();
virtual bool QuitRequested();
virtual void MessageReceived(BMessage *message);
virtual void DirectConnected(direct_buffer_info *info);
static GLMovWindow *MakeWindow(object_type obj);
private:
GLMovView *fGLView;
};
#endif /* _GLMOVWINDOW_H */

12
src/apps/3dmov/Jamfile Normal file
View File

@ -0,0 +1,12 @@
SubDir HAIKU_TOP src apps 3dmov ;
SetSubDirSupportedPlatformsBeOSCompatible ;
Application 3DMov :
CubeView.cpp
GLMovApp.cpp
GLMovView.cpp
GLMovWindow.cpp
: be GL game
: 3dmov.rdef
;

120
src/apps/3dmov/makefile Normal file
View File

@ -0,0 +1,120 @@
## BeOS Generic Makefile v2.2 ##
## Fill in this file to specify the project being created, and the referenced
## makefile-engine will do all of the hard work for you. This handles both
## Intel and PowerPC builds of the BeOS.
## Application Specific Settings ---------------------------------------------
# specify the name of the binary
NAME= 3DMov2
# specify the type of binary
# APP: Application
# SHARED: Shared library or add-on
# STATIC: Static library archive
# DRIVER: Kernel Driver
TYPE= APP
# add support for new Pe and Eddie features
# to fill in generic makefile
#%{
# @src->@
# specify the source files to use
# full paths or paths relative to the makefile can be included
# all files, regardless of directory, will have their object
# files created in the common object directory.
# Note that this means this makefile will not work correctly
# if two source files with the same name (source.c or source.cpp)
# are included from different directories. Also note that spaces
# in folder names do not work well with this makefile.
SRCS= $(wildcard *.cpp)
# specify the resource files to use
# full path or a relative path to the resource file can be used.
RSRCS= 3dmov.rsrc
# @<-src@
#%}
# end support for Pe and Eddie
# specify additional libraries to link against
# there are two acceptable forms of library specifications
# - if your library follows the naming pattern of:
# libXXX.so or libXXX.a you can simply specify XXX
# library: libbe.so entry: be
#
# - if your library does not follow the standard library
# naming scheme you need to specify the path to the library
# and it's name
# library: my_lib.a entry: my_lib.a or path/my_lib.a
LIBS= be game GL
# specify additional paths to directories following the standard
# libXXX.so or libXXX.a naming scheme. You can specify full paths
# or paths relative to the makefile. The paths included may not
# be recursive, so include all of the paths where libraries can
# be found. Directories where source files are found are
# automatically included.
LIBPATHS=
# additional paths to look for system headers
# thes use the form: #include <header>
# source file directories are NOT auto-included here
SYSTEM_INCLUDE_PATHS =
# additional paths to look for local headers
# thes use the form: #include "header"
# source file directories are automatically included
LOCAL_INCLUDE_PATHS =
# specify the level of optimization that you desire
# NONE, SOME, FULL
OPTIMIZE=
# specify any preprocessor symbols to be defined. The symbols will not
# have their values set automatically; you must supply the value (if any)
# to use. For example, setting DEFINES to "DEBUG=1" will cause the
# compiler option "-DDEBUG=1" to be used. Setting DEFINES to "DEBUG"
# would pass "-DDEBUG" on the compiler's command line.
DEFINES=
# specify special warning levels
# if unspecified default warnings will be used
# NONE = supress all warnings
# ALL = enable all warnings
WARNINGS =
# specify whether image symbols will be created
# so that stack crawls in the debugger are meaningful
# if TRUE symbols will be created
SYMBOLS =
# specify debug settings
# if TRUE will allow application to be run from a source-level
# debugger. Note that this will disable all optimzation.
DEBUGGER =
# specify additional compiler flags for all files
COMPILER_FLAGS =
# specify additional linker flags
LINKER_FLAGS =
# specify the version of this particular item
# (for example, -app 3 4 0 d 0 -short 340 -long "340 "`echo -n -e '\302\251'`"1999 GNU GPL")
# This may also be specified in a resource.
APP_VERSION =
# (for TYPE == DRIVER only) Specify desired location of driver in the /dev
# hierarchy. Used by the driverinstall rule. E.g., DRIVER_PATH = video/usb will
# instruct the driverinstall rule to place a symlink to your driver's binary in
# ~/add-ons/kernel/drivers/dev/video/usb, so that your driver will appear at
# /dev/video/usb when loaded. Default is "misc".
DRIVER_PATH =
## include the makefile-engine
include $(BUILDHOME)/etc/makefile-engine