Jump to content
Sal's RuneScape Forum
  • entries
    244
  • comments
    2,657
  • views
    15,298

Lights, Camera, Action!

Sign in to follow this  
Toungy

18 views

I've got cameras, lights and geometry (with correct normal calculation, culling, etc.) up and running, and I thought I'd give you all a screenshot! :glasses: (Just to show off :glasses:)

 

lights.png

 

Source code for this:

 

#include <TGE.h>
#pragma comment(lib, "TGE.lib")

Interface( MyInterface ) {

Window		* win;
Renderer	* renderer;
Scene		* scene;
Camera		* cam;
Object		* obj, * obj2, * obj3, * obj4;
Primitive	* tri1, * tri2, * tri3, * tri4, * tri5, * tri6, * tri7, * tri8;
Light		* light1, * light2;

void Initialise() {

	win = pRoot->CreateWindow("Test window");
	renderer = pRoot->CreateRenderer(Direct3D9);

	WindowParams winParams;

	winParams.width  = 640;
	winParams.height = 480;
	winParams.posX   = 50;
	winParams.posY   = 50;

	win->SetParams(winParams);
	win->AttachRenderer(renderer);

}

void CreateScene() {

	scene = renderer->CreateScene();

	cam = scene->CreateCamera();
	light1 = scene->CreateLight();
	light2 = scene->CreateLight();

	cam->SetPosition(Vector(12, 5, -35));
	cam->SetLookAt(Vector(0, 0, 0));

	obj = scene->CreateObject();
	obj2 = scene->CreateObject();
	obj3 = scene->CreateObject();
	obj4 = scene->CreateObject();

	obj2->SetRotation(Vector(-90,0,0));
	obj2->SetPosition(Vector(0,-5,0));

	obj3->noLighting = true;
	obj4->noLighting = true;

	tri1 = obj->CreatePrimitive();
	tri2 = obj->CreatePrimitive();
	tri3 = obj->CreatePrimitive();
	tri4 = obj->CreatePrimitive();

	tri5 = obj2->CreatePrimitive();
	tri6 = obj2->CreatePrimitive();

	tri7 = obj3->CreatePrimitive();

	tri8 = obj4->CreatePrimitive();

	tri1->Create(Triangle,	Vector(-3.3f, -5, -3.3f), Vector( 3.3f, -5, -3.3f), Vector(    0,  5, 0));
	tri2->Create(Triangle,	Vector(-3.3f, -5,  3.3f), Vector( 3.3f, -5,  3.3f), Vector(    0,  5, 0));
	tri3->Create(Triangle,	Vector( 3.3f, -5, -3.3f), Vector( 3.3f, -5,  3.3f), Vector(    0,  5, 0));
	tri4->Create(Triangle,	Vector(-3.3f, -5, -3.3f), Vector(-3.3f, -5,  3.3f), Vector(    0,  5, 0));

	tri5->Create(Triangle,	Vector(-10, -10, 0), Vector( 10, -10, 0), Vector(-10,  10, 0));
	tri6->Create(Triangle,	Vector( 10, -10, 0), Vector(-10,  10, 0), Vector( 10,  10, 0));

	tri7->Create(Triangle,	Vector(-1, -1, 0), Vector(1, -1, 0), Vector(0,1,0));

	tri8->Create(Triangle,	Vector(-1, -1, 0), Vector(1, -1, 0), Vector(0,1,0));

}

void HandleEvent(Event * evt) {

	float light1X = 5*cos(timeGetTime()/350.0f);
	float light1Z = 5*sin(timeGetTime()/350.0f);
	float light2Y = 15*sin(timeGetTime()/550.0f);
	float light2Z = 15*cos(timeGetTime()/550.0f);
	light1->SetPosition(Vector(light1X, 5, light1Z));
	light2->SetPosition(Vector(0, light2Y, light2Z));

	obj3->SetPosition(Vector(light1X, 5, light1Z));
	obj4->SetPosition(Vector(0, light2Y, light2Z));

}

};

Main() {

pRoot->RegisterInterface(MyInterface);

}

 

The white triangles demonstrate the 'noLighting' state, in which they are always lit 100%. The triangles are at the same position as the two lights at the scene, for indication purposes.

Sign in to follow this  


51 Comments


Recommended Comments



BOOM! :aware:(I'm sorry if this is spam, but that's the word that I always think of when I hear "Lights, Camera, Action!" Lol. ^_^)

Share this comment


Link to comment
BOOM! :aware:(I'm sorry if this is spam, but that's the word that I always think of when I hear "Lights, Camera, Action!" Lol. ^_^)
:PEdited the entry a bit.

Share this comment


Link to comment
Your making fast progress on the TGEWhen can we expect Word Of padman warcraft Tiger?
Well, it'll probably put to use on an MMORPG game, which hopefully will feature playable tiger characters, is that good enough? :DAnd for those interrested, you can try the current build out, though I can't gaurantee that it will work, here:http://toungeweb.com/uploads/TGE/TGE_TestApp_1Dec2007.zipIf it doesn't work, please post whatever error pops up here, that'd be great. :aware:(Extract both the .exe and .dll in the same folder and run the .exe)Edit: Here's a lo-fi version, if the other one does not work: http://toungeweb.com/uploads/TGE/TGE_TestA...ec2007_lofi.zipEdit 2: If d3dx9_34.dll cannot be found, please download the latest DirectX here: http://www.microsoft.com/downloads/details...;displaylang=en

Share this comment


Link to comment
Your making fast progress on the TGEWhen can we expect Word Of padman warcraft Tiger?
Well, it'll probably put to use on an MMORPG game, which hopefully will feature playable tiger characters, is that good enough? :DAnd for those interrested, you can try the current build out, though I can't gaurantee that it will work, here:http://toungeweb.com/uploads/TGE/TGE_TestApp_1Dec2007.zipIf it doesn't work, please post whatever error pops up here, that'd be great. :)(Extract both the .exe and .dll in the same folder and run the .exe)Edit: Here's a lo-fi version, if the other one does not work: http://toungeweb.com/uploads/TGE/TGE_TestA...ec2007_lofi.zipEdit 2: If d3dx9_34.dll cannot be found, please download the latest DirectX here: http://www.microsoft.com/downloads/details...;displaylang=en
W00t playeble TigersCan't wait

Share this comment


Link to comment

Will you add a cat char for me cause you love me so much and whatever.EDIT: Doesn't seem to be vista compatible. I got the DX9 device could not be created error on both versions.

Share this comment


Link to comment
Will you add a cat char for me cause you love me so much and whatever.
Cat char, or cat chat? :)

Share this comment


Link to comment
Will you add a cat char for me cause you love me so much and whatever.
Cat char, or cat chat? :P
Character, I never spell anything wrong, ever.

A chat for cats would be nice though. Especially cut, female cats :)

Share this comment


Link to comment
Will you add a cat char for me cause you love me so much and whatever.EDIT: Doesn't seem to be vista compatible. I got the DX9 device could not be created error on both versions.
I'm actually developing it on Vista Home Premium. :) Graphics card?

Share this comment


Link to comment
Will you add a cat char for me cause you love me so much and whatever.EDIT: Doesn't seem to be vista compatible. I got the DX9 device could not be created error on both versions.
I'm actually developing it on Vista Home Premium. :) Graphics card?
Geforce 7300 LE, believe. I'll give you a definite in a second here.EDIT; I was right

Share this comment


Link to comment
Will you add a cat char for me cause you love me so much and whatever.EDIT: Doesn't seem to be vista compatible. I got the DX9 device could not be created error on both versions.
I'm actually developing it on Vista Home Premium. :) Graphics card?
Geforce 7300 LE, believe. I'll give you a definite in a second here.EDIT; I was right
Hm.. I'm developing it on a mobile 8600 GS (darn you, 8800 GT for not being here yet), so it might have something to do with that. Tried the no hardware version yet?

Share this comment


Link to comment
Will you add a cat char for me cause you love me so much and whatever.EDIT: Doesn't seem to be vista compatible. I got the DX9 device could not be created error on both versions.
I'm actually developing it on Vista Home Premium. :) Graphics card?
Geforce 7300 LE, believe. I'll give you a definite in a second here.EDIT; I was right
Hm.. I'm developing it on a mobile 8600 GS (darn you, 8800 GT for not being here yet), so it might have something to do with that. Tried the no hardware version yet?
Yup, and I tried a few compatibility modes. I'll try it on my linux VPC with WINE.EDIT: WINE wasn't working :P

Share this comment


Link to comment
When do we get to see some colors?
Horses are colorblind. You don't get to see colors.

Share this comment


Link to comment
When do we get to see some colors?
Horses are colorblind. You don't get to see colors.
Epic pwn. :DJust to show Lilshu it works with colors too:colors.png

Share this comment


Link to comment
When do we get to see some colors?
Horses are colorblind. You don't get to see colors.
Epic pwn. :DJust to show Lilshu it works with colors too:colors.png
Looks like you need a brighter light source :)

Share this comment


Link to comment
When do we get to see some colors?
Horses are colorblind. You don't get to see colors.
Epic pwn. :DJust to show Lilshu it works with colors too:colors.png
Looks like you need a brighter light source :)
The colors were a bit dim, and I still need to fine-tune the whole lighting thing. :P

Share this comment


Link to comment
The colors were a bit dim, and I still need to fine-tune the whole lighting thing. :)
Ok :PCompared to, lets say the WOW engine, where would you place it in terms of potential graphic quality?

Share this comment


Link to comment
The colors were a bit dim, and I still need to fine-tune the whole lighting thing. :P
Ok :PCompared to, lets say the WOW engine, where would you place it in terms of potential graphic quality?
Right now, nowhere. But I've not been working that long on it, and I still have a lot to do. (Including physics, shadows, effects, HLSL (a whole language to learn), etc.)The result will hopefully be a pretty graphically intense engine. :DBetter colors demonstration:colors2.png

Share this comment


Link to comment
The colors were a bit dim, and I still need to fine-tune the whole lighting thing. :P
Ok :PCompared to, lets say the WOW engine, where would you place it in terms of potential graphic quality?
Right now, nowhere. But I've not been working that long on it, and I still have a lot to do. (Including physics, shadows, effects, HLSL (a whole language to learn), etc.)
All in a few months? You're nuts.
The result will hopefully be a pretty graphically intense engine. :DBetter colors demonstration:colors2.png
That looks pretty darn nice. I'm loving the shadows :P

Share this comment


Link to comment
The colors were a bit dim, and I still need to fine-tune the whole lighting thing. :P
Ok :PCompared to, lets say the WOW engine, where would you place it in terms of potential graphic quality?
Right now, nowhere. But I've not been working that long on it, and I still have a lot to do. (Including physics, shadows, effects, HLSL (a whole language to learn), etc.)
All in a few months? You're nuts.
This engine is exactly 20 days old. :P Physics will probably the hardest part. Both to implement and to calculate. But it's cool though, isn't it? :P
The result will hopefully be a pretty graphically intense engine. :DBetter colors demonstration:colors2.png
That looks pretty darn nice. I'm loving the shadows :D
There's actually no shadow rendering, yet. :P Just diffuse lighting. Direct3D doesn't even have built in shadow rendering! I have to do all the math myself. :P

Share this comment


Link to comment
The colors were a bit dim, and I still need to fine-tune the whole lighting thing. :P
Ok :PCompared to, lets say the WOW engine, where would you place it in terms of potential graphic quality?
Right now, nowhere. But I've not been working that long on it, and I still have a lot to do. (Including physics, shadows, effects, HLSL (a whole language to learn), etc.)
All in a few months? You're nuts.
This engine is exactly 20 days old. :P Physics will probably the hardest part. Both to implement and to calculate. But it's cool though, isn't it? :D
Happy birthday, engine! And yes, it's cool.
The result will hopefully be a pretty graphically intense engine. :DBetter colors demonstration:colors2.png
That looks pretty darn nice. I'm loving the shadows :P
There's actually no shadow rendering, yet. :P Just diffuse lighting. Direct3D doesn't even have built in shadow rendering! I have to do all the math myself. :P
It still looks nice :P

Share this comment


Link to comment
No reds?:P
Colorblind, remember?
(If you need any help with the physics calculations, I have a calculator. :P)
This isn't a job for a calculator <_<Slide rule, anyone?

Share this comment


Link to comment
No reds?:P
Colorblind, remember?
What are you talking about? I can see red... Heck, I'll even color my text red: And you thought I couldn't see color. (:P ~T)
no, RED:see, red?
(If you need any help with the physics calculations, I have a calculator. :D)
This isn't a job for a calculator <_<Slide rule, anyone?
TI 900 > Slide Rule :P
TI has no processing power :P

Share this comment


Link to comment
Will you ever need any testers for this? :P
Yes, that's why I posted a demo build. :P

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×

Important Information

By using this site, you agree to our Guidelines and Privacy Policy.