data: forward declarations;

This commit is contained in:
bjorn 2019-04-05 04:27:48 -07:00
parent 0d30448bd0
commit 9e7b9642de
14 changed files with 47 additions and 26 deletions

View File

@ -1,4 +1,5 @@
#include "data/audioStream.h"
#include "data/blob.h"
#include "lib/stb/stb_vorbis.h"
#include "util.h"
#include <stdlib.h>

View File

@ -1,8 +1,9 @@
#include "data/blob.h"
#include "util.h"
#include "types.h"
#pragma once
struct Blob;
typedef struct AudioStream {
Ref ref;
int bitDepth;
@ -12,10 +13,10 @@ typedef struct AudioStream {
int bufferSize;
void* buffer;
void* decoder;
Blob* blob;
struct Blob* blob;
} AudioStream;
AudioStream* lovrAudioStreamInit(AudioStream* stream, Blob* blob, int bufferSize);
AudioStream* lovrAudioStreamInit(AudioStream* stream, struct Blob* blob, int bufferSize);
#define lovrAudioStreamCreate(...) lovrAudioStreamInit(lovrAlloc(AudioStream), __VA_ARGS__)
void lovrAudioStreamDestroy(void* ref);
int lovrAudioStreamDecode(AudioStream* stream, short* destination, int size);

View File

@ -1,4 +1,5 @@
#include "data/blob.h"
#include <stdlib.h>
Blob* lovrBlobInit(Blob* blob, void* data, size_t size, const char* name) {
blob->data = data;

View File

@ -1,9 +1,9 @@
#include "util.h"
#include <stdlib.h>
#include "types.h"
#include <stddef.h>
#pragma once
typedef struct {
typedef struct Blob {
Ref ref;
void* data;
size_t size;

View File

@ -1,4 +1,6 @@
#include "data/modelData.h"
#include "data/blob.h"
#include "data/textureData.h"
ModelData* lovrModelDataInit(ModelData* model, Blob* source) {
if (lovrModelDataInitGltf(model, source)) {

View File

@ -1,11 +1,15 @@
#include "data/blob.h"
#include "data/textureData.h"
#include "types.h"
#include "util.h"
#include <stdint.h>
#include <stdbool.h>
#pragma once
#define MAX_BONES 48
struct TextureData;
struct Blob;
typedef enum {
ATTR_POSITION,
ATTR_NORMAL,
@ -174,9 +178,9 @@ typedef struct {
typedef struct {
Ref ref;
void* data;
Blob** blobs;
struct Blob** blobs;
ModelBuffer* buffers;
TextureData** textures;
struct TextureData** textures;
ModelMaterial* materials;
ModelAttribute* attributes;
ModelPrimitive* primitives;
@ -205,9 +209,9 @@ typedef struct {
int charCount;
} ModelData;
ModelData* lovrModelDataInit(ModelData* model, Blob* blob);
ModelData* lovrModelDataInit(ModelData* model, struct Blob* blob);
#define lovrModelDataCreate(...) lovrModelDataInit(lovrAlloc(ModelData), __VA_ARGS__)
ModelData* lovrModelDataInitGltf(ModelData* model, Blob* blob);
ModelData* lovrModelDataInitObj(ModelData* model, Blob* blob);
ModelData* lovrModelDataInitGltf(ModelData* model, struct Blob* blob);
ModelData* lovrModelDataInitObj(ModelData* model, struct Blob* blob);
void lovrModelDataDestroy(void* ref);
void lovrModelDataAllocate(ModelData* model);

View File

@ -1,4 +1,6 @@
#include "data/modelData.h"
#include "data/blob.h"
#include "data/textureData.h"
#include "filesystem/filesystem.h"
#include "lib/math.h"
#include "lib/jsmn/jsmn.h"

View File

@ -1,4 +1,6 @@
#include "data/modelData.h"
#include "data/blob.h"
#include "data/textureData.h"
#include "filesystem/filesystem.h"
#include "lib/math.h"
#include "lib/map/map.h"

View File

@ -1,8 +1,11 @@
#include "data/rasterizer.h"
#include "data/blob.h"
#include "data/textureData.h"
#include "resources/VarelaRound.ttf.h"
#include "lib/utf.h"
#include "lib/stb/stb_truetype.h"
#include "msdfgen-c.h"
#include <stdlib.h>
#include <math.h>
Rasterizer* lovrRasterizerInit(Rasterizer* rasterizer, Blob* blob, float size) {

View File

@ -1,8 +1,5 @@
#include "data/blob.h"
#include "data/textureData.h"
#include "lib/map/map.h"
#include "types.h"
#include "lib/stb/stb_truetype.h"
#include "util.h"
#include <stdint.h>
#include <stdbool.h>
@ -10,10 +7,13 @@
#define GLYPH_PADDING 1
struct Blob;
struct TextureData;
typedef struct {
Ref ref;
stbtt_fontinfo font;
Blob* blob;
struct Blob* blob;
float size;
float scale;
int glyphCount;
@ -33,12 +33,10 @@ typedef struct {
int dx;
int dy;
int advance;
TextureData* data;
struct TextureData* data;
} Glyph;
typedef map_t(Glyph) map_glyph_t;
Rasterizer* lovrRasterizerInit(Rasterizer* rasterizer, Blob* blob, float size);
Rasterizer* lovrRasterizerInit(Rasterizer* rasterizer, struct Blob* blob, float size);
#define lovrRasterizerCreate(...) lovrRasterizerInit(lovrAlloc(Rasterizer), __VA_ARGS__)
void lovrRasterizerDestroy(void* ref);
bool lovrRasterizerHasGlyph(Rasterizer* fontData, uint32_t character);

View File

@ -1,6 +1,9 @@
#include "data/soundData.h"
#include "data/audioStream.h"
#include "util.h"
#include "lib/stb/stb_vorbis.h"
#include <limits.h>
#include <stdlib.h>
SoundData* lovrSoundDataInit(SoundData* soundData, int samples, int sampleRate, int bitDepth, int channelCount) {
soundData->samples = samples;

View File

@ -1,8 +1,9 @@
#include "data/blob.h"
#include "data/audioStream.h"
#pragma once
struct AudioStream;
typedef struct SoundData {
Blob blob;
int channelCount;
@ -12,7 +13,7 @@ typedef struct SoundData {
} SoundData;
SoundData* lovrSoundDataInit(SoundData* soundData, int samples, int sampleRate, int bitDepth, int channels);
SoundData* lovrSoundDataInitFromAudioStream(SoundData* soundData, AudioStream* audioStream);
SoundData* lovrSoundDataInitFromAudioStream(SoundData* soundData, struct AudioStream* audioStream);
SoundData* lovrSoundDataInitFromBlob(SoundData* soundData, Blob* blob);
#define lovrSoundDataCreate(...) lovrSoundDataInit(lovrAlloc(SoundData), __VA_ARGS__)
#define lovrSoundDataCreateFromAudioStream(...) lovrSoundDataInitFromAudioStream(lovrAlloc(SoundData), __VA_ARGS__)

View File

@ -1,4 +1,5 @@
#include "data/blob.h"
#include "types.h"
#include "util.h"
#include "lib/vec/vec.h"
#include <stdint.h>
@ -36,7 +37,7 @@ typedef struct {
typedef vec_t(Mipmap) vec_mipmap_t;
typedef struct {
typedef struct TextureData {
Blob blob;
int width;
int height;

View File

@ -7,6 +7,8 @@
#pragma once
typedef map_t(Glyph) map_glyph_t;
typedef enum {
ALIGN_LEFT,
ALIGN_CENTER,