Now with a knife model. Real code coming soon-ish.

master
Sergiusz Bazanski 2011-02-15 18:21:07 +01:00
parent ceb881bc2d
commit 9e21167f5a
11 changed files with 2325 additions and 7936 deletions

36
README
View File

@ -1,3 +1,35 @@
Rhubarb is a 'project' 3d engine I've been working on.
Rhubarb is a 'project' 3D engine I (Sergiusz Bazanski) have been working on.
Unless you're curious about ugly C++ code, I'd stay away from it. :D
Its aim is to use OpenGL 3.0 as fully as possible, without deprecated features and unnecessary bloat.
Sample screenshot: http://i.imgur.com/8Wtxn.png
Main ideas:
o Based on OpenGL 3.0 core context, meaning no deprecated calls used
whatsoever (and that is a Good Thing).
o As tiny as possible, aiming to be not dependant on any other library. Right
now it still requires GLEW, but I'm getting rid of it soon.
o Portable, at least in theory. Linux context creation is coming sooon.
o Does not get in your way - you can use as much or as little stock classes
as you want. The default collection tries to hide details like shader
compilation and texture loading away from you, but if you want you can
start issuing OpenGL calls like it's 1999.
o Not a Game-specific engine - if you want that, go play with Ogre3D. We're
here to render stuff, not to write scene managers or physical objects
abstractions. If you want to use this in a game, write this stuff yourself.
Features:
o Slow and in places unstable .obj loading, but hey, it works.
o Simple to read and write .model formet which specifies mesh, shader and
texture data. New loaders easily writable.
o Basic objects included: Entity, Camera, Model.
Requirements:
o An OpenGL 3.0 compatible graphics card.
o GLEW, either as a static library or a .c source file.
Additional Credits:
o Hideous (www.hideou.se) and doeke for the Knife model and textures.

Binary file not shown.

View File

@ -46,6 +46,9 @@ void CModel::Load(std::string Filename)
std::ifstream File;
File.open(Filename.c_str(), std::ios::in);
if (!File.is_open())
throw Exception::ModelException("Could not open model file!");
std::string Keyword;
m_Name = "";

View File

@ -1,22 +0,0 @@
# This is how comments look like (notice the space at the beggining!).
# Name of model
name FacepunchLogo
# Name of vertex shader
vertex Data/phong.v.glsl
# Name of fragment shader
fragment Data/phong.f.glsl
# Name of mesh
mesh Data/fplogo.obj
# Ambient Color
ambient 0.1 0.1 0.1 1.0
# Diffuse Color
diffuse 1.0 0.0 0.0 1.0
# Shininess
shininess 128

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,25 @@
# This is how comments look like (notice the space at the beggining!).
# Name of model
name Knife
# Name of vertex shader
vertex Data/texturedphong.v.glsl
# Name of fragment shader
fragment Data/texturedphong.f.glsl
# Name of mesh
mesh Data/japanknife.obj
# Ambient Color
ambient 0.05 0.05 0.05 1.0
# Diffuse Color
diffuse 0.64 0.64 0.64 1.0
# Shininess
shininess 128
# Texture
texture Data/japanknife.tga

2253
Rhubarb/Data/japanknife.obj Normal file

File diff suppressed because it is too large Load Diff

BIN
Rhubarb/Data/japanknife.tga Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 MiB

View File

@ -1,22 +0,0 @@
# This is how comments look like (notice the space at the beggining!).
# Name of model
name Text
# Name of vertex shader
vertex Data/phong.v.glsl
# Name of fragment shader
fragment Data/phong.f.glsl
# Name of mesh
mesh Data/text.obj
# Ambient Color
ambient 0.1 0.1 0.1 1.0
# Diffuse Color
diffuse 0.69 0.34 0.1 1.0
# Shininess
shininess 128

File diff suppressed because it is too large Load Diff

View File

@ -24,7 +24,7 @@
rb::CEngine *g_Engine = rb::CEngine::Get();
rb::CModel Model;
rb::CModel Text;
//rb::CModel Text;
rb::CCamera Camera;
bool fnRender(float DeltaTime)
@ -32,13 +32,13 @@ bool fnRender(float DeltaTime)
static float Color = 0.0f;
Color += DeltaTime;
Model.RotateWorld(rbDegToRad(DeltaTime * 100), 0.0f, 1.0f, 0.0f);
Text.RotateWorld(-rbDegToRad(DeltaTime * 100), 0.0f, 1.0f, 0.0f);
Model.RotateLocal(rbDegToRad(DeltaTime * 100), 0.0f, 1.0f, 0.0f);
//Text.RotateWorld(-rbDegToRad(DeltaTime * 100), 0.0f, 1.0f, 0.0f);
Text.SetDiffuseColor((sinf(Color) / 2.0f) + 0.5f, (sinf(Color + 2.094f) / 2.0f) + 0.5f, (sinf(Color + 4.188f) / 2.0f) + 0.5f, 1.0f);
//Text.SetDiffuseColor((sinf(Color) / 2.0f) + 0.5f, (sinf(Color + 2.094f) / 2.0f) + 0.5f, (sinf(Color + 4.188f) / 2.0f) + 0.5f, 1.0f);
Model.Draw();
Text.Draw();
//Text.Draw();
return true;
}
@ -48,12 +48,13 @@ int main(int argc, char **argv)
RB_PARSE_ARGUMENTS(argc, argv);
g_Engine->Initialize(800, 600, "Rhubarb Demo");
Model.Load("Data/teapot.model");
Text.Load("Data/text.model");
Model.Load("Data/japanknife.model");
//Text.Load("Data/text.model");
Model.RotateLocal(rbDegToRad(45.0f), 0.0f, 0.0f, 1.0f);
Camera.SetPosition(0.0f, 20.0f, 45.0f);
Camera.SetPosition(0.0f, 14.0f, 20.0f);
rb::CVector4 LookTarget(0.0f, 5.0f, 0.0f);
rb::CVector4 LookTarget(-2.0f, 4.0f, 0.0f);
Camera.LookAt(LookTarget);
g_Engine->SetClearColor(0.05f, 0.05f, 0.05f);