many exports to scriptengine

This commit is contained in:
cirdan
2008-01-24 22:16:53 +00:00
parent 2373b382f1
commit 491c09e235
29 changed files with 600 additions and 287 deletions

View File

@ -9,6 +9,9 @@
#include "ScriptSystem_Image.h"
#include "ScriptSystem_Math.h"
#include "ScriptSystem_RigidBody.h"
#include "ScriptSystem_SceneGraph.h"
#include "ScriptSystem_SceneNode.h"
#include "ScriptSystem_Model.h"
namespace BlueCore
{
@ -70,6 +73,9 @@ bool Application::initialize()
setupScriptSystem_Image(_ScriptSystem, _TextureManager, _Device);
setupScriptSystem_Math(_ScriptSystem);
setupScriptSystem_RigidBody(_ScriptSystem, _Simulation);
setupScriptSystem_SceneGraph(_ScriptSystem);
setupScriptSystem_SceneNode(_ScriptSystem);
setupScriptSystem_Model(_ScriptSystem, _ModelManager);
if (_ScriptSystem->loadScript("main") == false)
return false;
@ -108,6 +114,21 @@ void Application::run()
_Paused = false;
_Running = true;
ref_ptr<Mesh> star_mesh = _MeshManager->loadMesh ("stars.3ds");
ref_ptr<Texture> star_texture = _TextureManager->loadTexture ("stars.png", 0);
GLfloat lightAmbient[] = {0.0f, 0.0f, 0.0f, 1.0f} ;
GLfloat lightDiffuse[] = {1.0f, 1.0f, 1.0f, 1.0f} ;
GLfloat lightSpecular[] = {1.0f, 1.0f, 1.0f, 1.0f} ;
GLfloat lightPosition[] = { 1.0, 0.0, 0.0, 0.0};
glLightfv ( GL_LIGHT0, GL_AMBIENT, lightAmbient ) ;
glLightfv ( GL_LIGHT0, GL_DIFFUSE, lightDiffuse ) ;
glLightfv ( GL_LIGHT0, GL_SPECULAR, lightSpecular ) ;
glLightfv ( GL_LIGHT0, GL_POSITION, lightPosition );
glEnable ( GL_LIGHT0 ) ;
while (_Window->isOpen() && _Running)
{
double now = glfwGetTime();
@ -122,15 +143,20 @@ void Application::run()
//camera->setPosition(q.apply(Vector3(0.0, 0.0, _CameraRadius)));
//camera->setRotation(q);
//pos += 5 * _DeltaTime;
_Device->setAmbientLight(1.0, 1.0, 1.0);
if (_SceneGraph.valid())
{
_RenderQueue->clear();
_SceneGraph->update(delta);
_SceneGraph->queue(_RenderQueue);
_Device->begin3D(_SceneGraph->getCamera());
_RenderQueue->render(_Device);
_Device->end3D();
}
/*
{
_Device->begin3D(_Camera);
_Device->setAmbientLight(1.0, 1.0, 1.0);
_RenderQueue->clear();
_RenderQueue->addOpaqueItem(model, Vector3(0.0, 0.0, 0.0),
Quaternion());
@ -139,41 +165,7 @@ void Application::run()
}
*/
/*
device->pushAbsoluteTransformation(Vector3(), camera->getRotation());
class RenderState
{
bool _Blending;
GLint _BlendFuncSrc;
GLint _BlendFuncDest;
bool _DepthTest;
bool _DepthMask;
bool _Lighting;
};
GLfloat mat_specular[] =
{ 1.0, 1.0, 1.0, 1.0 };
GLfloat mat_shininess[] =
{ 2.0 };
glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_specular);
glMaterialfv(GL_FRONT, GL_AMBIENT, mat_specular);
glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular);
glMaterialfv(GL_FRONT, GL_SHININESS, mat_shininess);
glEnable(GL_BLEND);
glBlendFunc(GL_ONE, GL_ONE);
glEnable(GL_DEPTH_TEST);
glDepthMask(GL_FALSE);
glDisable(GL_LIGHTING);
glColor4d( 1.0f, 1.0f, 1.0f, 1.0f);
device->setTexture(0, starTexture, true);
starMesh->render();
glDisable(GL_BLEND);
device->popTransformation();
*/
*/
// device->useShader (program);
// device->setTexture (stage, name, texture)
// device->clearTextures (stage+1);
@ -197,6 +189,40 @@ void Application::run()
}
}
_Device->pushAbsoluteTransformation(Vector3(), _SceneGraph->getCamera()->getRotation());
/*
_Device->setShaderProgram (0);
glEnable(GL_DEPTH_TEST);
glDepthMask(GL_FALSE);
*/
glDisable(GL_BLEND);
glEnable(GL_DEPTH_TEST);
_Device->setTexture(0, star_texture, true);
glDisable(GL_LIGHTING);
glColor4d( 1.0f, 1.0f, 1.0f, 1.0f);
star_mesh->render();
_Device->popTransformation();
/*
class RenderState
{
bool _Blending;
GLint _BlendFuncSrc;
GLint _BlendFuncDest;
bool _DepthTest;
bool _DepthMask;
bool _Lighting;
};
GLfloat mat_specular[] = { 1.0, 1.0, 1.0, 1.0 };
GLfloat mat_shininess[] = { 2.0 };
glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_specular);
glMaterialfv(GL_FRONT, GL_AMBIENT, mat_specular);
glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular);
glMaterialfv(GL_FRONT, GL_SHININESS, mat_shininess);
*/
_Device->begin2D();
_ScriptSystem->callFunction("OnOverlay", delta, now - _StartTime);
_Device->end2D();