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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#ifndef _OUTPUT_BUFFER_H_
#define _OUTPUT_BUFFER_H_

#if defined(_MSC_VER)
#	pragma warning( push )
#		pragma warning(disable:4512) ///<Boost alignment shouts
#elif defined(__GNUC__)
#	pragma GCC diagnostic push
#		//pragma GCC diagnostic ignored "-Wall"
#endif

#include "resource.h"

//------------------------------------------------------------------------------
namespace Divide {

template<typename charT, typename traits = std::char_traits<charT> >
class basic_teebuf : public std::basic_streambuf<charT, traits>
{
public:
    typedef charT char_type;
    typedef typename traits::int_type int_type;
    typedef typename traits::pos_type pos_type;
    typedef typename traits::off_type off_type;
    typedef traits traits_type;
    typedef std::basic_streambuf<charT, traits> streambuf_type;

private:
    streambuf_type *m_sbuf1;
    streambuf_type *m_sbuf2;
    char_type *m_buffer;

    enum {BUFFER_SIZE = 4096 / sizeof(char_type)};

public:
    basic_teebuf(streambuf_type *sbuf1, streambuf_type *sbuf2)
        : m_sbuf1(sbuf1), m_sbuf2(sbuf2), m_buffer(new char_type[BUFFER_SIZE])
    {
        setp(m_buffer, m_buffer + BUFFER_SIZE);
    }//constructor

    ~basic_teebuf()
    {
        std::basic_streambuf<charT, traits>::pubsync();
        delete[] m_buffer;
    }//destructor

protected:
    using std::basic_streambuf<charT, traits>::pptr;
    using std::basic_streambuf<charT, traits>::pbase;
    using std::basic_streambuf<charT, traits>::pbump;
    virtual int_type overflow(int_type c = traits_type::eof())
    {
        // empty our buffer into m_sbuf1 and m_sbuf2
        std::streamsize n = static_cast<std::streamsize>(pptr() - pbase());
        std::streamsize size1 = m_sbuf1->sputn(pbase(), n);
        std::streamsize size2 = m_sbuf2->sputn(pbase(), n);
        if (size1 != n || size2 != n)
            return traits_type::eof();

        // reset our buffer
        setp(m_buffer, m_buffer + BUFFER_SIZE);

        // write the passed character if necessary
        if (!traits_type::eq_int_type(c, traits_type::eof()))
        {
            traits_type::assign(*pptr(), traits_type::to_char_type(c));
            pbump(1);
        }//if

        return traits_type::not_eof(c);
    }//overflow

    virtual int sync()
    {
        // flush our buffer into m_sbuf1 and m_sbuf2
        int_type c = overflow(traits_type::eof());

        // checking return for eof.
        if (traits_type::eq_int_type(c, traits_type::eof()))
            return -1;

        // flush m_sbuf1 and m_sbuf2
        if (m_sbuf1->pubsync() == -1 || m_sbuf2->pubsync() == -1)
            return -1;

        return 0;
    }//sync
};//basic_teebuf

typedef basic_teebuf<char>    outbuf;
typedef basic_teebuf<wchar_t> woutbuf;

//------------------------------------------------------------------------------

template<typename charT, typename traits = std::char_traits<charT> >
struct scoped_basic_streambuf_assignment
{
    typedef std::basic_ostream<charT, traits> ostream_type;
    typedef std::basic_streambuf<charT, traits> streambuf_type;

    ostream_type &m_s;
    streambuf_type *m_orig_sb;

    scoped_basic_streambuf_assignment(ostream_type &s, streambuf_type *new_sb)
        : m_s(s)
    {
        m_orig_sb = m_s.rdbuf(new_sb);
    }//constructor

    ~scoped_basic_streambuf_assignment()
    {
        m_s.rdbuf(m_orig_sb);
    }//destructor
};//scoped_basic_streambuf_replacement

typedef scoped_basic_streambuf_assignment<char>    scoped_streambuf_assignment;
typedef scoped_basic_streambuf_assignment<wchar_t> scoped_wstreambuf_assignment;

}; //namespace Divide
#if defined(_MSC_VER)
#	pragma warning( pop )
#elif defined(__GNUC__)
#	pragma GCC diagnostic pop
#endif

#endif

Commits for Divide-Framework/trunk/Source Code/DivideSever/Utility/Headers/OutputBuffer.h

Diff revisions: vs.
Revision Author Commited Message
331 Diff Diff IonutCava picture IonutCava Sat 06 Dec, 2014 20:53:45 +0000

[Ionut]
- Limited line length to 132 characters to improve readability and diff-comparisons
- Refactored memory allocation/deallocation functions
- Fixed a few compatibility issues with HashMap.h
- Fixed a bug in GPU Skinning shaders (cast a float to int)

318 Diff Diff IonutCava picture IonutCava Sat 30 Aug, 2014 17:35:53 +0000

[Ionut]
- Wrapped the entire code in a “Divide” namespace
- VertexBuffers now call “shrink_to_fit” on all internal data storage
- Improved some vector performance by preferring “emplace_back” instead of “push_back” + proepr usage of reserve / resize
- Wrapped OIS specific types and classes in Divide::Input namespace
- Added the messageBox.layout file (forgot it in the previous few commits)

152 k1ngp1n picture k1ngp1n Thu 20 Jun, 2013 14:23:31 +0000

[Ionut] [[BR]]
- New rendering pipeline (experimental and unstable): [[BR]]
— OpenGL 3.x clean context (glLight commands are still used for now, but UBO support is there, but not used yet) [[BR]]
— Custom matrix stacks and UBO based shader data (UBOs cause some link errors on some nVidia cards)[[BR]]
— Multi-threaded texture loading and shader compilation (mt shader compilation disabled for now. needs more tests) [[BR]]
— VAO rendering is self contained (no more enable/disable calls before a draw request) [[BR]]
— Render instance class used for rendering information [[BR]]
[[BR]]
- New unique ID generation base class: GUIDWrapper. Each class that derives from this, gets an application wide unique id on construction [[BR]]
- Added base code for an in-game editor using CEGUI [[BR]]
- Replaced some mutex locks with lockless data structures or atomic data [[BR]]
- CEGUI 0.8.2, FTGL-GL3 and GLIM 0.4 modified to support GLEW_MX if defined [[BR]]
- Dropped VS2008 support [[BR]]
- Networking library, server framework and ReCast files are now projects inside the Divide Framework solution [[BR]]
- New console command “setFov” that modifies the horizontal FoV value in realtime [[BR]]
- New console command “recompileShader” that reparses shader files, recompiles shaders and relinks shader programs who’s names match or contain the argument string [[BR]]
- New debug utility: axis angle drawn in corner of the screen if needed [[BR]]
- More ‘const’-s pasted around the code, more loop performance tweaks (allocations before a loop, tighter loops, etc), more utility member functions added to various classes [[BR]]