Subversion Repository Public Repository

Divide-Framework

This repository has no backups
This repository's network speed is throttled to 100KB/sec

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#include "config.h"

#include "engineMain.h"

#include "Core/Headers/Console.h"
#include "Core/Headers/Application.h"

#include <iostream>

namespace Divide {

namespace {
    void out_of_memory()
    {
        DIVIDE_ASSERT(false, "Out of memory!");
    }
};

class StreamBuffer {
public:
    StreamBuffer(const char* filename)
        : _buf(std::ofstream(filename, std::ofstream::out | std::ofstream::trunc))
    {
    }

    inline std::ofstream& buffer() {
        return _buf;
    }

private:
    std::ofstream _buf;
};

Engine::Engine() :_app(Application::instance()),
                  _errorCode(0)
{
    std::set_new_handler(out_of_memory);
    _outputStreams[0] = new StreamBuffer(OUTPUT_LOG_FILE);
    _outputStreams[1] = new StreamBuffer(ERROR_LOG_FILE);
    std::cout.rdbuf(_outputStreams[0]->buffer().rdbuf());
    std::cerr.rdbuf(_outputStreams[1]->buffer().rdbuf());
}

Engine::~Engine()
{
    std::cout << std::endl;
    std::cerr << std::endl;
    delete _outputStreams[0];
    delete _outputStreams[1];
}

bool Engine::init(int argc, char** argv) {
    ErrorCode err = ErrorCode::NO_ERR;

    if (!PlatformInit()) {
        err = ErrorCode::PLATFORM_INIT_ERROR;
    } else {
        // Start our application based on XML configuration.
        // If it fails to start, it should automatically clear up all of its data
        err = _app.start("main.xml", argc, argv);
        if (err != ErrorCode::NO_ERR) {
            // If any error occurred, close the application as details should
            // already be logged
            Console::errorfn("System failed to initialize properly. Error [ %s ] ",
                             getErrorCodeName(err));
        }

    }

    _errorCode = to_int(err);

    return err == ErrorCode::NO_ERR;
}

void Engine::shutdown() {
    _app.stop();

    if (!PlatformClose()) {
        _errorCode = to_int(ErrorCode::PLATFORM_CLOSE_ERROR);
    }
}

bool Engine::step() {
    assert(_errorCode == 0);
        
    return _app.step();
}

int Engine::errorCode() const {
    return to_int(_errorCode);
}

};

Commits for Divide-Framework/trunk/Source Code/engineMain.cpp

Diff revisions: vs.
Revision Author Commited Message
768 Diff Diff IonutCava picture IonutCava Fri 09 Sep, 2016 14:38:51 +0000

[IonutCava]
- Refactored framework entry points (init, step, shutdown) to allow the addition of hot code reloading in the future

749 Diff Diff IonutCava picture IonutCava Mon 04 Jul, 2016 16:01:34 +0000

[IonutCava]
- Added initial environment mapping code:
— Allow adding, per scene, of multiple environment probes that generate cube map reflections
— Support 2 types of probes: infinite (such as sky only probes) and local. Local probes use an AABB that will later be used for parallax correction
— Probes are held in a scene specific pool, can be updated at different rates and their results can be passed on to materials (if materials don’t need specific reflection systems such as for water or mirrors)
- ToDo:
— Blend between probes (currently, only the closes one is selected)
— Reduce VRAM usage
— Set as fallback for screen space reflections

712 Diff Diff IonutCava picture IonutCava Tue 24 May, 2016 16:18:37 +0000

[IonutCava]
- Added the concept of “buffer” to be used by GenericVertexData and ShaderBuffer without caring if it’s persistent or not.
— Persistent buffers handle their own locking instead of relying on the parent class
- HiZ occlusion culling fixes and optimizations

686 Diff Diff IonutCava picture IonutCava Thu 21 Apr, 2016 16:24:19 +0000

[IonutCava]
- Refactor the scene self-registering system to prevent linker related issues
- Add a SGNRelationshipCache class that can quickly verify if any 2 given nodes are related in any way
— This should speed up Octree updates by a lot

note: The template refactoring code has significantly slowed down performance for reasons yet unknown. Investigating.

671 Diff Diff IonutCava picture IonutCava Fri 08 Apr, 2016 16:26:49 +0000

[Ionut]
- Custom memory allocation system part 1:
— Add http://www.codeproject.com/Articles/1089905/A-Custom-STL-std-allocator-Replacement-Improves-Pe
— Add custom allocators to strings and vectors
— Add custom allocators to a few test classes
— No support for aligned memory yet, so vec4<F32> and mat4<F32> vectors use the old allocation system
- Replace more std::async call with our custom task system

670 Diff Diff IonutCava picture IonutCava Wed 06 Apr, 2016 16:21:35 +0000

[IonutCava]
- getInstance() renamed to instance() for simplicity (should really go away altogether, but that’s a different issue)
- some particle emitter threading updates

660 Diff Diff IonutCava picture IonutCava Mon 21 Mar, 2016 17:11:19 +0000

[IonutCava]
- Finish Parent<->Children thread pool system
- Use new thread pool system for most multithreaded tasks in the engine: culling, sorting, light preparation, etc
- Add platform specific init/close calls at the start and end of the main function for future use

464 Diff Diff IonutCava picture IonutCava Thu 04 Jun, 2015 16:07:22 +0000

[Ionut]
- Linux port work:
— Improved timing code
— Split solution in 3 projects: Divide-Game, Divide-Networking, Divide-Server all in a single working set.
- Fixed OpenGL context creation fail message

400 Diff Diff IonutCava picture IonutCava Wed 15 Apr, 2015 16:21:13 +0000

[Ionut]
- More rendering optimizations:
— NodeBuffer is no longer range-bound. Instead a uniform is set before each draw with the offset in the buffer (basically, the same value as gl_BaseInstanceARB, but the former isn’t working ... at all ...)
— Use std::array for drawCommands and node data with fixed maximum size and update only subregions of the parent buffer
— Remove nonBatchedCommands intermediate vector
— Replaced some runtime if-checks with asserts when parsing draw commands
- Added more flush control for console output. Moved text output to ofstream based system.
- Removed loop from matrix multiplication fucntion

394 IonutCava picture IonutCava Tue 31 Mar, 2015 23:30:02 +0000

[Ionut]
- Removed async code (was 3x slower)
- More singleton work
- Commented out opengl debug groups (slow and unnecessary currently)