forked from scottcgi/Mojoc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDrawAtlas.h
84 lines (66 loc) · 1.71 KB
/
DrawAtlas.h
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
/*
* Copyright (c) scott.cgi All Rights Reserved.
*
* This source code belongs to project Mojoc, which is a pure C Game Engine hosted on GitHub.
* The Mojoc Game Engine is licensed under the MIT License, and will continue to be iterated with coding passion.
*
* License : https://github.com/scottcgi/Mojoc/blob/master/LICENSE
* GitHub : https://github.com/scottcgi/Mojoc
* CodeStyle: https://github.com/scottcgi/Mojoc/blob/master/Docs/CodeStyle.md
*
* Since : 2017-1-5
* Update : 2019-2-1
* Author : scott.cgi
*/
#ifndef DRAW_ATLAS_H
#define DRAW_ATLAS_H
#include "Engine/Extension/TextureAtlas.h"
#include "Engine/Graphics/OpenGL/Mesh.h"
/**
* Draw with TextureAtlas.
*/
typedef struct
{
/**
* The TextureAtlas that DrawAtlas used.
*/
TextureAtlas* textureAtlas;
/**
* The Mesh that TextureAtlas used.
*/
Mesh mesh[1];
/**
* Quads in texture which are SubMesh of Mesh.
*/
ArrayList(SubMesh*) quadList[1];
}
DrawAtlas;
struct ADrawAtlas
{
/**
* Get DrawAtlas by filePath.
*
* filePath:
* Android: assets
* IOS : NSBundle
*/
DrawAtlas* (*Get) (const char* filePath);
SubMesh* (*GetQuad) (DrawAtlas* drawAtlas, const char* quadName);
/**
* Make drawAtlas can reuse in Get method.
*/
void (*Release) (DrawAtlas* drawAtlas);
/**
* Make quad can reuse in GetQuad method.
*/
void (*ReleaseQuad) (DrawAtlas* drawAtlas, SubMesh* subMesh);
};
extern struct ADrawAtlas ADrawAtlas[1];
/**
* Draw the mesh of atlas.
*/
static inline void ADrawAtlas_Draw(DrawAtlas* drawAtlas)
{
AMesh_Draw(drawAtlas->mesh);
}
#endif