Skip to content

Commit 3f0ea0d

Browse files
committed
new kit, content-breaking changes (sorry!)
1 parent 887d219 commit 3f0ea0d

40 files changed

+292
-138
lines changed

Qor/BasicState.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class BasicState:
3535
Qor* m_pQor = nullptr;
3636
Input* m_pInput = nullptr;
3737
Pipeline* m_pPipeline = nullptr;
38-
Cache<Resource, std::string>* m_pResources = nullptr;
38+
ResourceCache* m_pResources = nullptr;
3939

4040
std::shared_ptr<Node> m_pRoot;
4141
std::shared_ptr<Node> m_pRTTRoot;

Qor/Camera.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ using namespace std;
55
using namespace glm;
66

77
Camera :: Camera(const std::string& fn, IFactory* factory, ICache* cache):
8-
m_pResources((Cache<Resource, std::string>*)cache)
8+
m_pResources((ResourceCache*)cache)
99
{
1010
init();
1111
}

Qor/Camera.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include "kit/freq/animation.h"
77
#include "kit/factory/factory.h"
88
#include "kit/cache/cache.h"
9+
#include "ResourceCache.h"
910
#include <boost/signals2.hpp>
1011
#include "Audio.h"
1112
#include "kit/log/log.h"
@@ -30,7 +31,7 @@ class Camera:
3031
}
3132

3233
//Camera() {init();}
33-
Camera(Cache<Resource, std::string>* cache, Window* w):
34+
Camera(ResourceCache* cache, Window* w):
3435
m_pResources(cache)
3536
{
3637
init();
@@ -159,7 +160,7 @@ class Camera:
159160
Audio::Listener m_Listener;
160161
#endif
161162

162-
Cache<Resource, std::string>* m_pResources;
163+
ResourceCache* m_pResources;
163164

164165
boost::signals2::scoped_connection m_VolumeCon;
165166
};

Qor/Console.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ using namespace std;
44

55
#ifndef QOR_NO_CAIRO
66

7-
Console :: Console(Interpreter* interp, Window* window, Input* input, Cache<Resource,std::string>* cache, int lines):
7+
Console :: Console(Interpreter* interp, Window* window, Input* input, ResourceCache* cache, int lines):
88
m_pWindow(window),
99
m_pInput(input),
1010
m_pCache(cache),

Qor/Console.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class Console:
1818
Interpreter* interp,
1919
Window* window,
2020
Input* input,
21-
Cache<Resource,std::string>* cache,
21+
ResourceCache* cache,
2222
int lines = 5
2323
);
2424
virtual ~Console() {}
@@ -68,7 +68,7 @@ class Console:
6868
Input* m_pInput = nullptr;
6969
//std::shared_ptr<Canvas> m_pCanvas;
7070
std::shared_ptr<Canvas> m_pTextCanvas;
71-
Cache<Resource, std::string>* m_pCache;
71+
ResourceCache* m_pCache;
7272
Pango::FontDescription m_FontDesc;
7373

7474
bool m_bInput = false;

Qor/GLTask.h

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,6 @@
44
#include "TaskHandler.h"
55
#include <memory>
66

7-
//#define GL_TASK(NAME, CODE) {\
8-
// if(TaskHandler::get()->is_handler())\
9-
// {\
10-
// CODE\
11-
// }\
12-
// else\
13-
// {\
14-
// auto _task = [&]{\
15-
// CODE\
16-
// };\
17-
// TaskHandler::get()->add_task(_task);\
18-
// }\
19-
//}
20-
217
#define GL_TASK_ASYNC_START() {\
228
auto task = [=]{\
239

@@ -42,5 +28,11 @@
4228
}\
4329
}
4430

31+
#define GL_REGION_START() \
32+
[=]{\
33+
34+
#define GL_REGION_END() \
35+
};\
36+
4537
#endif
4638

Qor/Interpreter.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
#include <cmath>
22
#include <math.h>
33
#include "Interpreter.h"
4-
#ifndef QOR_NO_PYTHON
5-
#include "PythonBindings.h"
6-
#endif
4+
#include "bindings/PythonBindings.h"
75
using namespace std;
86

97
std::vector<Interpreter :: Context*> Interpreter :: s_Current;

Qor/Material.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Material :: Material()
2626

2727
Material :: Material(
2828
const std::string& fn,
29-
Cache<Resource, std::string>* cache
29+
ResourceCache* cache
3030
):
3131
ITexture(fn),
3232
m_Filename(fn),
@@ -256,7 +256,7 @@ void Material :: bind(Pass* pass, unsigned slot) const
256256

257257
/*static*/ bool Material :: supported(
258258
string fn,
259-
Cache<Resource, std::string>* cache
259+
ResourceCache* cache
260260
){
261261
string fn_real = Filesystem::cutInternal(Filesystem::getFileName(fn));
262262
string ext = Filesystem::getExtension(fn_real);

Qor/Material.h

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
#include <vector>
55
#include "Texture.h"
6-
#include "kit/cache/cache.h"
6+
#include "ResourceCache.h"
77
#include "kit/reactive/reactive.h"
88
#include "Graphics.h"
99

@@ -15,12 +15,12 @@ class Material:
1515
Material();
1616
Material(
1717
const std::string& fn,
18-
Cache<Resource, std::string>* cache = nullptr
18+
ResourceCache* cache = nullptr
1919
);
2020
Material(const std::tuple<std::string, ICache*>& args):
2121
Material(
2222
std::get<0>(args),
23-
(Cache<Resource, std::string>*) std::get<1>(args)
23+
(ResourceCache*) std::get<1>(args)
2424
)
2525
{}
2626
virtual ~Material();
@@ -30,7 +30,7 @@ class Material:
3030

3131
static bool supported(
3232
std::string fn,
33-
Cache<Resource, std::string>* cache
33+
ResourceCache* cache
3434
);
3535

3636
enum ExtraMap {
@@ -71,13 +71,15 @@ class Material:
7171

7272
private:
7373

74+
#ifndef SWIG
7475
const static std::vector<std::string> s_ExtraMapNames;
76+
#endif
7577

7678
void load_json(std::string fn);
7779
void load_mtllib(std::string fn, std::string emb);
7880
void load_detail_maps(std::string fn);
7981

80-
Cache<Resource, std::string>* m_pCache = nullptr;
82+
ResourceCache* m_pCache = nullptr;
8183

8284
std::string m_Filename;
8385
std::string m_Name;

Qor/Menu.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ MenuGUI :: MenuGUI(
3333
IPartitioner* partitioner,
3434
Window* window,
3535
//Canvas* canvas,
36-
Cache<Resource, std::string>* cache,
36+
ResourceCache* cache,
3737
std::string font,
3838
float font_size,
3939
float* fade,

Qor/Menu.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ class MenuGUI:
195195
IPartitioner* partitioner,
196196
Window* window,
197197
//Canvas* canvas,
198-
Cache<Resource, std::string>* cache,
198+
ResourceCache* cache,
199199
std::string m_Font,
200200
float font_size,
201201
float* fade,
@@ -245,7 +245,7 @@ class MenuGUI:
245245
Menu* m_pMenu;
246246
IPartitioner* m_pPartitioner;
247247
//Canvas* m_pCanvas;
248-
Cache<Resource, std::string>* m_pCache;
248+
ResourceCache* m_pCache;
249249
float* m_pFade;
250250
std::string m_Font;
251251
bool m_bPause = false;

Qor/Mesh.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,7 @@ struct vertcmp
588588

589589
Mesh::Data :: Data(
590590
string fn,
591-
Cache<Resource, string>* cache
591+
ResourceCache* cache
592592
):
593593
Resource(fn),
594594
cache(cache)
@@ -1044,7 +1044,7 @@ void Mesh::Data :: load_obj(string fn, string this_object, string this_material)
10441044
// );
10451045
}
10461046

1047-
vector<string> Mesh :: Data :: decompose(string fn, Cache<Resource, string>* cache)
1047+
vector<string> Mesh :: Data :: decompose(string fn, ResourceCache* cache)
10481048
{
10491049
//LOGf("decompose %s", fn);
10501050
vector<string> units;
@@ -1194,7 +1194,7 @@ void Mesh :: Data :: calculate_box()
11941194
//LOGf("box: %s", string(box));
11951195
}
11961196

1197-
Mesh :: Mesh(aiMesh* mesh, Cache<Resource, string>* cache, vector<shared_ptr<MeshMaterial>>& materials):
1197+
Mesh :: Mesh(aiMesh* mesh, ResourceCache* cache, vector<shared_ptr<MeshMaterial>>& materials):
11981198
Node((std::string)mesh->mName.data), // OSX complains w/o cast
11991199
m_pCache(cache)
12001200
{
@@ -1267,7 +1267,7 @@ Mesh :: Mesh(aiMesh* mesh, Cache<Resource, string>* cache, vector<shared_ptr<Mes
12671267
material(materials.at(mesh->mMaterialIndex));
12681268
}
12691269

1270-
Mesh :: Mesh(string fn, Cache<Resource, string>* cache):
1270+
Mesh :: Mesh(string fn, ResourceCache* cache):
12711271
Node(fn),
12721272
m_pCache(cache)
12731273
{
@@ -1279,7 +1279,7 @@ Mesh :: Mesh(string fn, Cache<Resource, string>* cache):
12791279
}
12801280
else
12811281
{
1282-
//Cache<Resource, string>* resources = ();
1282+
//ResourceCache* resources = ();
12831283
//if(Filesystem::hasExtension(fn, "json"))
12841284
//{
12851285
// //if(config->at("composite", false) == true)
@@ -1797,7 +1797,7 @@ void Mesh :: impulse(glm::vec3 imp)
17971797
#endif
17981798
}
17991799

1800-
void Mesh :: material(std::string fn, Cache<Resource, std::string>* cache)
1800+
void Mesh :: material(std::string fn, ResourceCache* cache)
18011801
{
18021802
if(not m_pCompositor || m_pCompositor != this)
18031803
m_pData->material = std::make_shared<MeshMaterial>(
@@ -1812,7 +1812,7 @@ void Mesh :: material(std::string fn, Cache<Resource, std::string>* cache)
18121812

18131813
}
18141814

1815-
void Mesh :: swap_material(std::string from, std::string to, Cache<Resource, std::string>* cache)
1815+
void Mesh :: swap_material(std::string from, std::string to, ResourceCache* cache)
18161816
{
18171817
if(not m_pCompositor || m_pCompositor != this)
18181818
{
@@ -1884,7 +1884,7 @@ std::shared_ptr<Mesh> Mesh :: line(glm::vec3 start, glm::vec3 end, shared_ptr<Te
18841884

18851885
std::shared_ptr<Mesh> Mesh :: quad(
18861886
string fn,
1887-
Cache<Resource, std::string>* cache,
1887+
ResourceCache* cache,
18881888
vec2 size,
18891889
vec3 pos,
18901890
vec2 origin

Qor/Mesh.h

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
#include <vector>
55
#include <memory>
6+
#include "ResourceCache.h"
67
#include "kit/math/common.h"
78
#include "IRenderable.h"
89
#include "Common.h"
@@ -209,7 +210,7 @@ class MeshMaterial
209210
m_pTexture(tex)
210211
{}
211212
explicit MeshMaterial(
212-
const std::string& fn, Cache<Resource, std::string>* res
213+
const std::string& fn, ResourceCache* res
213214
):
214215
MeshMaterial(res->cache_cast<ITexture>(fn))
215216
{}
@@ -522,11 +523,11 @@ class Mesh:
522523
Data(Data&&) = default;
523524
Data& operator=(const Data&) = default;
524525
Data& operator=(Data&&) = default;
525-
Data(std::string fn, Cache<Resource, std::string>* cache);
526+
Data(std::string fn, ResourceCache* cache);
526527
Data(std::tuple<std::string, ICache*> args):
527528
Data(
528529
std::get<0>(args),
529-
(Cache<Resource, std::string>*) std::get<1>(args)
530+
(ResourceCache*) std::get<1>(args)
530531
)
531532
{}
532533
virtual ~Data() {}
@@ -549,7 +550,7 @@ class Mesh:
549550

550551
static std::vector<std::string> decompose(
551552
std::string fn,
552-
Cache<Resource, std::string>*
553+
ResourceCache*
553554
);
554555

555556
Box box;
@@ -558,7 +559,7 @@ class Mesh:
558559
std::vector<std::shared_ptr<IMeshModifier>> mods;
559560
std::shared_ptr<MeshMaterial> material;
560561
//std::string filename; // stored in Resource
561-
Cache<Resource, std::string>* cache = nullptr;
562+
ResourceCache* cache = nullptr;
562563
unsigned int vertex_array = 0;
563564

564565
void calculate_tangents();
@@ -577,12 +578,12 @@ class Mesh:
577578
//>& args):
578579
// Mesh(
579580
// std::get<0>(args),
580-
// (Cache<Resource, std::string>*)&std::get<1>(args)
581+
// (ResourceCache*)&std::get<1>(args)
581582
// )
582583
//{}
583-
Mesh(std::string fn, Cache<Resource, std::string>* cache);
584+
Mesh(std::string fn, ResourceCache* cache);
584585
Mesh(const std::tuple<std::string, ICache*>& args):
585-
Mesh(std::get<0>(args), (Cache<Resource, std::string>*)std::get<1>(args))
586+
Mesh(std::get<0>(args), (ResourceCache*)std::get<1>(args))
586587
{}
587588
Mesh(std::shared_ptr<Data> internals):
588589
m_pData(internals)
@@ -615,7 +616,7 @@ class Mesh:
615616
}
616617
Mesh(
617618
aiMesh* mesh,
618-
Cache<Resource, std::string>* cache,
619+
ResourceCache* cache,
619620
std::vector<std::shared_ptr<MeshMaterial>>& materials
620621
);
621622
void update();
@@ -665,9 +666,9 @@ class Mesh:
665666
m_pData->mods.push_back(mod);
666667
}
667668

668-
void swap_material(std::string from, std::string to, Cache<Resource, std::string>* cache);
669-
void material(std::string fn, Cache<Resource, std::string>* cache);
670-
void skin(std::string fn, Cache<Resource, std::string>* cache);
669+
void swap_material(std::string from, std::string to, ResourceCache* cache);
670+
void material(std::string fn, ResourceCache* cache);
671+
void skin(std::string fn, ResourceCache* cache);
671672

672673
void material(std::shared_ptr<MeshMaterial> mat) {
673674
m_pData->material = mat;
@@ -910,7 +911,7 @@ class Mesh:
910911

911912
static std::shared_ptr<Mesh> quad(
912913
std::string fn,
913-
Cache<Resource, std::string>* cache,
914+
ResourceCache* cache,
914915
glm::vec2 s = glm::vec2(1.0f),
915916
glm::vec3 pos = glm::vec3(0.0f),
916917
glm::vec2 origin = glm::vec2(0.0f) // 0=left,0.5=center,1=right,etc.
@@ -924,7 +925,7 @@ class Mesh:
924925
// if m_pCompositor == this, this mesh is a composite
925926
// if anything else, this mesh was loaded by another
926927
Mesh* m_pCompositor = nullptr;
927-
Cache<Resource, std::string>* m_pCache = nullptr;
928+
ResourceCache* m_pCache = nullptr;
928929

929930
#ifndef QOR_NO_PHYSICS
930931
Node::Physics m_Physics = Node::NO_PHYSICS;

0 commit comments

Comments
 (0)