Conquer Space 0.0.0
A space themed grand strategy game set in the near future, with realistic orbital mechanics, and an emphasis on economics and politics.
Classes | Typedefs | Enumerations | Functions
cqsp::asset Namespace Reference

Classes

class  ALAudioAsset
 
class  Asset
 The base class for assets. More...
 
class  AssetLoader
 
class  AssetManager
 
class  AssetPrototype
 
class  AudioAsset
 
class  BinaryAsset
 
struct  Character
 
class  CubemapPrototype
 
class  Font
 
class  FontPrototype
 
class  HjsonAsset
 
class  ImagePrototype
 
class  IOStream
 
class  IOSystem
 
class  IVirtualDirectory
 Meant to list all the files and sub files in the directory. This is sort of a replacement for directory iterator. If you want to cd a directory, just access it from the initial file system, I guess. More...
 
class  IVirtualFile
 
class  IVirtualFileSystem
 The main functionality for this is to read files, so writing to files will not really be supported. More...
 
struct  Material
 
struct  MaterialPrototype
 
struct  MaterialTextureStack
 
struct  MeshPrototype
 
struct  Model
 
struct  ModelLoader
 
struct  ModelMesh
 
struct  ModelPrototype
 
struct  ModelTexturePrototype
 
class  NativeDirectory
 
class  NativeFile
 
class  NativeFileSystem
 
class  Package
 
class  PackagePrototype
 
class  PathedTextAsset
 Text asset which remembers what it's path is. More...
 
class  QueueHolder
 
class  Shader
 
class  ShaderDefinition
 
class  ShaderProgram
 A shader program. More...
 
class  ShaderPrototype
 
class  TextAsset
 
class  TextDirectoryAsset
 Asset to store a directory of text files, and remembers the path of the assets. More...
 
class  Texture
 
struct  TextureLoadingOptions
 
class  ThreadsafeQueue
 
struct  Vertex
 
class  VirtualMounter
 

Typedefs

typedef std::shared_ptr< IVirtualFileIVirtualFilePtr
 
typedef std::shared_ptr< IVirtualDirectoryIVirtualDirectoryPtr
 
typedef std::shared_ptr< ModelMeshModelMesh_t
 
typedef std::shared_ptr< ShaderProgramShaderProgram_t
 The preferred way of using a shader program. More...
 

Enumerations

enum class  AssetType {
  NONE , TEXTURE , SHADER , HJSON ,
  TEXT , MODEL , FONT , CUBEMAP ,
  TEXT_ARRAY , AUDIO , SHADER_DEFINITION , SCRIPT ,
  BINARY
}
 
enum  PrototypeType {
  NONE = 0 , NONE , TEXTURE , TEXTURE ,
  SHADER , SHADER , FONT , FONT ,
  CUBEMAP , CUBEMAP , MODEL , MODEL
}
 
enum  FileModes { Text = 0 , Binary = 1 << 0 }
 
enum class  Offset { Beg , End , Cur }
 
enum class  ShaderType { NONE , VERT , FRAG , GEOM }
 

Functions

AssetType FromString (const std::string &name)
 Converts asset type names to asset types More...
 
std::string ToString (AssetType type)
 Converts asset type to asset type names for display More...
 
std::string GetShaderCode (const std::string &identifier)
 
void MakeShader (const Hjson::Value &hjson)
 
void GenerateMesh (engine::Mesh &mesh, std::vector< Vertex > vertices, std::vector< unsigned int > indices)
 
void LoadModelPrototype (ModelPrototype *prototype, Model *asset)
 
void LoadModelData (engine::Mesh *mesh, std::vector< Vertex > &vertices, std::vector< unsigned int > &indices)
 
std::vector< uint8_t > ReadAllFromVFile (IVirtualFile *)
 Reads all the data from the virtual file. More...
 
std::string ReadAllFromVFileToString (IVirtualFile *file)
 Don't really want this, but ah well, it cannot be helped. More...
 
std::string GetFilename (const std::string &path)
 Gets filename from path. More...
 
std::string GetParentPath (const std::string &path)
 
std::unique_ptr< AudioAssetLoadOgg (std::ifstream &input)
 
std::unique_ptr< AudioAssetLoadOgg (uint8_t *buffer, int size)
 
ShaderProgram_t MakeShaderProgram (Shader &vert, Shader &frag)
 Helper function to create a shader program. More...
 
ShaderProgram_t MakeShaderProgram (Shader &vert, Shader &frag, Shader &geom)
 Helper function to create a shader program with a geometry shader. More...
 
unsigned int LoadShaderData (const std::string &code, int type)
 
unsigned int MakeShaderProgram (int vertex, int fragment, int geometry=-1)
 
std::string GetErrorLog (unsigned int shader)
 Get the issues of the shader, up to 1024 characters of it. More...
 
void LoadFontData (Font &font, unsigned char *fontBuffer, uint64_t size)
 
void RenderText (cqsp::asset::ShaderProgram &shader, Font &font, std::string text, float x, float y, float scale, glm::vec3 color)
 
unsigned int CreateTexture (unsigned char *data, int width, int height, int components, const TextureLoadingOptions &options)
 
void CreateTexture (Texture &texture, unsigned char *data, int width, int height, int components, const TextureLoadingOptions &options=TextureLoadingOptions())
 
void LoadCubemapData (Texture &texture, std::vector< unsigned char * > &faces, int width, int height, int components, TextureLoadingOptions &options)
 
bool SaveImage (const char *path, int width, int height, int components, const unsigned char *data, bool flip=true)
 

Typedef Documentation

◆ IVirtualDirectoryPtr

◆ IVirtualFilePtr

typedef std::shared_ptr<IVirtualFile> cqsp::asset::IVirtualFilePtr

◆ ModelMesh_t

typedef std::shared_ptr<ModelMesh> cqsp::asset::ModelMesh_t

◆ ShaderProgram_t

typedef std::shared_ptr<ShaderProgram> cqsp::asset::ShaderProgram_t

The preferred way of using a shader program.

Enumeration Type Documentation

◆ AssetType

enum class cqsp::asset::AssetType
strong
Enumerator
NONE 
TEXTURE 

texture as the type parameter in resource.hjson

See also
cqsp::asset::AssetLoader::LoadTexture for implementation
SHADER 

shader as the type parameter in resource.hjson

See also
cqsp::asset::AssetLoader::LoadShader for implementation
HJSON 

hjson as the type parameter in resource.hjson

See also
cqsp::asset::AssetLoader::LoadHjson for implementation
TEXT 

text as the type parameter in resource.hjson

See also
cqsp::asset::AssetLoader::LoadText for implementation
MODEL 

Not supported yet.

FONT 

cubemap as the type parameter in resource.hjson

See also
cqsp::asset::AssetLoader::LoadFont for implementation
CUBEMAP 

cubemap as the type parameter in resource.hjson

See also
cqsp::asset::AssetLoader::LoadCubemap for implementation
TEXT_ARRAY 
See also
cqsp::asset::AssetLoader::LoadTextDirectory for implementation
AUDIO 

audio as the type parameter in resource.hjson

See also
cqsp::asset::AssetLoader::LoadAudio for implementation
SHADER_DEFINITION 

shader_def as the type parameter in resource.hjson

See also
cqsp::asset::AssetLoader::LoadShaderDefinition for implementation
SCRIPT 
BINARY 

◆ FileModes

Enumerator
Text 
Binary 

◆ Offset

enum class cqsp::asset::Offset
strong
Enumerator
Beg 
End 
Cur 

◆ PrototypeType

Enumerator
NONE 
NONE 
TEXTURE 

texture prototype

TEXTURE 

texture as the type parameter in resource.hjson

See also
cqsp::asset::AssetLoader::LoadTexture for implementation
SHADER 

shader prototype

SHADER 

shader as the type parameter in resource.hjson

See also
cqsp::asset::AssetLoader::LoadShader for implementation
FONT 

Font prototype.

FONT 

cubemap as the type parameter in resource.hjson

See also
cqsp::asset::AssetLoader::LoadFont for implementation
CUBEMAP 

cubemap prototype

CUBEMAP 

cubemap as the type parameter in resource.hjson

See also
cqsp::asset::AssetLoader::LoadCubemap for implementation
MODEL 

Model prototype.

MODEL 

Not supported yet.

◆ ShaderType

enum class cqsp::asset::ShaderType
strong
Enumerator
NONE 

Invalid shader.

VERT 

Vertex shader.

FRAG 

Fragment shader.

GEOM 

Geometry shader.

Function Documentation

◆ CreateTexture() [1/2]

void cqsp::asset::CreateTexture ( Texture texture,
unsigned char *  data,
int  width,
int  height,
int  components,
const TextureLoadingOptions options = TextureLoadingOptions() 
)

◆ CreateTexture() [2/2]

unsigned int cqsp::asset::CreateTexture ( unsigned char *  data,
int  width,
int  height,
int  components,
const TextureLoadingOptions options 
)

◆ FromString()

AssetType cqsp::asset::FromString ( const std::string &  name)
inline

Converts asset type names to asset types

Parameters
name
Returns

◆ GenerateMesh()

void cqsp::asset::GenerateMesh ( engine::Mesh mesh,
std::vector< Vertex vertices,
std::vector< unsigned int >  indices 
)

◆ GetErrorLog()

std::string cqsp::asset::GetErrorLog ( unsigned int  shader)

Get the issues of the shader, up to 1024 characters of it.

Parameters
shadershader id
Returns
the error text of the shader

◆ GetFilename()

std::string cqsp::asset::GetFilename ( const std::string &  path)
inline

Gets filename from path.

Parameters
path
Returns

◆ GetParentPath()

std::string cqsp::asset::GetParentPath ( const std::string &  path)
inline

◆ GetShaderCode()

std::string cqsp::asset::GetShaderCode ( const std::string &  identifier)

◆ LoadCubemapData()

void cqsp::asset::LoadCubemapData ( Texture texture,
std::vector< unsigned char * > &  faces,
int  width,
int  height,
int  components,
TextureLoadingOptions options 
)

◆ LoadFontData()

void cqsp::asset::LoadFontData ( Font font,
unsigned char *  fontBuffer,
uint64_t  size 
)

◆ LoadModelData()

void cqsp::asset::LoadModelData ( engine::Mesh mesh,
std::vector< Vertex > &  vertices,
std::vector< unsigned int > &  indices 
)

◆ LoadModelPrototype()

void cqsp::asset::LoadModelPrototype ( ModelPrototype prototype,
Model asset 
)

◆ LoadOgg() [1/2]

std::unique_ptr< AudioAsset > cqsp::asset::LoadOgg ( std::ifstream &  input)

◆ LoadOgg() [2/2]

std::unique_ptr< AudioAsset > cqsp::asset::LoadOgg ( uint8_t *  buffer,
int  size 
)

◆ LoadShaderData()

unsigned int cqsp::asset::LoadShaderData ( const std::string &  code,
int  type 
)

◆ MakeShader()

void cqsp::asset::MakeShader ( const Hjson::Value &  hjson)

◆ MakeShaderProgram() [1/3]

unsigned int cqsp::asset::MakeShaderProgram ( int  vertex,
int  fragment,
int  geometry = -1 
)

◆ MakeShaderProgram() [2/3]

ShaderProgram_t cqsp::asset::MakeShaderProgram ( Shader vert,
Shader frag 
)
inline

Helper function to create a shader program.

◆ MakeShaderProgram() [3/3]

ShaderProgram_t cqsp::asset::MakeShaderProgram ( Shader vert,
Shader frag,
Shader geom 
)
inline

Helper function to create a shader program with a geometry shader.

◆ ReadAllFromVFile()

std::vector< uint8_t > cqsp::asset::ReadAllFromVFile ( IVirtualFile )

Reads all the data from the virtual file.

Returns

◆ ReadAllFromVFileToString()

std::string cqsp::asset::ReadAllFromVFileToString ( IVirtualFile file)

Don't really want this, but ah well, it cannot be helped.

◆ RenderText()

void cqsp::asset::RenderText ( cqsp::asset::ShaderProgram shader,
Font font,
std::string  text,
float  x,
float  y,
float  scale,
glm::vec3  color 
)

◆ SaveImage()

bool cqsp::asset::SaveImage ( const char *  path,
int  width,
int  height,
int  components,
const unsigned char *  data,
bool  flip = true 
)

◆ ToString()

std::string cqsp::asset::ToString ( AssetType  type)
inline

Converts asset type to asset type names for display

Parameters
name
Returns