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
#include "Headers/ResourceDescriptor.h"

#include "Core/Math/Headers/MathHelper.h"

namespace Divide {


size_t PropertyDescriptor::getHash() const {
    size_t hash = 0;
    Util::Hash_combine(hash, to_uint(_type));
    return hash;
}

ResourceDescriptor::ResourceDescriptor(const stringImpl& resourceName)
    : _propertyDescriptor(nullptr),
      _name(resourceName),
      _flag(false),
      _ID(0),
      _enumValue(0),
      _userPtr(nullptr)
{
    _mask.i = 0;
    _threaded = true;
}

ResourceDescriptor::~ResourceDescriptor()
{
}

ResourceDescriptor::ResourceDescriptor(const ResourceDescriptor& old)
    : _propertyDescriptor(nullptr)
{
      _name = old._name;
      _resourceName = old._resourceName;
      _resourceLocation = old._resourceLocation;
      _properties = old._properties;
      _flag = old._flag;
      _threaded = old._threaded;
      _ID = old._ID;
      _mask = old._mask;
      _enumValue = old._enumValue;
      _userPtr = old._userPtr;
      _onLoadCallback = old._onLoadCallback;
      _propertyDescriptor.reset(old._propertyDescriptor ? old._propertyDescriptor->clone() : nullptr);
}

ResourceDescriptor& ResourceDescriptor::operator=(ResourceDescriptor const& old) {
    if (this != &old) {
        _name = old._name;
        _resourceName = old._resourceName;
        _resourceLocation = old._resourceLocation;
        _properties = old._properties;
        _flag = old._flag;
        _threaded = old._threaded;
        _ID = old._ID;
        _mask = old._mask;
        _enumValue = old._enumValue;
        _userPtr = old._userPtr;
        _onLoadCallback = old._onLoadCallback;
        _propertyDescriptor.reset(old._propertyDescriptor ? old._propertyDescriptor->clone() : nullptr);
    }

    return *this;
}

ResourceDescriptor::ResourceDescriptor(ResourceDescriptor&& old) noexcept 
    :  _name(std::move(old._name)),
       _resourceName(std::move(old._resourceName)),
       _resourceLocation(std::move(old._resourceLocation)),
       _properties(std::move(old._properties)),
       _flag(std::move(old._flag)),
       _threaded(std::move(old._threaded)),
       _ID(std::move(old._ID)),
       _mask(std::move(old._mask)),
       _enumValue(std::move(old._enumValue)),
       _userPtr(std::move(old._userPtr)),
       _onLoadCallback(std::move(old._onLoadCallback)),
       _propertyDescriptor(std::move(old._propertyDescriptor))
{
    old._propertyDescriptor = nullptr;
}

size_t ResourceDescriptor::getHash() const {
    size_t hash = 0;
    Util::Hash_combine(hash, _name);
    Util::Hash_combine(hash, _resourceName);
    Util::Hash_combine(hash, _resourceLocation);
    Util::Hash_combine(hash, _properties);
    Util::Hash_combine(hash, _flag);
    //Util::Hash_combine(hash, _threaded); //Loading specific
    Util::Hash_combine(hash, _ID);
    Util::Hash_combine(hash, _mask.i);
    Util::Hash_combine(hash, _enumValue);
    //Util::Hash_combine(hash, _userPtr); //Loading specific
    //Util::Hash_combine(hash, _onLoadCallback); //Loading specific
    if (_propertyDescriptor) {
        Util::Hash_combine(hash, _propertyDescriptor->getHash());
    }

    return hash;
}

};

Commits for Divide-Framework/trunk/Source Code/Core/Resources/ResourceDescriptor.cpp

Diff revisions: vs.
Revision Author Commited Message
863 Diff Diff IonutCava picture IonutCava Wed 15 Feb, 2017 16:27:26 +0000

[IonutCava]
- Split Resource class into Resource and CachedResource
— CachedResource is the only resource held in a ResourceCache and loaded from a ResourceDescriptor
— CachedResource is mapped by its creation descriptor’s hash value, instead of the resource name
-— Multiple cached resources can now exist with the same name if the have different properties, for example.

859 Diff Diff IonutCava picture IonutCava Mon 13 Feb, 2017 17:18:06 +0000

[IonutCava]
- Multi-threaded mesh load
- ByteBuffer fixes and unit test

858 Diff Diff IonutCava picture IonutCava Sun 12 Feb, 2017 20:55:05 +0000

[IonutCava]
- More resource loading updates

856 Diff Diff IonutCava picture IonutCava Fri 10 Feb, 2017 17:19:06 +0000

[IonutCava]
- Attempt to improve resource creation mechanism by adding a callback for when the resource finishes loading
— This is useful for multi-threaded loading: shaders, textures, terrain, etc

829 Diff Diff IonutCava picture IonutCava Tue 24 Jan, 2017 17:28:39 +0000

[IonutCava]
- Separate resourceLocation for resources into resourceLocation and resourceName.
- More XML config loading refactoring

706 Diff Diff IonutCava picture IonutCava Fri 13 May, 2016 16:29:40 +0000

[IonutCava]
- Renamed LightManager to LightPool and changed it from a Singleton to a scene specific pointer
- More scene load / unload updates (changing scenes now works properly!)
- Allowed GUI interface to hold per-scene elements and only render relevant ones
- Reduced dependencies between nodes, scenemanager, scene, loaders and kernel
- Removed Reflector base class as it was useless and integrate Water class with the Reflection system already in place
- Extended RenderingComponent’s reflection system to allow refraction as well

365 Diff Diff IonutCava picture IonutCava Sun 08 Mar, 2015 21:26:10 +0000

[Ionut]
- More enum-related type safety changes

358 Diff Diff IonutCava picture IonutCava Sun 01 Mar, 2015 22:44:38 +0000

[Ionut]
- Fixed some OpenGL initialization issues and function calls (no proper support for DSA yet)
- Cleanup up the Sound and Physics Wrappers
- Some readability improvements here and there

350 Diff Diff IonutCava picture IonutCava Tue 10 Feb, 2015 16:25:39 +0000

[Ionut]
- Simplified some Util-namespace level functions by using STL algorithms where possible
- Formatted the entire codebase using clang-format with the following style: "{BasedOnStyle: Google, IndentWidth: 4}"
- Attempted to make ProfileTimer thread-safe (temp fix until std::chrono works properly in Visual Studio)

337 IonutCava picture IonutCava Wed 17 Dec, 2014 17:25:16 +0000

[Ionut]
- Replaced all tabs with 4 spaces (some spacing may be off now. no way to check all the files.)
- Moved implementation details for ParamHandler, BoundingBox, BoundingSphere and ProfileTimer to proper .inl and .cpp files. (more to follow)
- Update all forward declared enums with the required storage type (as requested by the C++11 standard)