init dynpip bag

This commit is contained in:
h4570
2022-07-18 23:16:47 +02:00
parent efdec2c52e
commit 0953ce3f19
33 changed files with 321 additions and 80 deletions
@@ -0,0 +1,56 @@
/*
# ______ ____ ___
# | \/ ____| |___|
# | | | \ | |
#-----------------------------------------------------------------------
# Copyright 2022, tyra - https://github.com/h4570/tyra
# Licenced under Apache License 2.0
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
*/
#pragma once
#include "math/vec4.hpp"
#include "renderer/3d/pipeline/shared/bag/pipeline_lighting_bag.hpp"
#include "renderer/3d/pipeline/shared/bag/pipeline_info_bag.hpp"
#include "./dynpip_color_bag.hpp"
#include "./dynpip_texture_bag.hpp"
#include "renderer/core/texture/models/texture.hpp"
namespace Tyra {
/**
* @brief 3D Animated render data bag.
* Supports frustum culling, simple clipping (culling), lighting,
* texture and single color / many colors.
*/
class DynPipBag {
public:
DynPipBag();
~DynPipBag();
/** Mandatory. Object info. */
PipelineInfoBag* info;
/** Mandatory. Object color(s). */
DynPipColorBag* color;
/** Mandatory. Vertex count. */
u32 count;
/** Mandatory. Vertices. */
Vec4* vertices;
/** Optional. Texture coordinates and image. */
DynPipTextureBag* texture;
/** Optional. Object lighting. */
PipelineLightingBag* lighting;
void print() const;
void print(const char* name) const;
void print(const std::string& name) const { print(name.c_str()); }
std::string getPrint(const char* name = nullptr) const;
};
} // namespace Tyra
@@ -0,0 +1,32 @@
/*
# ______ ____ ___
# | \/ ____| |___|
# | | | \ | |
#-----------------------------------------------------------------------
# Copyright 2022, tyra - https://github.com/h4570/tyra
# Licenced under Apache License 2.0
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
*/
#pragma once
#include "renderer/models/color.hpp"
namespace Tyra {
/**
* @brief Color data. At least one color data is required (single/many).
*/
class DynPipColorBag {
public:
DynPipColorBag();
~DynPipColorBag();
/** Optional. Single color for all vertices. */
Color* single;
/** Optional. Color per vertex. */
Color* many;
};
} // namespace Tyra
@@ -0,0 +1,30 @@
/*
# ______ ____ ___
# | \/ ____| |___|
# | | | \ | |
#-----------------------------------------------------------------------
# Copyright 2022, tyra - https://github.com/h4570/tyra
# Licenced under Apache License 2.0
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
*/
#pragma once
#include "math/vec4.hpp"
#include "renderer/core/texture/models/texture.hpp"
namespace Tyra {
class DynPipTextureBag {
public:
DynPipTextureBag();
~DynPipTextureBag();
/** Mandatory. Texture coordinates per vertex. */
Vec4* coordinates;
/** Mandatory. Texture image. */
Texture* texture;
};
} // namespace Tyra
@@ -13,19 +13,19 @@
#include <draw.h>
#include "math/m4x4.hpp"
#include "math/vec4.hpp"
#include "../../stapip_shading_type.hpp"
#include "./pipeline_shading_type.hpp"
namespace Tyra {
class StaPipInfoBag {
class PipelineInfoBag {
public:
StaPipInfoBag();
~StaPipInfoBag();
PipelineInfoBag();
~PipelineInfoBag();
/** Mandatory. Model matrix */
M4x4* model;
StaPipShadingType shadingType;
PipelineShadingType shadingType;
bool blendingEnabled;
bool antiAliasingEnabled;
bool noClipChecks;
@@ -16,12 +16,12 @@
namespace Tyra {
enum StaPipLightingBagMode { Auto, Manual };
enum PipelineLightingBagMode { Auto, Manual };
class StaPipLightingBag {
class PipelineLightingBag {
public:
explicit StaPipLightingBag(const bool& manual = false);
~StaPipLightingBag();
explicit PipelineLightingBag(const bool& manual = false);
~PipelineLightingBag();
Vec4* normals;
M4x4* lightMatrix;
@@ -47,7 +47,7 @@ class StaPipLightingBag {
void deallocate();
void forceDeallocate();
u8 isAllocated;
StaPipLightingBagMode mode;
PipelineLightingBagMode mode;
Vec4* lightColors;
Vec4* lightDirections;
@@ -12,7 +12,7 @@
namespace Tyra {
enum StaPipShadingType {
enum PipelineShadingType {
StaPipShadingFlat,
StaPipShadingGouraud,
};
@@ -11,8 +11,8 @@
#pragma once
#include "math/vec4.hpp"
#include "./stapip_lighting_bag.hpp"
#include "./stapip_info_bag.hpp"
#include "renderer/3d/pipeline/shared/bag/pipeline_lighting_bag.hpp"
#include "renderer/3d/pipeline/shared/bag/pipeline_info_bag.hpp"
#include "./stapip_color_bag.hpp"
#include "./stapip_texture_bag.hpp"
#include "renderer/core/texture/models/texture.hpp"
@@ -22,7 +22,7 @@ namespace Tyra {
/**
* @brief 3D Render data bag.
* Supports frustum culling, clipping, lighting,
* Supports frustum culling, full plane clipping, lighting,
* texture and single color / many colors.
*/
class StaPipBag {
@@ -31,7 +31,7 @@ class StaPipBag {
~StaPipBag();
/** Mandatory. Object info. */
StaPipInfoBag* info;
PipelineInfoBag* info;
/** Mandatory. Object color(s). */
StaPipColorBag* color;
@@ -46,7 +46,7 @@ class StaPipBag {
StaPipTextureBag* texture;
/** Optional. Object lighting. */
StaPipLightingBag* lighting;
PipelineLightingBag* lighting;
/**
* @param maxVertCount This parameter is available in renderer API.
@@ -46,7 +46,7 @@ class StaPipQBufferRenderer {
void setMaxVertCount(const u32& count);
void setInfo(StaPipInfoBag* bag);
void setInfo(PipelineInfoBag* bag);
/** Fast render with culling */
void cull(StaPipQBuffer* buffer);
@@ -10,7 +10,7 @@
#pragma once
#include "./stapip_shading_type.hpp"
#include "renderer/3d/pipeline/shared/bag/pipeline_shading_type.hpp"
#include "./stapip_lighting_options.hpp"
namespace Tyra {
@@ -20,7 +20,7 @@ class StaPipOptions {
StaPipOptions() {}
~StaPipOptions() {}
StaPipShadingType shadingType;
PipelineShadingType shadingType;
bool blendingEnabled;
bool antiAliasingEnabled;
bool noClipChecks;
@@ -41,16 +41,16 @@ class StaticPipeline : public Renderer3DPipeline {
void addVertices(DynamicMesh* mesh, MeshMaterial* material, StaPipBag* bag,
MeshFrame* frameFrom, MeshFrame* frameTo) const;
StaPipInfoBag* getInfoBag(DynamicMesh* mesh, const StaPipOptions* options,
M4x4* model) const;
PipelineInfoBag* getInfoBag(DynamicMesh* mesh, const StaPipOptions* options,
M4x4* model) const;
StaPipColorBag* getColorBag(DynamicMesh* mesh, MeshMaterial* material,
MeshFrame* frameFrom, MeshFrame* frameTo) const;
StaPipTextureBag* getTextureBag(DynamicMesh* mesh, MeshMaterial* material,
MeshFrame* frameFrom, MeshFrame* frameTo);
StaPipLightingBag* getLightingBag(DynamicMesh* mesh, MeshMaterial* material,
M4x4* model, MeshFrame* frameFrom,
MeshFrame* frameTo,
const StaPipOptions* options) const;
PipelineLightingBag* getLightingBag(DynamicMesh* mesh, MeshMaterial* material,
M4x4* model, MeshFrame* frameFrom,
MeshFrame* frameTo,
const StaPipOptions* options) const;
void deallocDrawBags(StaPipBag* bag, MeshMaterial* material) const;
void setLightingColorsCache(StaPipLightingOptions* lightingOptions);