~james-gangur/sqee/trunk

« back to all changes in this revision

Viewing changes to tests/rpg/main/Scripting.cpp

  • Committer: james.gangur at gmail
  • Date: 2015-10-13 02:55:15 UTC
  • Revision ID: james.gangur@gmail.com-20151013025515-uj2rnpflxeyt6csf
Refactored Texture objects:
 - format, iFormat and preset are now passed to the ctor
 - allocate_storage is now responsible for setting up the texture
 - added a delete_object method, for saving video memory
 - allocate_storage now takes a mipmaps argument
 - buffer_memory now takes a data type argument
 - removed the mutable textures entirely
Refactored sq::Settings:
 - Settings are now stored in Boxed_Value objects, making supporting new types easier
 - Added Boxed_Value versions of the mod/get functions for use with chaiscript
All texture members are now stored as value types, rather than unique_ptrs
Refactored chaiscript files. More consistent and improved compile times.
Moved RPG's SkyBox, Ambient and Skylight objects into their own files
Tidied up most of the wcoe objects regarding direct state access
For rpg Object derived classes, prefer using value members over unique_ptrs
Fixed reflections, added new Reflects object to Renderer

Particles still need to be fixed

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <chaiscript/dispatchkit/dispatchkit.hpp>
1
2
#include <chaiscript/utility/utility.hpp>
2
3
 
3
4
#include "../wcoe/Cell.hpp"
4
5
#include "../wcoe/World.hpp"
 
6
#include "../wcoe/SkyBox.hpp"
 
7
#include "../wcoe/Ambient.hpp"
 
8
#include "../wcoe/SkyLight.hpp"
5
9
#include "../wcoe/objects/MetaObject.hpp"
6
10
#include "../wcoe/objects/RigBodyBasic.hpp"
7
11
#include "../wcoe/objects/RigBodyMulti.hpp"
16
20
#include "../rndr/Renderer.hpp"
17
21
#include "Scripting.hpp"
18
22
 
19
 
using namespace sqt;
20
 
 
21
23
using chai::fun;
 
24
using chai::user_type;
22
25
using chai::base_class;
23
26
using chai::constructor;
24
27
using chai::type_conversion;
25
28
using chai::utility::add_class;
26
29
using chai::Boxed_Value;
27
30
using chai::boxed_cast;
28
 
using chai::user_type;
 
31
 
 
32
using namespace sqt;
 
33
 
29
34
 
30
35
void sqt::cs_setup_main(chai::ChaiScript& _cs) {
31
36
    chai::ModulePtr m(new chai::Module());
33
38
    _cs.add(m);
34
39
}
35
40
 
 
41
 
36
42
void sqt::cs_setup_wcoe(chai::ChaiScript& _cs) {
37
43
    using namespace wcoe;
38
44
    chai::ModulePtr m(new chai::Module());
190
196
 
191
197
    add_class<Emitter>(*m, "Emitter", {}, {
192
198
       {fun(&Emitter::PROP_position), "position"},
193
 
       {fun(&Emitter::emit_puff), "emit_puff"} });
 
199
       {fun(&Emitter::FUNC_emit_puff), "emit_puff"} });
194
200
 
195
201
    add_class<Decal>(*m, "Decal", {}, {
196
202
       {fun(&Decal::PROP_position), "position"},
209
215
        });
210
216
 
211
217
    add_class<Cell>(*m, "Cell", {}, {
212
 
        {fun(&Cell::DAT_enabled), "enabled"},
213
 
        {fun(&Cell::DAT_position), "position"},
 
218
        {fun(&Cell::PROP_enabled), "enabled"},
 
219
        {fun(&Cell::PROP_position), "position"},
214
220
        {fun(&Cell::load_from_file), "load_from_file"},
215
221
        {fun(&Cell::add_object<MetaObject>),   "add_MetaObject"},
216
222
        {fun(&Cell::get_object<MetaObject>),   "get_MetaObject"},
249
255
    m->add(base_class<Object, Liquid>());
250
256
    m->add(base_class<Object, Decal>());
251
257
 
 
258
    m->add(type_conversion<unique_ptr<SkyBox>&, SkyBox*>([]
 
259
          (unique_ptr<SkyBox>& uptr) { return uptr.get(); }));
 
260
    m->add(type_conversion<unique_ptr<Ambient>&, Ambient*>([]
 
261
          (unique_ptr<Ambient>& uptr) { return uptr.get(); }));
 
262
    m->add(type_conversion<unique_ptr<SkyLight>&, SkyLight*>([]
 
263
          (unique_ptr<SkyLight>& uptr) { return uptr.get(); }));
 
264
 
252
265
    _cs.add(m);
253
266
}
254
267
 
 
268
 
255
269
void sqt::cs_setup_rndr(chai::ChaiScript& _cs) {
256
270
    using namespace rndr;
257
271
    chai::ModulePtr m(new chai::Module());