Menu

Welcome, Guest. Please login or register.
January 23, 2019, 12:52:48 am

Login with username, password and session length

Author Topic: [C++] LightAdder  (Read 9713 times)

Garthog

  • Contributors
  • Polygonshifter
  • *****
  • Posts: 56
    • View Profile
[C++] LightAdder
« on: August 04, 2011, 12:57:21 am »
It's a tool which is used to add lights to M2. As a screen talk much than writing :



Download : Windows / Source / OSX / Linux

How to use : Drag a M2 file on the LightAdder, and then follow the menu. It's still a work in progress, so some things don't work, like deletion.

Create light : AR = Ambiant Red | AG = Ambiant Green | AB = Ambiant Blue | AI = Ambiant Intensity
DR, DG, DB, DI ( Same thing as ambiant ).

Modify : ID => Number of the light with the i command on the menu ( start from 0 )
And the rest work as intended. Be careful some things are integers, others are float ( eg : 1.24 ).

Author : Me, and help from Schlumpf / Tigurius / pxr.dk !

Thanks ! Don't hesitate to post me some improvements !
« Last Edit: August 04, 2011, 08:19:16 am by Admin »

Vel

  • Contributors
  • Creator of Worlds
  • *****
  • Posts: 340
    • View Profile
Re: [C++] LightAdder
« Reply #1 on: August 04, 2011, 01:17:11 am »
Woah, realy nice.
---
It would be cool if you made the lighting editor (light.dbc and others light dbc ...).
1) loads a 3 DBC in editor
2) change in the program colortime etc
3) save the changes (which apply to all loaded into the DBC editor)
..?
« Last Edit: January 01, 1970, 01:00:00 am by Admin »
is no more

Garthog

  • Contributors
  • Polygonshifter
  • *****
  • Posts: 56
    • View Profile
Re: [C++] LightAdder
« Reply #2 on: August 04, 2011, 01:43:36 am »
It's different as it mess with dbc. I never touched to dbc. I could make something with the CSV generated by DBCUtil, but not by this. Someone of my team did something like that to make some dark night everywhere. When he's back i'll post it. ( in Pascal )
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Vel

  • Contributors
  • Creator of Worlds
  • *****
  • Posts: 340
    • View Profile
Re: [C++] LightAdder
« Reply #3 on: August 04, 2011, 02:03:54 am »
Quote from: "Garthog"
It's different as it mess with dbc. I never touched to dbc. I could make something with the CSV generated by DBCUtil, but not by this. Someone of my team did something like that to make some dark night everywhere. When he's back i'll post it. ( in Pascal )
it is only in the old MES (tbc), and very very poorly compatible with wotlk.

(I have at least failed to make tbc MES work with wotlk dbc)
« Last Edit: January 01, 1970, 01:00:00 am by Admin »
is no more

Garthog

  • Contributors
  • Polygonshifter
  • *****
  • Posts: 56
    • View Profile
Re: [C++] LightAdder
« Reply #4 on: August 04, 2011, 02:55:48 am »
DBCUtil works perfectly to get csv from dbc files, and it's pretty simple to change. Then you get your dbc back with dbcutil too.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

schlumpf

  • Administrator
  • Creator of Worlds
  • *****
  • Posts: 2951
    • View Profile
Re: [C++] LightAdder
« Reply #5 on: August 04, 2011, 08:15:29 am »
OSX: http://cl.ly/312j2g0X0S2t3t0q0A41
Linux: http://cl.ly/2B173o3M0o1o3V0Y2X0H

light.cpp:183: warning: converting to non-pointer type ‘char’ from NULL

You may want to end couting with a new line.
You may want not to keep the application open by tricks but should end the application as soon as its over. (waiting for a key press, that trick is.)
You may want to use two or three whitespaces instead of tabs.
Global variables are bad. Use a class if you need some semi global state and add functions needing the globals as methods.
using namespace is evil. Do full name qualification instead.
std::endl does not only "n" or "rn" but also flushes the buffer. Better do that only when really needing the text to be printed _now_ and use "n" instead.
const char null = NULL; might be nice for you coming from a null background, but better get used to NULL. Also, NULL is a void* so converting it into a const char might not be a good idea. Or that const char was supposed to be a const char*.
For the sake of performance, better write into an allocated buffer in memory first, then when you're done, write that to disk. Disk access still is slow. This also enables you to do writes easier. *(float*)&buffer[address] = 0.0f; is easier than calling a function to modify the file. And is more save than reinterpret_casting that float to a char*.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Tigurius

  • Registred Member
  • Wiki Incarnate
  • *****
  • Posts: 126
    • View Profile
Re: [C++] LightAdder
« Reply #6 on: August 04, 2011, 09:00:16 am »
Quote from: "schlumpf"
You may want to use two or three whitespaces instead of tabs.
Well the benefit of tabs is, that everyone who reads the code can make his editor show the indentation the way he likes.  That's why on my university the tab-indentation is preferred.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Steff

  • Administrator
  • Creator of Worlds
  • *****
  • Posts: 4549
    • View Profile
Re: [C++] LightAdder
« Reply #7 on: August 04, 2011, 12:25:38 pm »
I want to add DBC light stuff to noggit some day. Tahts why the lights are displayed in the mapview (m).
You should be able then to select the lights in the mapview and change the parameters. Noggit updates then the view direct and save the dbc changes. You will also be able to add new lights.

So the plan :)

And very nice tool. Another point everyone can do.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »
Please mark as solved if solved.
Don't ask if you could ask a question... JUST ask the Question.
You can send me also offline messages. I will answer if I get online.
Skype: project.modcraft
Discord: steff#6954

schlumpf

  • Administrator
  • Creator of Worlds
  • *****
  • Posts: 2951
    • View Profile
Re: [C++] LightAdder
« Reply #8 on: August 04, 2011, 12:46:13 pm »
Quote from: "Tigurius"
Quote from: "schlumpf"
You may want to use two or three whitespaces instead of tabs.
Well the benefit of tabs is, that everyone who reads the code can make his editor show the indentation the way he likes.  That's why on my university the tab-indentation is preferred.
This is correct, while n the other hand, people tend to align more than the beginning of lines like in his code, the variables in structures. With different tab width, that will fuck up the formatting for others.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Putte08

  • Registred Member
  • Polygonshifter
  • *****
  • Posts: 68
    • View Profile
    • http://www.YouTube.com/08Putte08
Re: [C++] LightAdder
« Reply #9 on: March 22, 2012, 09:22:13 pm »
Gotta try this out. Looks awesome.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

PainSavior

  • Contributors
  • LUA Script Tinker
  • *****
  • Posts: 40
    • View Profile
Re: [C++] LightAdder
« Reply #10 on: October 23, 2013, 02:20:07 am »
Could you share a download for the M2 file, just to use as a guideline.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Feel

  • Registred Member
  • MWCS Enthusiast
  • *****
  • Posts: 1
    • View Profile
Re: [C++] LightAdder
« Reply #11 on: February 23, 2014, 04:28:01 am »
"Could you share a download for the M2 file, just to use as a guideline."


Up, I'm also interested ^^
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

tehrob

  • Registred Member
  • Race Changer
  • *****
  • Posts: 39
    • View Profile
Re: [C++] LightAdder
« Reply #12 on: March 19, 2014, 05:44:17 pm »
would be great if someone could write down here, how to use this tool :)
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

natrist

  • Registred Member
  • BLP Convertor
  • *****
  • Posts: 7
    • View Profile
Re: [C++] LightAdder
« Reply #13 on: March 20, 2014, 02:54:39 pm »
I have noticed that the lighting disappears if you get the camera away from the light source.
Is this caused by a bug in your application or the game client itself?
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

schlumpf

  • Administrator
  • Creator of Worlds
  • *****
  • Posts: 2951
    • View Profile
Re: [C++] LightAdder
« Reply #14 on: March 20, 2014, 04:05:02 pm »
Quote from: "natrist"
I have noticed that the lighting disappears if you get the camera away from the light source.
Is this caused by a bug in your application or the game client itself?
It is a bug in the application: In the m2 header, there is a bounding box used to determine if the client needs to draw it. This is also used to determine if light sources from that model are used. When adding the light, the box needs to be extended to contain the maximum range of the light. If you don't, you can only see the light as long as at least a pixel of the bounding box is visible.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »