std pipeline rename

This commit is contained in:
h4570
2022-07-18 19:46:06 +02:00
parent 632be84ceb
commit bb02a3d9bf
70 changed files with 679 additions and 680 deletions
-1
View File
@@ -1,7 +1,6 @@
------------ Tyra's v2.0 roadmap to publish on GitHub ------------
--- H4570
- [Renderer] Rename stdRenderer -> staticRenderer
- [Renderer] Mesh, StaticMesh, AnimMesh
- [Renderer] dynamicRenderer, dbufferring during mesh unrolling, simple clip
- [Renderer] staticRenderer -> remove animation, dbufferring during mesh unrolling, full plane clip
@@ -10,17 +10,17 @@
#pragma once
#include "../stdpip_bag.hpp"
#include "../stapip_bag.hpp"
#include "renderer/core/3d/bbox/core_bbox_frustum.hpp"
namespace Tyra {
class StdpipBagPackage {
class StapipBagPackage {
public:
StdpipBagPackage();
~StdpipBagPackage();
StapipBagPackage();
~StapipBagPackage();
StdpipBag* bag;
StapipBag* bag;
Vec4* vertices;
Vec4* sts;
@@ -32,12 +32,12 @@ class StdpipBagPackage {
CoreBBoxFrustum isInFrustum;
/**
* We are creating StdpipBagPackagesBBox which checks CoreBBoxBBox for every
* We are creating StapipBagPackagesBBox which checks CoreBBoxBBox for every
* maxVertCount / 3. So this variable is index of starting
* StdpipBagPackagesBBox's CoreBBoxBBox. If package have <= maxVertCount / 3
* StapipBagPackagesBBox's CoreBBoxBBox. If package have <= maxVertCount / 3
* verts, we will need only single (starting) bbox. if package have
* maxVertCount verts, we will calculate CoreBBoxBBox from 3
* StdpipBagPackagesBBox's bboxes.
* StapipBagPackagesBBox's bboxes.
*/
u32 indexOf1By3BBox;
@@ -13,19 +13,19 @@
#include "renderer/core/3d/bbox/core_bbox.hpp"
#include "renderer/core/3d/renderer_3d_frustum_planes.hpp"
#include "renderer/core/paths/path1/clipper/path1_ee_clip_algorithm.hpp"
#include "./stdpip_bag_packages_bbox.hpp"
#include "./stdpip_bag_package.hpp"
#include "../stdpip_bag.hpp"
#include "./stapip_bag_packages_bbox.hpp"
#include "./stapip_bag_package.hpp"
#include "../stapip_bag.hpp"
namespace Tyra {
class StdpipBagPackager {
class StapipBagPackager {
public:
StdpipBagPackager();
~StdpipBagPackager();
StapipBagPackager();
~StapipBagPackager();
void init(Renderer3DFrustumPlanes* frustumPlanes);
void setRenderBBox(StdpipBagPackagesBBox* bbox) { renderBBox = bbox; }
void setRenderBBox(StapipBagPackagesBBox* bbox) { renderBBox = bbox; }
void setMaxVertCount(const u32& count);
/**
@@ -33,20 +33,20 @@ class StdpipBagPackager {
*
* @param size Max maxVertCount verts (VU1 buffer size)
*/
StdpipBagPackage* create(u16* o_size, StdpipBag* data, u16 size);
StapipBagPackage* create(u16* o_size, StapipBag* data, u16 size);
/**
* @brief Split render package to smaller packages
*
* @param size Max maxVertCount verts (VU1 buffer size)
*/
StdpipBagPackage* create(u16* o_size, const StdpipBagPackage& pkg, u16 size);
StapipBagPackage* create(u16* o_size, const StapipBagPackage& pkg, u16 size);
CoreBBoxFrustum checkFrustum(const StdpipBagPackage& pkg);
CoreBBoxFrustum checkFrustum(const StapipBagPackage& pkg);
private:
u32 maxVertCount;
Renderer3DFrustumPlanes* frustumPlanes;
StdpipBagPackagesBBox* renderBBox;
StapipBagPackagesBBox* renderBBox;
};
} // namespace Tyra
@@ -18,13 +18,13 @@ namespace Tyra {
* Splits all 3D input vertices into 16vert parts and creates child bboxes for
* it
*/
class StdpipBagPackagesBBox {
class StapipBagPackagesBBox {
public:
StdpipBagPackagesBBox(Vec4* t_vertices, u32* t_faces, const u32& t_facesCount,
StapipBagPackagesBBox(Vec4* t_vertices, u32* t_faces, const u32& t_facesCount,
const u32& t_maxVertCount);
StdpipBagPackagesBBox(Vec4* t_vertices, const u32& t_counts,
StapipBagPackagesBBox(Vec4* t_vertices, const u32& t_counts,
const u32& t_maxVertCount);
~StdpipBagPackagesBBox();
~StapipBagPackagesBBox();
void setMaxVertCount(const u32& count);
@@ -11,12 +11,12 @@
#pragma once
#include "math/vec4.hpp"
#include "./stdpip_lighting_bag.hpp"
#include "./stdpip_info_bag.hpp"
#include "./stdpip_color_bag.hpp"
#include "./stdpip_texture_bag.hpp"
#include "./stapip_lighting_bag.hpp"
#include "./stapip_info_bag.hpp"
#include "./stapip_color_bag.hpp"
#include "./stapip_texture_bag.hpp"
#include "renderer/core/texture/models/texture.hpp"
#include "./packaging/stdpip_bag_packages_bbox.hpp"
#include "./packaging/stapip_bag_packages_bbox.hpp"
namespace Tyra {
@@ -25,16 +25,16 @@ namespace Tyra {
* Supports frustum culling, clipping, lighting,
* texture and single color / many colors.
*/
class StdpipBag {
class StapipBag {
public:
StdpipBag();
~StdpipBag();
StapipBag();
~StapipBag();
/** Mandatory. Object info. */
StdpipInfoBag* info;
StapipInfoBag* info;
/** Mandatory. Object color(s). */
StdpipColorBag* color;
StapipColorBag* color;
/** Mandatory. Vertex count. */
u32 count;
@@ -43,15 +43,15 @@ class StdpipBag {
Vec4* vertices;
/** Optional. Texture coordinates and image. */
StdpipTextureBag* texture;
StapipTextureBag* texture;
/** Optional. Object lighting. */
StdpipLightingBag* lighting;
StapipLightingBag* lighting;
/**
* @param maxVertCount This parameter is available in renderer API.
*/
StdpipBagPackagesBBox calculateBbox(const u32& maxVertCount);
StapipBagPackagesBBox calculateBbox(const u32& maxVertCount);
void print() const;
void print(const char* name) const;
@@ -17,10 +17,10 @@ namespace Tyra {
/**
* @brief Color data. At least one color data is required (single/many).
*/
class StdpipColorBag {
class StapipColorBag {
public:
StdpipColorBag();
~StdpipColorBag();
StapipColorBag();
~StapipColorBag();
/** Optional. Single color for all vertices. */
Color* single;
@@ -13,19 +13,19 @@
#include <draw.h>
#include "math/m4x4.hpp"
#include "math/vec4.hpp"
#include "../../stdpip_shading_type.hpp"
#include "../../stapip_shading_type.hpp"
namespace Tyra {
class StdpipInfoBag {
class StapipInfoBag {
public:
StdpipInfoBag();
~StdpipInfoBag();
StapipInfoBag();
~StapipInfoBag();
/** Mandatory. Model matrix */
M4x4* model;
StdpipShadingType shadingType;
StapipShadingType shadingType;
bool blendingEnabled;
bool antiAliasingEnabled;
bool noClipChecks;
@@ -16,12 +16,12 @@
namespace Tyra {
enum StdpipLightingBagMode { Auto, Manual };
enum StapipLightingBagMode { Auto, Manual };
class StdpipLightingBag {
class StapipLightingBag {
public:
explicit StdpipLightingBag(const bool& manual = false);
~StdpipLightingBag();
explicit StapipLightingBag(const bool& manual = false);
~StapipLightingBag();
Vec4* normals;
M4x4* lightMatrix;
@@ -47,7 +47,7 @@ class StdpipLightingBag {
void deallocate();
void forceDeallocate();
u8 isAllocated;
StdpipLightingBagMode mode;
StapipLightingBagMode mode;
Vec4* lightColors;
Vec4* lightDirections;
@@ -15,10 +15,10 @@
namespace Tyra {
class StdpipTextureBag {
class StapipTextureBag {
public:
StdpipTextureBag();
~StdpipTextureBag();
StapipTextureBag();
~StapipTextureBag();
/** Mandatory. Texture coordinates per vertex. */
Vec4* coordinates;
@@ -12,19 +12,19 @@
#include <packet2_utils.h>
#include <string>
#include "../../stdpip_vu1_program.hpp"
#include "../../stapip_vu1_program.hpp"
namespace Tyra {
class StdpipAsIsCVU1Program : public StdpipVU1Program {
class StapipAsIsCVU1Program : public StapipVU1Program {
public:
StdpipAsIsCVU1Program();
~StdpipAsIsCVU1Program();
StapipAsIsCVU1Program();
~StapipAsIsCVU1Program();
std::string getStringName() const;
void addProgramQBufferDataToPacket(packet2_t* packet,
StdpipQBuffer* qbuffer) const;
StapipQBuffer* qbuffer) const;
};
} // namespace Tyra
@@ -12,18 +12,18 @@
#include <packet2_utils.h>
#include <string>
#include "../../stdpip_vu1_program.hpp"
#include "../../stapip_vu1_program.hpp"
namespace Tyra {
class StdpipAsIsDVU1Program : public StdpipVU1Program {
class StapipAsIsDVU1Program : public StapipVU1Program {
public:
StdpipAsIsDVU1Program();
~StdpipAsIsDVU1Program();
StapipAsIsDVU1Program();
~StapipAsIsDVU1Program();
std::string getStringName() const;
void addProgramQBufferDataToPacket(packet2_t* packet,
StdpipQBuffer* qbuffer) const;
StapipQBuffer* qbuffer) const;
};
} // namespace Tyra
@@ -12,18 +12,18 @@
#include <packet2_utils.h>
#include <string>
#include "../../stdpip_vu1_program.hpp"
#include "../../stapip_vu1_program.hpp"
namespace Tyra {
class StdpipAsIsTCVU1Program : public StdpipVU1Program {
class StapipAsIsTCVU1Program : public StapipVU1Program {
public:
StdpipAsIsTCVU1Program();
~StdpipAsIsTCVU1Program();
StapipAsIsTCVU1Program();
~StapipAsIsTCVU1Program();
std::string getStringName() const;
void addProgramQBufferDataToPacket(packet2_t* packet,
StdpipQBuffer* qbuffer) const;
StapipQBuffer* qbuffer) const;
};
} // namespace Tyra
@@ -12,18 +12,18 @@
#include <packet2_utils.h>
#include <string>
#include "../../stdpip_vu1_program.hpp"
#include "../../stapip_vu1_program.hpp"
namespace Tyra {
class StdpipAsIsTDVU1Program : public StdpipVU1Program {
class StapipAsIsTDVU1Program : public StapipVU1Program {
public:
StdpipAsIsTDVU1Program();
~StdpipAsIsTDVU1Program();
StapipAsIsTDVU1Program();
~StapipAsIsTDVU1Program();
std::string getStringName() const;
void addProgramQBufferDataToPacket(packet2_t* packet,
StdpipQBuffer* qbuffer) const;
StapipQBuffer* qbuffer) const;
};
} // namespace Tyra
@@ -12,18 +12,18 @@
#include <packet2_utils.h>
#include <string>
#include "../../stdpip_vu1_program.hpp"
#include "../../stapip_vu1_program.hpp"
namespace Tyra {
class StdpipCullCVU1Program : public StdpipVU1Program {
class StapipCullCVU1Program : public StapipVU1Program {
public:
StdpipCullCVU1Program();
~StdpipCullCVU1Program();
StapipCullCVU1Program();
~StapipCullCVU1Program();
std::string getStringName() const;
void addProgramQBufferDataToPacket(packet2_t* packet,
StdpipQBuffer* qbuffer) const;
StapipQBuffer* qbuffer) const;
};
} // namespace Tyra
@@ -12,18 +12,18 @@
#include <packet2_utils.h>
#include <string>
#include "../../stdpip_vu1_program.hpp"
#include "../../stapip_vu1_program.hpp"
namespace Tyra {
class StdpipCullDVU1Program : public StdpipVU1Program {
class StapipCullDVU1Program : public StapipVU1Program {
public:
StdpipCullDVU1Program();
~StdpipCullDVU1Program();
StapipCullDVU1Program();
~StapipCullDVU1Program();
std::string getStringName() const;
void addProgramQBufferDataToPacket(packet2_t* packet,
StdpipQBuffer* qbuffer) const;
StapipQBuffer* qbuffer) const;
};
} // namespace Tyra
@@ -0,0 +1,29 @@
/*
# ______ ____ ___
# | \/ ____| |___|
# | | | \ | |
#-----------------------------------------------------------------------
# Copyright 2022, tyra - https://github.com/h4570/tyra
# Licenced under Apache License 2.0
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
*/
#pragma once
#include <packet2_utils.h>
#include <string>
#include "../../stapip_vu1_program.hpp"
namespace Tyra {
class StapipCullTCVU1Program : public StapipVU1Program {
public:
StapipCullTCVU1Program();
~StapipCullTCVU1Program();
std::string getStringName() const;
void addProgramQBufferDataToPacket(packet2_t* packet,
StapipQBuffer* qbuffer) const;
};
} // namespace Tyra
@@ -0,0 +1,29 @@
/*
# ______ ____ ___
# | \/ ____| |___|
# | | | \ | |
#-----------------------------------------------------------------------
# Copyright 2022, tyra - https://github.com/h4570/tyra
# Licenced under Apache License 2.0
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
*/
#pragma once
#include <packet2_utils.h>
#include <string>
#include "../../stapip_vu1_program.hpp"
namespace Tyra {
class StapipCullTDVU1Program : public StapipVU1Program {
public:
StapipCullTDVU1Program();
~StapipCullTDVU1Program();
std::string getStringName() const;
void addProgramQBufferDataToPacket(packet2_t* packet,
StapipQBuffer* qbuffer) const;
};
} // namespace Tyra
@@ -12,7 +12,7 @@
#include <vector>
#include "debug/debug.hpp"
#include "./stdpip_qbuffer.hpp"
#include "./stapip_qbuffer.hpp"
#include "renderer/renderer_settings.hpp"
#include "renderer/core/paths/path1/clipper/path1_ee_clip_algorithm.hpp"
@@ -25,11 +25,11 @@ namespace Tyra {
* To be honest clipping algorithm should be moved to VU1 and "AsIs" VU1 program
* should be renamed to "Clip" - I don't want to do it now, too much time.
*/
class StdpipClipper {
class StapipClipper {
public:
StdpipClipper();
~StdpipClipper();
void clip(StdpipQBuffer* buffer);
StapipClipper();
~StapipClipper();
void clip(StapipQBuffer* buffer);
void init(const RendererSettings& settings);
void setMaxVertCount(const u32& count);
void setMVP(M4x4* mvp);
@@ -41,7 +41,7 @@ class StdpipClipper {
void perspectiveDivide(std::vector<Path1ClipVertex>* vertices);
void moveDataToBuffer(const std::vector<Path1ClipVertex>& vertices,
StdpipQBuffer* buffer);
StapipQBuffer* buffer);
};
} // namespace Tyra
@@ -12,20 +12,20 @@
namespace Tyra {
enum StdpipProgramName {
enum StapipProgramName {
StdipUndefinedProgram,
StdpipCullColor,
StdpipAsIsColor,
StapipCullColor,
StapipAsIsColor,
StdpipCullDirLights,
StdpipAsIsDirLights,
StapipCullDirLights,
StapipAsIsDirLights,
StdpipCullTextureDirLights,
StdpipAsIsTextureDirLights,
StapipCullTextureDirLights,
StapipAsIsTextureDirLights,
StdpipCullTextureColor,
StdpipAsIsTextureColor,
StapipCullTextureColor,
StapipAsIsTextureColor,
};
} // namespace Tyra
@@ -12,11 +12,11 @@
namespace Tyra {
enum StdpipProgramType {
StdpipVU1Color,
StdpipVU1DirLights,
StdpipVU1TextureDirLights,
StdpipVU1TextureColor,
enum StapipProgramType {
StapipVU1Color,
StapipVU1DirLights,
StapipVU1TextureDirLights,
StapipVU1TextureColor,
};
} // namespace Tyra
@@ -0,0 +1,49 @@
/*
# ______ ____ ___
# | \/ ____| |___|
# | | | \ | |
#-----------------------------------------------------------------------
# Copyright 2022, tyra - https://github.com/h4570/tyra
# Licenced under Apache License 2.0
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
*/
#pragma once
#include "debug/debug.hpp"
#include "renderer/core/paths/path1/vu1_program.hpp"
#include "./programs/as_is/stapip_as_is_c_vu1_program.hpp"
#include "./programs/as_is/stapip_as_is_d_vu1_program.hpp"
#include "./programs/as_is/stapip_as_is_td_vu1_program.hpp"
#include "./programs/as_is/stapip_as_is_tc_vu1_program.hpp"
#include "./programs/cull/stapip_cull_c_vu1_program.hpp"
#include "./programs/cull/stapip_cull_d_vu1_program.hpp"
#include "./programs/cull/stapip_cull_td_vu1_program.hpp"
#include "./programs/cull/stapip_cull_tc_vu1_program.hpp"
#include "renderer/core/paths/path1/programs/draw_finish/vu1_draw_finish.hpp"
namespace Tyra {
class StapipProgramsRepository {
public:
StapipProgramsRepository();
~StapipProgramsRepository();
StapipVU1Program* getProgram(const StapipProgramName& name);
private:
StapipAsIsCVU1Program asIsColor;
StapipCullCVU1Program cullColor;
StapipAsIsDVU1Program asIsLightingColor;
StapipCullDVU1Program cullLightingColor;
StapipAsIsTDVU1Program asIsLightingTextureColor;
StapipCullTDVU1Program cullLightingTextureColor;
StapipAsIsTCVU1Program asIsTextureColor;
StapipCullTCVU1Program cullTextureColor;
VU1DrawFinish drawFinish;
};
} // namespace Tyra
@@ -14,15 +14,15 @@
#include <string>
#include <sstream>
#include "debug/debug.hpp"
#include "../bag/packaging/stdpip_bag_package.hpp"
#include "../bag/stdpip_bag.hpp"
#include "./bag/packaging/stapip_bag_package.hpp"
#include "./bag/stapip_bag.hpp"
namespace Tyra {
class StdpipQBuffer {
class StapipQBuffer {
public:
StdpipQBuffer();
~StdpipQBuffer();
StapipQBuffer();
~StapipQBuffer();
void setMaxVertCount(const u32& count);
@@ -30,27 +30,27 @@ class StdpipQBuffer {
* @brief Dont allocate any dynamic data in buffer.
* Just copy pointers to input data.
*/
void fillByPointer(const StdpipBagPackage& pkg);
void fillByPointer(const StapipBagPackage& pkg);
/**
* @brief Allocate dynamic data in buffer
* And copy input data to it.
*/
void fillByCopyMax(const StdpipBagPackage& pkg1, const StdpipBagPackage& pkg2,
const StdpipBagPackage& pkg3);
void fillByCopyMax(const StapipBagPackage& pkg1, const StapipBagPackage& pkg2,
const StapipBagPackage& pkg3);
/**
* @brief Allocate dynamic data in buffer
* And copy input data to it.
*/
void fillByCopy1By2(const StdpipBagPackage& pkg1,
const StdpipBagPackage& pkg2);
void fillByCopy1By2(const StapipBagPackage& pkg1,
const StapipBagPackage& pkg2);
/**
* @brief Allocate dynamic data in buffer
* And copy input data to it.
*/
void fillByCopy1By3(const StdpipBagPackage& pkg);
void fillByCopy1By3(const StapipBagPackage& pkg);
/**
* @brief Deallocate dynamic data if it was allocated and allocate new data
@@ -61,7 +61,7 @@ class StdpipQBuffer {
bool any() const;
StdpipBag* bag;
StapipBag* bag;
Vec4* vertices;
Vec4* sts;
@@ -77,7 +77,7 @@ class StdpipQBuffer {
private:
u32 maxVertCount;
void deallocateDynamicData();
void allocateDynamicData(u16 size, StdpipBag* bag);
void allocateDynamicData(u16 size, StapipBag* bag);
u8 _isDynamicallyAllocated, _stAllocated, _colorAllocated, _normalAllocated;
};
@@ -17,21 +17,21 @@
#include "math/m4x4.hpp"
#include "renderer/renderer_settings.hpp"
#include "renderer/models/color.hpp"
#include "./stdpip_qbuffer.hpp"
#include "./stdpip_program_type.hpp"
#include "./stdpip_program_name.hpp"
#include "./stdpip_programs_repository.hpp"
#include "./stdpip_clipper.hpp"
#include "./stapip_qbuffer.hpp"
#include "./stapip_program_type.hpp"
#include "./stapip_program_name.hpp"
#include "./stapip_programs_repository.hpp"
#include "./stapip_clipper.hpp"
#include "renderer/core/paths/path1/path1.hpp"
#include "renderer/core/renderer_core.hpp"
#include "renderer/core/texture/renderer_core_texture_buffers.hpp"
namespace Tyra {
class StdpipQBufferRenderer {
class StapipQBufferRenderer {
public:
StdpipQBufferRenderer();
~StdpipQBufferRenderer();
StapipQBufferRenderer();
~StapipQBufferRenderer();
void init(RendererCore* t_core);
@@ -39,26 +39,26 @@ class StdpipQBufferRenderer {
void setClipperMVP(M4x4* mvp) { clipper.setMVP(mvp); }
StdpipQBuffer* getBuffer();
StapipQBuffer* getBuffer();
void sendObjectData(StdpipBag* bag, M4x4* mvp,
void sendObjectData(StapipBag* bag, M4x4* mvp,
RendererCoreTextureBuffers* texBuffers) const;
void setMaxVertCount(const u32& count);
void setInfo(StdpipInfoBag* bag);
void setInfo(StapipInfoBag* bag);
/** Fast render with culling */
void cull(StdpipQBuffer* buffer);
void cull(StapipQBuffer* buffer);
/** Slower render with clipping */
void clip(StdpipQBuffer* buffer);
void clip(StapipQBuffer* buffer);
void clearLastProgramName();
StdpipVU1Program* getCullProgramByBag(const StdpipBag* bag);
StapipVU1Program* getCullProgramByBag(const StapipBag* bag);
StdpipVU1Program* getCullProgramByParams(const bool& isLightingEnabled,
StapipVU1Program* getCullProgramByParams(const bool& isLightingEnabled,
const bool& isTextureEnabled);
const u16& getBufferSize() { return bufferSize; }
@@ -69,27 +69,27 @@ class StdpipQBufferRenderer {
void uploadPrograms();
void setDoubleBuffer();
StdpipVU1Program* getProgramByName(const StdpipProgramName& name);
void addBufferDataToPacket(StdpipVU1Program* program, StdpipQBuffer* buffer);
StapipVU1Program* getProgramByName(const StapipProgramName& name);
void addBufferDataToPacket(StapipVU1Program* program, StapipQBuffer* buffer);
void sendPacket();
StdpipVU1Program* getAsIsProgramByBag(const StdpipBag* bag);
StdpipVU1Program* getCullProgramByType(const StdpipProgramType& programType);
StdpipProgramType getDrawProgramTypeByBag(const StdpipBag* bag) const;
StdpipProgramType getDrawProgramTypeByParams(
StapipVU1Program* getAsIsProgramByBag(const StapipBag* bag);
StapipVU1Program* getCullProgramByType(const StapipProgramType& programType);
StapipProgramType getDrawProgramTypeByBag(const StapipBag* bag) const;
StapipProgramType getDrawProgramTypeByParams(
const bool& isLightingEnabled, const bool& isTextureEnabled) const;
packet2_t* packets[2];
packet2_t* programsPacket;
StdpipQBuffer buffers[2];
StapipQBuffer buffers[2];
packet2_t* currentPacket;
packet2_t* staticDataPacket;
packet2_t* objectDataPacket;
RendererCore* rendererCore;
StdpipProgramName lastProgramName;
StapipProgramName lastProgramName;
Path1* path1;
StdpipClipper clipper;
StdpipProgramsRepository repository;
StapipClipper clipper;
StapipProgramsRepository repository;
u16 bufferSize;
u8 context;
@@ -10,40 +10,40 @@
#pragma once
#include "./stdpip_program_name.hpp"
#include "./stapip_program_name.hpp"
#include "renderer/core/paths/path1/vu1_program.hpp"
#include "./stdpip_qbuffer.hpp"
#include "./programs/stdpip_vu1_shared_defines.h"
#include "./stapip_qbuffer.hpp"
#include "./programs/stapip_vu1_shared_defines.h"
namespace Tyra {
class StdpipVU1Program : public VU1Program {
class StapipVU1Program : public VU1Program {
public:
StdpipVU1Program(const StdpipProgramName& name, u32* start, u32* end,
StapipVU1Program(const StapipProgramName& name, u32* start, u32* end,
const u32& t_reglist, const u8& t_reglistCount,
const u8& t_elementsPerVertex);
~StdpipVU1Program();
~StapipVU1Program();
u32& getReglist();
const StdpipProgramName& getName() const;
const StapipProgramName& getName() const;
u16 getMaxVertCount(const bool& singleColorEnabled,
const u16& vu1DBufferSize) const;
void addBufferDataToPacket(packet2_t* packet, StdpipQBuffer* buffer,
void addBufferDataToPacket(packet2_t* packet, StapipQBuffer* buffer,
prim_t* prim);
protected:
StdpipProgramName name;
StapipProgramName name;
u8 reglistCount, elementsPerVertex;
u32 destinationAddress, reglist;
virtual void addProgramQBufferDataToPacket(packet2_t* packet,
StdpipQBuffer* qbuffer) const = 0;
StapipQBuffer* qbuffer) const = 0;
private:
void addStandardBufferDataToPacket(packet2_t* packet, StdpipQBuffer* buffer,
void addStandardBufferDataToPacket(packet2_t* packet, StapipQBuffer* buffer,
prim_t* prim);
};
@@ -11,23 +11,23 @@
#pragma once
#include <tamtypes.h>
#include "./bag/stdpip_bag.hpp"
#include "./bag/packaging/stdpip_bag_packages_bbox.hpp"
#include "./bag/packaging/stdpip_bag_package.hpp"
#include "./bag/packaging/stdpip_bag_packager.hpp"
#include "./path1/stdpip_qbuffer_renderer.hpp"
#include "./bag/stapip_bag.hpp"
#include "./bag/packaging/stapip_bag_packages_bbox.hpp"
#include "./bag/packaging/stapip_bag_package.hpp"
#include "./bag/packaging/stapip_bag_packager.hpp"
#include "./stapip_qbuffer_renderer.hpp"
namespace Tyra {
class StdPipelineCore {
class StapipelineCore {
public:
StdPipelineCore();
~StdPipelineCore();
StapipelineCore();
~StapipelineCore();
void init(RendererCore* t_core);
/** Render 3D data via "bags" */
void render(StdpipBag* data, StdpipBagPackagesBBox* bbox = nullptr);
void render(StapipBag* data, StapipBagPackagesBBox* bbox = nullptr);
/** Get max vert count of VU1 qbuffer (for optimizations) */
u32 getMaxVertCountByParams(const bool& isSingleColor,
@@ -35,7 +35,7 @@ class StdPipelineCore {
const bool& isTextureEnabled);
/** Get max vert count of VU1 qbuffer (for optimizations) */
u32 getMaxVertCountByBag(const StdpipBag* bag);
u32 getMaxVertCountByBag(const StapipBag* bag);
/**
* - Uploads standard VU1 programs.
@@ -50,10 +50,10 @@ class StdPipelineCore {
RendererCore* rendererCore;
void setMaxVertCount(const u32& count);
StdpipBagPackager packager;
StdpipQBufferRenderer qbufferRenderer;
void renderPkgs(StdpipBagPackage* packages, u16 count);
void renderSubpkgs(StdpipBagPackage* packages, u16 count);
StapipBagPackager packager;
StapipQBufferRenderer qbufferRenderer;
void renderPkgs(StapipBagPackage* packages, u16 count);
void renderSubpkgs(StapipBagPackage* packages, u16 count);
};
} // namespace Tyra
@@ -15,10 +15,10 @@
namespace Tyra {
class StdpipLightingOptions {
class StapipLightingOptions {
public:
StdpipLightingOptions() {}
~StdpipLightingOptions() {}
StapipLightingOptions() {}
~StapipLightingOptions() {}
/**
* Mandatory.
@@ -10,23 +10,23 @@
#pragma once
#include "./stdpip_shading_type.hpp"
#include "./stdpip_lighting_options.hpp"
#include "./stapip_shading_type.hpp"
#include "./stapip_lighting_options.hpp"
namespace Tyra {
class StdpipOptions {
class StapipOptions {
public:
StdpipOptions() {}
~StdpipOptions() {}
StapipOptions() {}
~StapipOptions() {}
StdpipShadingType shadingType;
StapipShadingType shadingType;
bool blendingEnabled;
bool antiAliasingEnabled;
bool noClipChecks;
/** Optional */
StdpipLightingOptions* lighting;
StapipLightingOptions* lighting;
};
} // namespace Tyra
@@ -12,9 +12,9 @@
namespace Tyra {
enum StdpipShadingType {
StdpipShadingFlat,
StdpipShadingGouraud,
enum StapipShadingType {
StapipShadingFlat,
StapipShadingGouraud,
};
} // namespace Tyra
@@ -12,17 +12,17 @@
#include <tamtypes.h>
#include "../renderer_3d_pipeline.hpp"
#include "./stdpip_options.hpp"
#include "./stapip_options.hpp"
#include "renderer/core/renderer_core.hpp"
#include "renderer/3d/mesh/mesh.hpp"
#include "./core/std_pipeline_core.hpp"
#include "./core/static_pipeline_core.hpp"
namespace Tyra {
class StdPipeline : public Renderer3DPipeline {
class Stapipeline : public Renderer3DPipeline {
public:
StdPipeline();
~StdPipeline();
Stapipeline();
~Stapipeline();
void init(RendererCore* core);
@@ -32,28 +32,28 @@ class StdPipeline : public Renderer3DPipeline {
* Render 3D data via "meshes".
* This render() method is a bridge to core.renderer3D.render() method.
*/
void render(Mesh* mesh, const StdpipOptions* options = nullptr);
void render(Mesh* mesh, const StapipOptions* options = nullptr);
private:
StdPipelineCore core;
StapipelineCore core;
RendererCore* rendererCore;
Vec4* colorsCache;
void addVertices(Mesh* mesh, MeshMaterial* material, StdpipBag* bag,
void addVertices(Mesh* mesh, MeshMaterial* material, StapipBag* bag,
MeshFrame* frameFrom, MeshFrame* frameTo) const;
StdpipInfoBag* getInfoBag(Mesh* mesh, const StdpipOptions* options,
StapipInfoBag* getInfoBag(Mesh* mesh, const StapipOptions* options,
M4x4* model) const;
StdpipColorBag* getColorBag(Mesh* mesh, MeshMaterial* material,
StapipColorBag* getColorBag(Mesh* mesh, MeshMaterial* material,
MeshFrame* frameFrom, MeshFrame* frameTo) const;
StdpipTextureBag* getTextureBag(Mesh* mesh, MeshMaterial* material,
StapipTextureBag* getTextureBag(Mesh* mesh, MeshMaterial* material,
MeshFrame* frameFrom, MeshFrame* frameTo);
StdpipLightingBag* getLightingBag(Mesh* mesh, MeshMaterial* material,
StapipLightingBag* getLightingBag(Mesh* mesh, MeshMaterial* material,
M4x4* model, MeshFrame* frameFrom,
MeshFrame* frameTo,
const StdpipOptions* options) const;
void deallocDrawBags(StdpipBag* bag, MeshMaterial* material) const;
const StapipOptions* options) const;
void deallocDrawBags(StapipBag* bag, MeshMaterial* material) const;
void setLightingColorsCache(StdpipLightingOptions* lightingOptions);
void setLightingColorsCache(StapipLightingOptions* lightingOptions);
};
} // namespace Tyra
@@ -1,29 +0,0 @@
/*
# ______ ____ ___
# | \/ ____| |___|
# | | | \ | |
#-----------------------------------------------------------------------
# Copyright 2022, tyra - https://github.com/h4570/tyra
# Licenced under Apache License 2.0
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
*/
#pragma once
#include <packet2_utils.h>
#include <string>
#include "../../stdpip_vu1_program.hpp"
namespace Tyra {
class StdpipCullTCVU1Program : public StdpipVU1Program {
public:
StdpipCullTCVU1Program();
~StdpipCullTCVU1Program();
std::string getStringName() const;
void addProgramQBufferDataToPacket(packet2_t* packet,
StdpipQBuffer* qbuffer) const;
};
} // namespace Tyra
@@ -1,29 +0,0 @@
/*
# ______ ____ ___
# | \/ ____| |___|
# | | | \ | |
#-----------------------------------------------------------------------
# Copyright 2022, tyra - https://github.com/h4570/tyra
# Licenced under Apache License 2.0
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
*/
#pragma once
#include <packet2_utils.h>
#include <string>
#include "../../stdpip_vu1_program.hpp"
namespace Tyra {
class StdpipCullTDVU1Program : public StdpipVU1Program {
public:
StdpipCullTDVU1Program();
~StdpipCullTDVU1Program();
std::string getStringName() const;
void addProgramQBufferDataToPacket(packet2_t* packet,
StdpipQBuffer* qbuffer) const;
};
} // namespace Tyra
@@ -1,49 +0,0 @@
/*
# ______ ____ ___
# | \/ ____| |___|
# | | | \ | |
#-----------------------------------------------------------------------
# Copyright 2022, tyra - https://github.com/h4570/tyra
# Licenced under Apache License 2.0
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
*/
#pragma once
#include "debug/debug.hpp"
#include "renderer/core/paths/path1/vu1_program.hpp"
#include "./programs/as_is/stdpip_as_is_c_vu1_program.hpp"
#include "./programs/as_is/stdpip_as_is_d_vu1_program.hpp"
#include "./programs/as_is/stdpip_as_is_td_vu1_program.hpp"
#include "./programs/as_is/stdpip_as_is_tc_vu1_program.hpp"
#include "./programs/cull/stdpip_cull_c_vu1_program.hpp"
#include "./programs/cull/stdpip_cull_d_vu1_program.hpp"
#include "./programs/cull/stdpip_cull_td_vu1_program.hpp"
#include "./programs/cull/stdpip_cull_tc_vu1_program.hpp"
#include "renderer/core/paths/path1/programs/draw_finish/vu1_draw_finish.hpp"
namespace Tyra {
class StdpipProgramsRepository {
public:
StdpipProgramsRepository();
~StdpipProgramsRepository();
StdpipVU1Program* getProgram(const StdpipProgramName& name);
private:
StdpipAsIsCVU1Program asIsColor;
StdpipCullCVU1Program cullColor;
StdpipAsIsDVU1Program asIsLightingColor;
StdpipCullDVU1Program cullLightingColor;
StdpipAsIsTDVU1Program asIsLightingTextureColor;
StdpipCullTDVU1Program cullLightingTextureColor;
StdpipAsIsTCVU1Program asIsTextureColor;
StdpipCullTCVU1Program cullTextureColor;
VU1DrawFinish drawFinish;
};
} // namespace Tyra
@@ -11,11 +11,11 @@
#include <tamtypes.h>
#include <string>
#include <sstream>
#include "renderer/3d/pipeline/std/core/bag/packaging/stdpip_bag_package.hpp"
#include "renderer/3d/pipeline/static/core/bag/packaging/stapip_bag_package.hpp"
namespace Tyra {
StdpipBagPackage::StdpipBagPackage() {
StapipBagPackage::StapipBagPackage() {
size = 0;
bag = nullptr;
vertices = nullptr;
@@ -23,24 +23,24 @@ StdpipBagPackage::StdpipBagPackage() {
normals = nullptr;
colors = nullptr;
}
StdpipBagPackage::~StdpipBagPackage() {}
StapipBagPackage::~StapipBagPackage() {}
void StdpipBagPackage::print() const {
void StapipBagPackage::print() const {
auto text = getPrint(nullptr);
printf("%s\n", text.c_str());
}
void StdpipBagPackage::print(const char* name) const {
void StapipBagPackage::print(const char* name) const {
auto text = getPrint(name);
printf("%s\n", text.c_str());
}
std::string StdpipBagPackage::getPrint(const char* name) const {
std::string StapipBagPackage::getPrint(const char* name) const {
std::stringstream res;
if (name) {
res << name << "(";
} else {
res << "StdpipBagPackage(";
res << "StapipBagPackage(";
}
res << std::fixed << std::setprecision(2);
res << std::endl;
@@ -11,14 +11,14 @@
#include <tamtypes.h>
#include <math.h>
#include "debug/debug.hpp"
#include "renderer/3d/pipeline/std/core/bag/packaging/stdpip_bag_packager.hpp"
#include "renderer/3d/pipeline/static/core/bag/packaging/stapip_bag_packager.hpp"
namespace Tyra {
StdpipBagPackager::StdpipBagPackager() {}
StdpipBagPackager::~StdpipBagPackager() {}
StapipBagPackager::StapipBagPackager() {}
StapipBagPackager::~StapipBagPackager() {}
void StdpipBagPackager::init(Renderer3DFrustumPlanes* t_frustumPlanes) {
void StapipBagPackager::init(Renderer3DFrustumPlanes* t_frustumPlanes) {
frustumPlanes = t_frustumPlanes;
}
@@ -27,13 +27,13 @@ void StdpipBagPackager::init(Renderer3DFrustumPlanes* t_frustumPlanes) {
*
* @param size Max maxVertCount verts (VU1 buffer size)
*/
StdpipBagPackage* StdpipBagPackager::create(u16* o_size, StdpipBag* data,
StapipBagPackage* StapipBagPackager::create(u16* o_size, StapipBag* data,
u16 size) {
TYRA_ASSERT(size <= maxVertCount, "StdpipBagPackage can have max ",
TYRA_ASSERT(size <= maxVertCount, "StapipBagPackage can have max ",
maxVertCount, " verts. Provided \"", size, "\"");
*o_size = ceil(data->count / static_cast<float>(size));
StdpipBagPackage* result = new StdpipBagPackage[*o_size];
StapipBagPackage* result = new StapipBagPackage[*o_size];
for (u16 i = 0; i < *o_size; i++) {
result[i].bag = data;
@@ -65,14 +65,14 @@ StdpipBagPackage* StdpipBagPackager::create(u16* o_size, StdpipBag* data,
*
* @param size Max maxVertCount verts (VU1 buffer size)
*/
StdpipBagPackage* StdpipBagPackager::create(u16* o_count,
const StdpipBagPackage& pkg,
StapipBagPackage* StapipBagPackager::create(u16* o_count,
const StapipBagPackage& pkg,
u16 size) {
TYRA_ASSERT(size <= maxVertCount, "StdpipBagPackage can have max ",
TYRA_ASSERT(size <= maxVertCount, "StapipBagPackage can have max ",
maxVertCount, " verts. Provided \"", size, "\"");
*o_count = ceil(pkg.size / static_cast<float>(size));
auto* result = new StdpipBagPackage[*o_count];
auto* result = new StapipBagPackage[*o_count];
for (u16 i = 0; i < *o_count; i++) {
result[i].bag = pkg.bag;
@@ -99,7 +99,7 @@ StdpipBagPackage* StdpipBagPackager::create(u16* o_count,
return result;
}
CoreBBoxFrustum StdpipBagPackager::checkFrustum(const StdpipBagPackage& pkg) {
CoreBBoxFrustum StapipBagPackager::checkFrustum(const StapipBagPackage& pkg) {
if (pkg.size <= (maxVertCount / 3)) { // Is subpackage
auto& bbox = renderBBox->getChildBBox1By3(pkg.indexOf1By3BBox);
return bbox.clipIsInFrustum(frustumPlanes->getAll(), *pkg.bag->info->model);
@@ -112,7 +112,7 @@ CoreBBoxFrustum StdpipBagPackager::checkFrustum(const StdpipBagPackage& pkg) {
}
}
void StdpipBagPackager::setMaxVertCount(const u32& count) {
void StapipBagPackager::setMaxVertCount(const u32& count) {
maxVertCount = count;
}
@@ -13,11 +13,11 @@
#include <sstream>
#include <vector>
#include "debug/debug.hpp"
#include "renderer/3d/pipeline/std/core/bag/packaging/stdpip_bag_packages_bbox.hpp"
#include "renderer/3d/pipeline/static/core/bag/packaging/stapip_bag_packages_bbox.hpp"
namespace Tyra {
StdpipBagPackagesBBox::StdpipBagPackagesBBox(Vec4* t_vertices, u32* t_faces,
StapipBagPackagesBBox::StapipBagPackagesBBox(Vec4* t_vertices, u32* t_faces,
const u32& t_facesCount,
const u32& t_maxVertCount) {
u32 splitPartSize = t_maxVertCount / 3;
@@ -34,7 +34,7 @@ StdpipBagPackagesBBox::StdpipBagPackagesBBox(Vec4* t_vertices, u32* t_faces,
mainBBox = new RenderBBox(*bboxParts, 0, partsCount);
}
StdpipBagPackagesBBox::StdpipBagPackagesBBox(Vec4* t_vertices,
StapipBagPackagesBBox::StapipBagPackagesBBox(Vec4* t_vertices,
const u32& t_count,
const u32& t_maxVertCount) {
u32 splitPartSize = t_maxVertCount / 3;
@@ -51,40 +51,40 @@ StdpipBagPackagesBBox::StdpipBagPackagesBBox(Vec4* t_vertices,
mainBBox = new RenderBBox(*bboxParts, 0, partsCount);
}
const RenderBBox& StdpipBagPackagesBBox::getChildBBox1By3(
const RenderBBox& StapipBagPackagesBBox::getChildBBox1By3(
const u32& index) const {
TYRA_ASSERT(index < partsCount,
"Index out of range. Provided index: ", index);
return static_cast<RenderBBox&>(bboxParts->at(index));
}
RenderBBox* StdpipBagPackagesBBox::getMainBBox() { return mainBBox; }
RenderBBox* StapipBagPackagesBBox::getMainBBox() { return mainBBox; }
const u32& StdpipBagPackagesBBox::getPartsCount() const { return partsCount; }
const u32& StapipBagPackagesBBox::getPartsCount() const { return partsCount; }
const u32& StdpipBagPackagesBBox::getVertexCount() const { return vertexCount; }
const u32& StapipBagPackagesBBox::getVertexCount() const { return vertexCount; }
RenderBBox StdpipBagPackagesBBox::createChildBBox(const u32& index,
RenderBBox StapipBagPackagesBBox::createChildBBox(const u32& index,
const u16& partsSize) const {
return RenderBBox(*bboxParts, index, partsSize);
}
void StdpipBagPackagesBBox::print() const {
void StapipBagPackagesBBox::print() const {
auto text = getPrint(nullptr);
printf("%s\n", text.c_str());
}
void StdpipBagPackagesBBox::print(const char* name) const {
void StapipBagPackagesBBox::print(const char* name) const {
auto text = getPrint(name);
printf("%s\n", text.c_str());
}
std::string StdpipBagPackagesBBox::getPrint(const char* name) const {
std::string StapipBagPackagesBBox::getPrint(const char* name) const {
std::stringstream res;
if (name) {
res << name << "(";
} else {
res << "StdpipBagPackagesBBox(";
res << "StapipBagPackagesBBox(";
}
res << std::fixed << std::setprecision(2);
res << std::endl;
@@ -105,7 +105,7 @@ std::string StdpipBagPackagesBBox::getPrint(const char* name) const {
return res.str();
}
StdpipBagPackagesBBox::~StdpipBagPackagesBBox() {
StapipBagPackagesBBox::~StapipBagPackagesBBox() {
delete bboxParts;
delete mainBBox;
}
@@ -9,41 +9,41 @@
*/
#include <string>
#include "renderer/3d/pipeline/std/core/bag/stdpip_bag.hpp"
#include "renderer/3d/pipeline/static/core/bag/stapip_bag.hpp"
namespace Tyra {
StdpipBag::StdpipBag() {
StapipBag::StapipBag() {
info = nullptr;
color = nullptr;
texture = nullptr;
lighting = nullptr;
}
StdpipBag::~StdpipBag() {}
StapipBag::~StapipBag() {}
StdpipBagPackagesBBox StdpipBag::calculateBbox(const u32& maxVertCount) {
StapipBagPackagesBBox StapipBag::calculateBbox(const u32& maxVertCount) {
TYRA_ASSERT(vertices != nullptr, "Vertices are required to calculate bbox");
TYRA_ASSERT(count > 0, "Count must be greater than 0 to calculate bbox");
return StdpipBagPackagesBBox(vertices, count, maxVertCount);
return StapipBagPackagesBBox(vertices, count, maxVertCount);
}
void StdpipBag::print() const {
void StapipBag::print() const {
auto text = getPrint(nullptr);
printf("%s\n", text.c_str());
}
void StdpipBag::print(const char* name) const {
void StapipBag::print(const char* name) const {
auto text = getPrint(name);
printf("%s\n", text.c_str());
}
std::string StdpipBag::getPrint(const char* name) const {
std::string StapipBag::getPrint(const char* name) const {
std::stringstream res;
if (name) {
res << name << "(";
} else {
res << "StdpipBag(";
res << "StapipBag(";
}
res << std::fixed << std::setprecision(4);
res << std::endl;
@@ -8,15 +8,15 @@
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
*/
#include "renderer/3d/pipeline/std/core/bag/stdpip_color_bag.hpp"
#include "renderer/3d/pipeline/static/core/bag/stapip_color_bag.hpp"
namespace Tyra {
StdpipColorBag::StdpipColorBag() {
StapipColorBag::StapipColorBag() {
single = nullptr;
many = nullptr;
}
StdpipColorBag::~StdpipColorBag() {}
StapipColorBag::~StapipColorBag() {}
} // namespace Tyra
@@ -8,17 +8,17 @@
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
*/
#include "renderer/3d/pipeline/std/core/bag/stdpip_info_bag.hpp"
#include "renderer/3d/pipeline/static/core/bag/stapip_info_bag.hpp"
namespace Tyra {
StdpipInfoBag::StdpipInfoBag() {
shadingType = StdpipShadingFlat;
StapipInfoBag::StapipInfoBag() {
shadingType = StapipShadingFlat;
blendingEnabled = true;
antiAliasingEnabled = false;
model = nullptr;
}
StdpipInfoBag::~StdpipInfoBag() {}
StapipInfoBag::~StapipInfoBag() {}
} // namespace Tyra
@@ -9,11 +9,11 @@
*/
#include "debug/debug.hpp"
#include "renderer/3d/pipeline/std/core/bag/stdpip_lighting_bag.hpp"
#include "renderer/3d/pipeline/static/core/bag/stapip_lighting_bag.hpp"
namespace Tyra {
StdpipLightingBag::StdpipLightingBag(const bool& manual) {
StapipLightingBag::StapipLightingBag(const bool& manual) {
isAllocated = false;
mode = Auto;
normals = nullptr;
@@ -27,24 +27,24 @@ StdpipLightingBag::StdpipLightingBag(const bool& manual) {
}
}
StdpipLightingBag::~StdpipLightingBag() { deallocate(); }
StapipLightingBag::~StapipLightingBag() { deallocate(); }
void StdpipLightingBag::setAmbientColor(const Color& color) {
void StapipLightingBag::setAmbientColor(const Color& color) {
TYRA_ASSERT(mode != Manual, "Ambient color cannot be set in manual mode");
lightColors[3].set(reinterpret_cast<const Vec4&>(color));
}
void StdpipLightingBag::setDirectionalLightColors(Color* colors,
void StapipLightingBag::setDirectionalLightColors(Color* colors,
const u8& count) {
for (u8 i = 0; i < count; i++) setDirectionalLightColor(colors[i], i);
}
void StdpipLightingBag::setDirectionalLightDirections(Vec4* directions,
void StapipLightingBag::setDirectionalLightDirections(Vec4* directions,
const u8& count) {
for (u8 i = 0; i < count; i++) setDirectionalLightDirection(directions[i], i);
}
void StdpipLightingBag::setDirectionalLightColor(const Color& color,
void StapipLightingBag::setDirectionalLightColor(const Color& color,
const u8& index) {
TYRA_ASSERT(mode != Manual,
"Directional lights cannot be set in manual mode");
@@ -52,7 +52,7 @@ void StdpipLightingBag::setDirectionalLightColor(const Color& color,
lightColors[index].set(reinterpret_cast<const Vec4&>(color));
}
void StdpipLightingBag::setDirectionalLightDirection(const Vec4& direction,
void StapipLightingBag::setDirectionalLightDirection(const Vec4& direction,
const u8& index) {
TYRA_ASSERT(mode != Manual,
"Directional lights cannot be set in manual mode");
@@ -61,19 +61,19 @@ void StdpipLightingBag::setDirectionalLightDirection(const Vec4& direction,
lightDirections[index].set(direction);
}
void StdpipLightingBag::setLightsManually(Vec4* colors, Vec4* directions) {
void StapipLightingBag::setLightsManually(Vec4* colors, Vec4* directions) {
deallocate();
lightColors = colors;
lightDirections = directions;
mode = Manual;
}
void StdpipLightingBag::disableManualMode() {
void StapipLightingBag::disableManualMode() {
allocate();
mode = Auto;
}
void StdpipLightingBag::allocate() {
void StapipLightingBag::allocate() {
if (isAllocated) return;
lightColors = new Vec4[4];
@@ -92,27 +92,27 @@ void StdpipLightingBag::allocate() {
isAllocated = true;
}
void StdpipLightingBag::deallocate() {
void StapipLightingBag::deallocate() {
if (!isAllocated) return;
forceDeallocate();
}
void StdpipLightingBag::forceDeallocate() {
void StapipLightingBag::forceDeallocate() {
forceDeallocateColors();
forceDeallocateDirections();
isAllocated = false;
}
void StdpipLightingBag::forceDeallocateColors() {
void StapipLightingBag::forceDeallocateColors() {
if (lightColors != nullptr) {
delete[] lightColors;
lightColors = nullptr;
}
}
void StdpipLightingBag::forceDeallocateDirections() {
void StapipLightingBag::forceDeallocateDirections() {
if (lightDirections != nullptr) {
delete[] lightDirections;
lightDirections = nullptr;
@@ -8,15 +8,15 @@
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
*/
#include "renderer/3d/pipeline/std/core/bag/stdpip_texture_bag.hpp"
#include "renderer/3d/pipeline/static/core/bag/stapip_texture_bag.hpp"
namespace Tyra {
StdpipTextureBag::StdpipTextureBag() {
StapipTextureBag::StapipTextureBag() {
coordinates = nullptr;
texture = nullptr;
}
StdpipTextureBag::~StdpipTextureBag() {}
StapipTextureBag::~StapipTextureBag() {}
} // namespace Tyra
@@ -13,14 +13,14 @@
;---------------------------------------------------------------
.syntax new
.name StdpipVU1As_Is_C
.name StapipVU1As_Is_C
.vu
.init_vf_all
.init_vi_all
#include "src/renderer/core/paths/path1/programs/vcl_sml.i"
#include "src/renderer/core/paths/path1/programs/tyra_macros.i"
#include "inc/renderer/3d/pipeline/std/core/path1/programs/stdpip_vu1_shared_defines.h"
#include "inc/renderer/3d/pipeline/static/core/programs/stapip_vu1_shared_defines.h"
#define RGBA_STORE_OFFSET 0
#define XYZ2_STORE_OFFSET 1
@@ -28,7 +28,7 @@
--enter
--endenter
#vuprog StdpipVU1AsIsC
#vuprog StapipVU1AsIsC
LoadTyraStaticData{ gifSetTag }
LoadTyraSingleColor{ singleColor, singleColorEnabled, VU1_SINGLE_COLOR_ADDR, VU1_OPTIONS_ADDR }
@@ -9,27 +9,27 @@
*/
#include "debug/debug.hpp"
#include "renderer/3d/pipeline/std/core/path1/programs/as_is/stdpip_as_is_c_vu1_program.hpp"
#include "renderer/3d/pipeline/static/core/programs/as_is/stapip_as_is_c_vu1_program.hpp"
extern u32 StdpipVU1As_Is_C_CodeStart __attribute__((section(".vudata")));
extern u32 StdpipVU1As_Is_C_CodeEnd __attribute__((section(".vudata")));
extern u32 StapipVU1As_Is_C_CodeStart __attribute__((section(".vudata")));
extern u32 StapipVU1As_Is_C_CodeEnd __attribute__((section(".vudata")));
namespace Tyra {
StdpipAsIsCVU1Program::StdpipAsIsCVU1Program()
: StdpipVU1Program(StdpipAsIsColor, &StdpipVU1As_Is_C_CodeStart,
&StdpipVU1As_Is_C_CodeEnd,
StapipAsIsCVU1Program::StapipAsIsCVU1Program()
: StapipVU1Program(StapipAsIsColor, &StapipVU1As_Is_C_CodeStart,
&StapipVU1As_Is_C_CodeEnd,
((u64)GIF_REG_RGBAQ) << 0 | ((u64)GIF_REG_XYZ2) << 4, 2,
2) {}
StdpipAsIsCVU1Program::~StdpipAsIsCVU1Program() {}
StapipAsIsCVU1Program::~StapipAsIsCVU1Program() {}
std::string StdpipAsIsCVU1Program::getStringName() const {
std::string StapipAsIsCVU1Program::getStringName() const {
return std::string("As is - C");
}
void StdpipAsIsCVU1Program::addProgramQBufferDataToPacket(
packet2_t* packet, StdpipQBuffer* qbuffer) const {
void StapipAsIsCVU1Program::addProgramQBufferDataToPacket(
packet2_t* packet, StapipQBuffer* qbuffer) const {
u32 addr = VU1_VERT_DATA_ADDR;
// Add vertices
@@ -13,14 +13,14 @@
;---------------------------------------------------------------
.syntax new
.name StdpipVU1As_Is_D
.name StapipVU1As_Is_D
.vu
.init_vf_all
.init_vi_all
#include "src/renderer/core/paths/path1/programs/vcl_sml.i"
#include "src/renderer/core/paths/path1/programs/tyra_macros.i"
#include "inc/renderer/3d/pipeline/std/core/path1/programs/stdpip_vu1_shared_defines.h"
#include "inc/renderer/3d/pipeline/static/core/programs/stapip_vu1_shared_defines.h"
#define RGBA_STORE_OFFSET 0
#define XYZ2_STORE_OFFSET 1
@@ -28,7 +28,7 @@
--enter
--endenter
#vuprog StdpipVU1AsIsD
#vuprog StapipVU1AsIsD
LoadTyraStaticData{ gifSetTag }
LoadTyraDirectionalLights{ lightMatrix, lightDirections, lightColors, ambientColor, VU1_LIGHTS_DIRS_ADDR, VU1_LIGHTS_COLORS_ADDR, VU1_LIGHTS_MATRIX_ADDR }
@@ -9,27 +9,27 @@
*/
#include "debug/debug.hpp"
#include "renderer/3d/pipeline/std/core/path1/programs/as_is/stdpip_as_is_d_vu1_program.hpp"
#include "renderer/3d/pipeline/static/core/programs/as_is/stapip_as_is_d_vu1_program.hpp"
extern u32 StdpipVU1As_Is_D_CodeStart __attribute__((section(".vudata")));
extern u32 StdpipVU1As_Is_D_CodeEnd __attribute__((section(".vudata")));
extern u32 StapipVU1As_Is_D_CodeStart __attribute__((section(".vudata")));
extern u32 StapipVU1As_Is_D_CodeEnd __attribute__((section(".vudata")));
namespace Tyra {
StdpipAsIsDVU1Program::StdpipAsIsDVU1Program()
: StdpipVU1Program(StdpipAsIsDirLights, &StdpipVU1As_Is_D_CodeStart,
&StdpipVU1As_Is_D_CodeEnd,
StapipAsIsDVU1Program::StapipAsIsDVU1Program()
: StapipVU1Program(StapipAsIsDirLights, &StapipVU1As_Is_D_CodeStart,
&StapipVU1As_Is_D_CodeEnd,
((u64)GIF_REG_RGBAQ) << 0 | ((u64)GIF_REG_XYZ2) << 4, 2,
3) {}
StdpipAsIsDVU1Program::~StdpipAsIsDVU1Program() {}
StapipAsIsDVU1Program::~StapipAsIsDVU1Program() {}
std::string StdpipAsIsDVU1Program::getStringName() const {
std::string StapipAsIsDVU1Program::getStringName() const {
return std::string("As is - LC");
}
void StdpipAsIsDVU1Program::addProgramQBufferDataToPacket(
packet2_t* packet, StdpipQBuffer* qbuffer) const {
void StapipAsIsDVU1Program::addProgramQBufferDataToPacket(
packet2_t* packet, StapipQBuffer* qbuffer) const {
u32 addr = VU1_VERT_DATA_ADDR;
// Add vertices
@@ -13,14 +13,14 @@
;---------------------------------------------------------------
.syntax new
.name StdpipVU1As_Is_TC
.name StapipVU1As_Is_TC
.vu
.init_vf_all
.init_vi_all
#include "src/renderer/core/paths/path1/programs/vcl_sml.i"
#include "src/renderer/core/paths/path1/programs/tyra_macros.i"
#include "inc/renderer/3d/pipeline/std/core/path1/programs/stdpip_vu1_shared_defines.h"
#include "inc/renderer/3d/pipeline/static/core/programs/stapip_vu1_shared_defines.h"
#define STQ_STORE_OFFSET 0
#define RGBA_STORE_OFFSET 1
@@ -29,7 +29,7 @@
--enter
--endenter
#vuprog StdpipVU1AsIsTC
#vuprog StapipVU1AsIsTC
LoadTyraStaticData{ gifSetTag }
LoadTyraSingleColor{ singleColor, singleColorEnabled, VU1_SINGLE_COLOR_ADDR, VU1_OPTIONS_ADDR }
@@ -9,28 +9,28 @@
*/
#include "debug/debug.hpp"
#include "renderer/3d/pipeline/std/core/path1/programs/as_is/stdpip_as_is_tc_vu1_program.hpp"
#include "renderer/3d/pipeline/static/core/programs/as_is/stapip_as_is_tc_vu1_program.hpp"
extern u32 StdpipVU1As_Is_TC_CodeStart __attribute__((section(".vudata")));
extern u32 StdpipVU1As_Is_TC_CodeEnd __attribute__((section(".vudata")));
extern u32 StapipVU1As_Is_TC_CodeStart __attribute__((section(".vudata")));
extern u32 StapipVU1As_Is_TC_CodeEnd __attribute__((section(".vudata")));
namespace Tyra {
StdpipAsIsTCVU1Program::StdpipAsIsTCVU1Program()
: StdpipVU1Program(StdpipAsIsTextureColor, &StdpipVU1As_Is_TC_CodeStart,
&StdpipVU1As_Is_TC_CodeEnd,
StapipAsIsTCVU1Program::StapipAsIsTCVU1Program()
: StapipVU1Program(StapipAsIsTextureColor, &StapipVU1As_Is_TC_CodeStart,
&StapipVU1As_Is_TC_CodeEnd,
((u64)GIF_REG_ST) << 0 | ((u64)GIF_REG_RGBAQ) << 4 |
((u64)GIF_REG_XYZ2) << 8,
3, 3) {}
StdpipAsIsTCVU1Program::~StdpipAsIsTCVU1Program() {}
StapipAsIsTCVU1Program::~StapipAsIsTCVU1Program() {}
std::string StdpipAsIsTCVU1Program::getStringName() const {
std::string StapipAsIsTCVU1Program::getStringName() const {
return std::string("As is - TC");
}
void StdpipAsIsTCVU1Program::addProgramQBufferDataToPacket(
packet2_t* packet, StdpipQBuffer* qbuffer) const {
void StapipAsIsTCVU1Program::addProgramQBufferDataToPacket(
packet2_t* packet, StapipQBuffer* qbuffer) const {
u32 addr = VU1_VERT_DATA_ADDR;
// Add vertices
@@ -13,14 +13,14 @@
;---------------------------------------------------------------
.syntax new
.name StdpipVU1As_Is_TD
.name StapipVU1As_Is_TD
.vu
.init_vf_all
.init_vi_all
#include "src/renderer/core/paths/path1/programs/vcl_sml.i"
#include "src/renderer/core/paths/path1/programs/tyra_macros.i"
#include "inc/renderer/3d/pipeline/std/core/path1/programs/stdpip_vu1_shared_defines.h"
#include "inc/renderer/3d/pipeline/static/core/programs/stapip_vu1_shared_defines.h"
#define STQ_STORE_OFFSET 0
#define RGBA_STORE_OFFSET 1
@@ -29,7 +29,7 @@
--enter
--endenter
#vuprog StdpipVU1AsIsTD
#vuprog StapipVU1AsIsTD
LoadTyraStaticData{ gifSetTag }
LoadTyraDirectionalLights{ lightMatrix, lightDirections, lightColors, ambientColor, VU1_LIGHTS_DIRS_ADDR, VU1_LIGHTS_COLORS_ADDR, VU1_LIGHTS_MATRIX_ADDR }
@@ -9,28 +9,28 @@
*/
#include "debug/debug.hpp"
#include "renderer/3d/pipeline/std/core/path1/programs/as_is/stdpip_as_is_td_vu1_program.hpp"
#include "renderer/3d/pipeline/static/core/programs/as_is/stapip_as_is_td_vu1_program.hpp"
extern u32 StdpipVU1As_Is_TD_CodeStart __attribute__((section(".vudata")));
extern u32 StdpipVU1As_Is_TD_CodeEnd __attribute__((section(".vudata")));
extern u32 StapipVU1As_Is_TD_CodeStart __attribute__((section(".vudata")));
extern u32 StapipVU1As_Is_TD_CodeEnd __attribute__((section(".vudata")));
namespace Tyra {
StdpipAsIsTDVU1Program::StdpipAsIsTDVU1Program()
: StdpipVU1Program(StdpipAsIsTextureDirLights, &StdpipVU1As_Is_TD_CodeStart,
&StdpipVU1As_Is_TD_CodeEnd,
StapipAsIsTDVU1Program::StapipAsIsTDVU1Program()
: StapipVU1Program(StapipAsIsTextureDirLights, &StapipVU1As_Is_TD_CodeStart,
&StapipVU1As_Is_TD_CodeEnd,
((u64)GIF_REG_ST) << 0 | ((u64)GIF_REG_RGBAQ) << 4 |
((u64)GIF_REG_XYZ2) << 8,
3, 4) {}
StdpipAsIsTDVU1Program::~StdpipAsIsTDVU1Program() {}
StapipAsIsTDVU1Program::~StapipAsIsTDVU1Program() {}
std::string StdpipAsIsTDVU1Program::getStringName() const {
std::string StapipAsIsTDVU1Program::getStringName() const {
return std::string("As is - LTC");
}
void StdpipAsIsTDVU1Program::addProgramQBufferDataToPacket(
packet2_t* packet, StdpipQBuffer* qbuffer) const {
void StapipAsIsTDVU1Program::addProgramQBufferDataToPacket(
packet2_t* packet, StapipQBuffer* qbuffer) const {
u32 addr = VU1_VERT_DATA_ADDR;
// Add vertices
@@ -13,14 +13,14 @@
;---------------------------------------------------------------
.syntax new
.name StdpipVU1Cull_C
.name StapipVU1Cull_C
.vu
.init_vf_all
.init_vi_all
#include "src/renderer/core/paths/path1/programs/vcl_sml.i"
#include "src/renderer/core/paths/path1/programs/tyra_macros.i"
#include "inc/renderer/3d/pipeline/std/core/path1/programs/stdpip_vu1_shared_defines.h"
#include "inc/renderer/3d/pipeline/static/core/programs/stapip_vu1_shared_defines.h"
#define RGBA_STORE_OFFSET 0
#define XYZ2_STORE_OFFSET 1
@@ -28,7 +28,7 @@
--enter
--endenter
#vuprog StdpipVU1CullC
#vuprog StapipVU1CullC
ResetClipFlags{ }
LoadTyraStaticData{ gifSetTag }
@@ -9,26 +9,26 @@
*/
#include "debug/debug.hpp"
#include "renderer/3d/pipeline/std/core/path1/programs/cull/stdpip_cull_c_vu1_program.hpp"
#include "renderer/3d/pipeline/static/core/programs/cull/stapip_cull_c_vu1_program.hpp"
extern u32 StdpipVU1Cull_C_CodeStart __attribute__((section(".vudata")));
extern u32 StdpipVU1Cull_C_CodeEnd __attribute__((section(".vudata")));
extern u32 StapipVU1Cull_C_CodeStart __attribute__((section(".vudata")));
extern u32 StapipVU1Cull_C_CodeEnd __attribute__((section(".vudata")));
namespace Tyra {
StdpipCullCVU1Program::StdpipCullCVU1Program()
: StdpipVU1Program(
StdpipCullColor, &StdpipVU1Cull_C_CodeStart, &StdpipVU1Cull_C_CodeEnd,
StapipCullCVU1Program::StapipCullCVU1Program()
: StapipVU1Program(
StapipCullColor, &StapipVU1Cull_C_CodeStart, &StapipVU1Cull_C_CodeEnd,
((u64)GIF_REG_RGBAQ) << 0 | ((u64)GIF_REG_XYZ2) << 4, 2, 2) {}
StdpipCullCVU1Program::~StdpipCullCVU1Program() {}
StapipCullCVU1Program::~StapipCullCVU1Program() {}
std::string StdpipCullCVU1Program::getStringName() const {
std::string StapipCullCVU1Program::getStringName() const {
return std::string("Cull - C");
}
void StdpipCullCVU1Program::addProgramQBufferDataToPacket(
packet2_t* packet, StdpipQBuffer* qbuffer) const {
void StapipCullCVU1Program::addProgramQBufferDataToPacket(
packet2_t* packet, StapipQBuffer* qbuffer) const {
u32 addr = VU1_VERT_DATA_ADDR;
// Add vertices
@@ -13,14 +13,14 @@
;---------------------------------------------------------------
.syntax new
.name StdpipVU1Cull_D
.name StapipVU1Cull_D
.vu
.init_vf_all
.init_vi_all
#include "src/renderer/core/paths/path1/programs/vcl_sml.i"
#include "src/renderer/core/paths/path1/programs/tyra_macros.i"
#include "inc/renderer/3d/pipeline/std/core/path1/programs/stdpip_vu1_shared_defines.h"
#include "inc/renderer/3d/pipeline/static/core/programs/stapip_vu1_shared_defines.h"
#define RGBA_STORE_OFFSET 0
#define XYZ2_STORE_OFFSET 1
@@ -28,7 +28,7 @@
--enter
--endenter
#vuprog StdpipVU1CullD
#vuprog StapipVU1CullD
ResetClipFlags{ }
LoadTyraStaticData{ gifSetTag }
@@ -9,27 +9,27 @@
*/
#include "debug/debug.hpp"
#include "renderer/3d/pipeline/std/core/path1/programs/cull/stdpip_cull_d_vu1_program.hpp"
#include "renderer/3d/pipeline/static/core/programs/cull/stapip_cull_d_vu1_program.hpp"
extern u32 StdpipVU1Cull_D_CodeStart __attribute__((section(".vudata")));
extern u32 StdpipVU1Cull_D_CodeEnd __attribute__((section(".vudata")));
extern u32 StapipVU1Cull_D_CodeStart __attribute__((section(".vudata")));
extern u32 StapipVU1Cull_D_CodeEnd __attribute__((section(".vudata")));
namespace Tyra {
StdpipCullDVU1Program::StdpipCullDVU1Program()
: StdpipVU1Program(StdpipCullDirLights, &StdpipVU1Cull_D_CodeStart,
&StdpipVU1Cull_D_CodeEnd,
StapipCullDVU1Program::StapipCullDVU1Program()
: StapipVU1Program(StapipCullDirLights, &StapipVU1Cull_D_CodeStart,
&StapipVU1Cull_D_CodeEnd,
((u64)GIF_REG_RGBAQ) << 0 | ((u64)GIF_REG_XYZ2) << 4, 2,
3) {}
StdpipCullDVU1Program::~StdpipCullDVU1Program() {}
StapipCullDVU1Program::~StapipCullDVU1Program() {}
std::string StdpipCullDVU1Program::getStringName() const {
std::string StapipCullDVU1Program::getStringName() const {
return std::string("Cull - LC");
}
void StdpipCullDVU1Program::addProgramQBufferDataToPacket(
packet2_t* packet, StdpipQBuffer* qbuffer) const {
void StapipCullDVU1Program::addProgramQBufferDataToPacket(
packet2_t* packet, StapipQBuffer* qbuffer) const {
u32 addr = VU1_VERT_DATA_ADDR;
// Add vertices
@@ -13,14 +13,14 @@
;---------------------------------------------------------------
.syntax new
.name StdpipVU1Cull_TC
.name StapipVU1Cull_TC
.vu
.init_vf_all
.init_vi_all
#include "src/renderer/core/paths/path1/programs/vcl_sml.i"
#include "src/renderer/core/paths/path1/programs/tyra_macros.i"
#include "inc/renderer/3d/pipeline/std/core/path1/programs/stdpip_vu1_shared_defines.h"
#include "inc/renderer/3d/pipeline/static/core/programs/stapip_vu1_shared_defines.h"
#define STQ_STORE_OFFSET 0
#define RGBA_STORE_OFFSET 1
@@ -29,7 +29,7 @@
--enter
--endenter
#vuprog StdpipVU1CullTC
#vuprog StapipVU1CullTC
ResetClipFlags{ }
LoadTyraStaticData{ gifSetTag }
@@ -9,28 +9,28 @@
*/
#include "debug/debug.hpp"
#include "renderer/3d/pipeline/std/core/path1/programs/cull/stdpip_cull_tc_vu1_program.hpp"
#include "renderer/3d/pipeline/static/core/programs/cull/stapip_cull_tc_vu1_program.hpp"
extern u32 StdpipVU1Cull_TC_CodeStart __attribute__((section(".vudata")));
extern u32 StdpipVU1Cull_TC_CodeEnd __attribute__((section(".vudata")));
extern u32 StapipVU1Cull_TC_CodeStart __attribute__((section(".vudata")));
extern u32 StapipVU1Cull_TC_CodeEnd __attribute__((section(".vudata")));
namespace Tyra {
StdpipCullTCVU1Program::StdpipCullTCVU1Program()
: StdpipVU1Program(StdpipCullTextureColor, &StdpipVU1Cull_TC_CodeStart,
&StdpipVU1Cull_TC_CodeEnd,
StapipCullTCVU1Program::StapipCullTCVU1Program()
: StapipVU1Program(StapipCullTextureColor, &StapipVU1Cull_TC_CodeStart,
&StapipVU1Cull_TC_CodeEnd,
((u64)GIF_REG_ST) << 0 | ((u64)GIF_REG_RGBAQ) << 4 |
((u64)GIF_REG_XYZ2) << 8,
3, 3) {}
StdpipCullTCVU1Program::~StdpipCullTCVU1Program() {}
StapipCullTCVU1Program::~StapipCullTCVU1Program() {}
std::string StdpipCullTCVU1Program::getStringName() const {
std::string StapipCullTCVU1Program::getStringName() const {
return std::string("Cull - TC");
}
void StdpipCullTCVU1Program::addProgramQBufferDataToPacket(
packet2_t* packet, StdpipQBuffer* qbuffer) const {
void StapipCullTCVU1Program::addProgramQBufferDataToPacket(
packet2_t* packet, StapipQBuffer* qbuffer) const {
u32 addr = VU1_VERT_DATA_ADDR;
// Add vertices
@@ -13,14 +13,14 @@
;---------------------------------------------------------------
.syntax new
.name StdpipVU1Cull_TD
.name StapipVU1Cull_TD
.vu
.init_vf_all
.init_vi_all
#include "src/renderer/core/paths/path1/programs/vcl_sml.i"
#include "src/renderer/core/paths/path1/programs/tyra_macros.i"
#include "inc/renderer/3d/pipeline/std/core/path1/programs/stdpip_vu1_shared_defines.h"
#include "inc/renderer/3d/pipeline/static/core/programs/stapip_vu1_shared_defines.h"
#define STQ_STORE_OFFSET 0
#define RGBA_STORE_OFFSET 1
@@ -29,7 +29,7 @@
--enter
--endenter
#vuprog StdpipVU1CullTD
#vuprog StapipVU1CullTD
ResetClipFlags{ }
LoadTyraStaticData{ gifSetTag }
@@ -9,28 +9,28 @@
*/
#include "debug/debug.hpp"
#include "renderer/3d/pipeline/std/core/path1/programs/cull/stdpip_cull_td_vu1_program.hpp"
#include "renderer/3d/pipeline/static/core/programs/cull/stapip_cull_td_vu1_program.hpp"
extern u32 StdpipVU1Cull_TD_CodeStart __attribute__((section(".vudata")));
extern u32 StdpipVU1Cull_TD_CodeEnd __attribute__((section(".vudata")));
extern u32 StapipVU1Cull_TD_CodeStart __attribute__((section(".vudata")));
extern u32 StapipVU1Cull_TD_CodeEnd __attribute__((section(".vudata")));
namespace Tyra {
StdpipCullTDVU1Program::StdpipCullTDVU1Program()
: StdpipVU1Program(StdpipCullTextureDirLights, &StdpipVU1Cull_TD_CodeStart,
&StdpipVU1Cull_TD_CodeEnd,
StapipCullTDVU1Program::StapipCullTDVU1Program()
: StapipVU1Program(StapipCullTextureDirLights, &StapipVU1Cull_TD_CodeStart,
&StapipVU1Cull_TD_CodeEnd,
((u64)GIF_REG_ST) << 0 | ((u64)GIF_REG_RGBAQ) << 4 |
((u64)GIF_REG_XYZ2) << 8,
3, 4) {}
StdpipCullTDVU1Program::~StdpipCullTDVU1Program() {}
StapipCullTDVU1Program::~StapipCullTDVU1Program() {}
std::string StdpipCullTDVU1Program::getStringName() const {
std::string StapipCullTDVU1Program::getStringName() const {
return std::string("Cull - LTC");
}
void StdpipCullTDVU1Program::addProgramQBufferDataToPacket(
packet2_t* packet, StdpipQBuffer* qbuffer) const {
void StapipCullTDVU1Program::addProgramQBufferDataToPacket(
packet2_t* packet, StapipQBuffer* qbuffer) const {
u32 addr = VU1_VERT_DATA_ADDR;
// Add vertices
@@ -8,22 +8,22 @@
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
*/
#include "renderer/3d/pipeline/std/core/path1/stdpip_clipper.hpp"
#include "renderer/3d/pipeline/static/core/stapip_clipper.hpp"
namespace Tyra {
StdpipClipper::StdpipClipper() {}
StdpipClipper::~StdpipClipper() {}
StapipClipper::StapipClipper() {}
StapipClipper::~StapipClipper() {}
void StdpipClipper::setMVP(M4x4* t_mvp) { mvp = t_mvp; }
void StapipClipper::setMVP(M4x4* t_mvp) { mvp = t_mvp; }
void StdpipClipper::init(const RendererSettings& settings) {
void StapipClipper::init(const RendererSettings& settings) {
algorithm.init(settings);
}
void StdpipClipper::setMaxVertCount(const u32& count) { maxVertCount = count; }
void StapipClipper::setMaxVertCount(const u32& count) { maxVertCount = count; }
void StdpipClipper::clip(StdpipQBuffer* buffer) {
void StapipClipper::clip(StapipQBuffer* buffer) {
TYRA_ASSERT(buffer->size <= maxVertCount / 3, "Buffer should have max ",
maxVertCount / 3, " verts if we want to clip it.");
@@ -64,14 +64,14 @@ void StdpipClipper::clip(StdpipQBuffer* buffer) {
moveDataToBuffer(clippedVertices, buffer);
}
void StdpipClipper::perspectiveDivide(std::vector<Path1ClipVertex>* vertices) {
void StapipClipper::perspectiveDivide(std::vector<Path1ClipVertex>* vertices) {
for (u32 i = 0; i < vertices->size(); i++) {
(*vertices)[i].position /= (*vertices)[i].position.w;
}
}
void StdpipClipper::moveDataToBuffer(
const std::vector<Path1ClipVertex>& vertices, StdpipQBuffer* buffer) {
void StapipClipper::moveDataToBuffer(
const std::vector<Path1ClipVertex>& vertices, StapipQBuffer* buffer) {
buffer->reallocateManually(vertices.size());
for (u32 i = 0; i < vertices.size(); i++) {
@@ -0,0 +1,48 @@
/*
# ______ ____ ___
# | \/ ____| |___|
# | | | \ | |
#-----------------------------------------------------------------------
# Copyright 2022, tyra - https://github.com/h4570/tyra
# Licenced under Apache License 2.0
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
*/
#include "renderer/3d/pipeline/static/core/stapip_programs_repository.hpp"
namespace Tyra {
StapipProgramsRepository::StapipProgramsRepository() {}
StapipProgramsRepository::~StapipProgramsRepository() {}
StapipVU1Program* StapipProgramsRepository::getProgram(
const StapipProgramName& name) {
switch (name) {
case StapipProgramName::StapipAsIsColor:
return &asIsColor;
case StapipProgramName::StapipCullColor:
return &cullColor;
case StapipProgramName::StapipAsIsDirLights:
return &asIsLightingColor;
case StapipProgramName::StapipCullDirLights:
return &cullLightingColor;
case StapipProgramName::StapipAsIsTextureDirLights:
return &asIsLightingTextureColor;
case StapipProgramName::StapipCullTextureDirLights:
return &cullLightingTextureColor;
case StapipProgramName::StapipAsIsTextureColor:
return &asIsTextureColor;
case StapipProgramName::StapipCullTextureColor:
return &cullTextureColor;
default:
TYRA_TRAP("Unknown VU1 program name");
return &cullLightingTextureColor;
}
}
} // namespace Tyra
@@ -8,11 +8,11 @@
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
*/
#include "renderer/3d/pipeline/std/core/path1/stdpip_qbuffer.hpp"
#include "renderer/3d/pipeline/static/core/stapip_qbuffer.hpp"
namespace Tyra {
StdpipQBuffer::StdpipQBuffer() {
StapipQBuffer::StapipQBuffer() {
size = 0;
_isDynamicallyAllocated = false;
_stAllocated = false;
@@ -25,11 +25,11 @@ StdpipQBuffer::StdpipQBuffer() {
normals = nullptr;
}
StdpipQBuffer::~StdpipQBuffer() { deallocateDynamicData(); }
StapipQBuffer::~StapipQBuffer() { deallocateDynamicData(); }
void StdpipQBuffer::setMaxVertCount(const u32& count) { maxVertCount = count; }
void StapipQBuffer::setMaxVertCount(const u32& count) { maxVertCount = count; }
void StdpipQBuffer::fillByPointer(const StdpipBagPackage& pkg) {
void StapipQBuffer::fillByPointer(const StapipBagPackage& pkg) {
TYRA_ASSERT(pkg.size <= maxVertCount, "VU1 buffer supports only ",
maxVertCount, " verts. Provided: ", pkg.size);
@@ -43,9 +43,9 @@ void StdpipQBuffer::fillByPointer(const StdpipBagPackage& pkg) {
bag = pkg.bag;
}
void StdpipQBuffer::fillByCopyMax(const StdpipBagPackage& pkg1,
const StdpipBagPackage& pkg2,
const StdpipBagPackage& pkg3) {
void StapipQBuffer::fillByCopyMax(const StapipBagPackage& pkg1,
const StapipBagPackage& pkg2,
const StapipBagPackage& pkg3) {
TYRA_ASSERT(pkg1.size <= maxVertCount / 3,
"Wrong package size (1). Provided: ", pkg1.size);
TYRA_ASSERT(pkg2.size <= maxVertCount / 3,
@@ -95,8 +95,8 @@ void StdpipQBuffer::fillByCopyMax(const StdpipBagPackage& pkg1,
bag = pkg1.bag;
}
void StdpipQBuffer::fillByCopy1By2(const StdpipBagPackage& pkg1,
const StdpipBagPackage& pkg2) {
void StapipQBuffer::fillByCopy1By2(const StapipBagPackage& pkg1,
const StapipBagPackage& pkg2) {
TYRA_ASSERT(pkg1.size <= maxVertCount / 3,
"Wrong package size (1). Provided: ", pkg1.size);
TYRA_ASSERT(pkg2.size <= maxVertCount / 3,
@@ -131,7 +131,7 @@ void StdpipQBuffer::fillByCopy1By2(const StdpipBagPackage& pkg1,
bag = pkg1.bag;
}
void StdpipQBuffer::fillByCopy1By3(const StdpipBagPackage& pkg) {
void StapipQBuffer::fillByCopy1By3(const StapipBagPackage& pkg) {
TYRA_ASSERT(pkg.size <= maxVertCount / 3,
"Wrong package size (1). Provided: ", pkg.size);
@@ -153,13 +153,13 @@ void StdpipQBuffer::fillByCopy1By3(const StdpipBagPackage& pkg) {
bag = pkg.bag;
}
void StdpipQBuffer::reallocateManually(const u16& t_size) {
void StapipQBuffer::reallocateManually(const u16& t_size) {
deallocateDynamicData();
allocateDynamicData(t_size, bag);
size = t_size;
}
void StdpipQBuffer::deallocateDynamicData() {
void StapipQBuffer::deallocateDynamicData() {
if (_isDynamicallyAllocated) {
delete[] vertices;
@@ -184,7 +184,7 @@ void StdpipQBuffer::deallocateDynamicData() {
/** When we not receive maxVertCount vertices, we must align it by ourself.
* Too bad - not efficient. */
void StdpipQBuffer::allocateDynamicData(u16 size, StdpipBag* bag) {
void StapipQBuffer::allocateDynamicData(u16 size, StapipBag* bag) {
TYRA_ASSERT(size <= maxVertCount, "Wrong size. Max buffer size in VU1 is ",
maxVertCount, ". Provided: ", size);
TYRA_ASSERT(!_isDynamicallyAllocated, "Buffer is already allocated");
@@ -209,19 +209,19 @@ void StdpipQBuffer::allocateDynamicData(u16 size, StdpipBag* bag) {
_isDynamicallyAllocated = true;
}
bool StdpipQBuffer::any() const { return size > 0; }
bool StapipQBuffer::any() const { return size > 0; }
void StdpipQBuffer::print() const {
void StapipQBuffer::print() const {
auto text = getPrint(nullptr);
printf("%s\n", text.c_str());
}
void StdpipQBuffer::print(const char* name) const {
void StapipQBuffer::print(const char* name) const {
auto text = getPrint(name);
printf("%s\n", text.c_str());
}
std::string StdpipQBuffer::getPrint(const char* name) const {
std::string StapipQBuffer::getPrint(const char* name) const {
std::stringstream res;
if (name) {
res << name << "(";
@@ -8,8 +8,8 @@
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
*/
#include "renderer/3d/pipeline/std/core/path1/stdpip_qbuffer_renderer.hpp"
#include "renderer/3d/pipeline/std/core/path1/programs/stdpip_vu1_shared_defines.h"
#include "renderer/3d/pipeline/static/core/stapip_qbuffer_renderer.hpp"
#include "renderer/3d/pipeline/static/core/programs/stapip_vu1_shared_defines.h"
namespace Tyra {
@@ -34,14 +34,14 @@ namespace Tyra {
*
*/
StdpipQBufferRenderer::StdpipQBufferRenderer() {
StapipQBufferRenderer::StapipQBufferRenderer() {
context = 0;
lastProgramName = StdipUndefinedProgram;
staticDataPacket = packet2_create(3, P2_TYPE_NORMAL, P2_MODE_CHAIN, true);
objectDataPacket = packet2_create(16, P2_TYPE_NORMAL, P2_MODE_CHAIN, true);
programsPacket = nullptr;
}
StdpipQBufferRenderer::~StdpipQBufferRenderer() {
StapipQBufferRenderer::~StapipQBufferRenderer() {
packet2_free(packets[0]);
packet2_free(packets[1]);
packet2_free(staticDataPacket);
@@ -50,7 +50,7 @@ StdpipQBufferRenderer::~StdpipQBufferRenderer() {
if (programsPacket) packet2_free(programsPacket);
}
void StdpipQBufferRenderer::init(RendererCore* t_core) {
void StapipQBufferRenderer::init(RendererCore* t_core) {
path1 = t_core->getPath1();
clipper.init(t_core->getSettings());
rendererCore = t_core;
@@ -73,16 +73,16 @@ void StdpipQBufferRenderer::init(RendererCore* t_core) {
TYRA_LOG("Renderer3DQBufferRenderer initialized");
}
void StdpipQBufferRenderer::reinitVU1() {
void StapipQBufferRenderer::reinitVU1() {
sendStaticData();
uploadPrograms();
setDoubleBuffer();
}
StdpipQBuffer* StdpipQBufferRenderer::getBuffer() { return &buffers[context]; }
StapipQBuffer* StapipQBufferRenderer::getBuffer() { return &buffers[context]; }
void StdpipQBufferRenderer::sendObjectData(
StdpipBag* bag, M4x4* mvp, RendererCoreTextureBuffers* texBuffers) const {
void StapipQBufferRenderer::sendObjectData(
StapipBag* bag, M4x4* mvp, RendererCoreTextureBuffers* texBuffers) const {
packet2_reset(objectDataPacket, false);
packet2_utils_vu_add_unpack_data(objectDataPacket, VU1_MVP_MATRIX_ADDR,
mvp->data, 4, false);
@@ -130,13 +130,13 @@ void StdpipQBufferRenderer::sendObjectData(
dma_channel_send_packet2(objectDataPacket, DMA_CHANNEL_VIF1, true);
}
void StdpipQBufferRenderer::setInfo(StdpipInfoBag* bag) {
void StapipQBufferRenderer::setInfo(StapipInfoBag* bag) {
rendererCore->gs.prim.antialiasing = bag->antiAliasingEnabled;
rendererCore->gs.prim.blending = bag->blendingEnabled;
rendererCore->gs.prim.shading = bag->shadingType;
}
void StdpipQBufferRenderer::sendStaticData() const {
void StapipQBufferRenderer::sendStaticData() const {
packet2_reset(staticDataPacket, false);
packet2_utils_vu_open_unpack(staticDataPacket, VU1_SET_GIFTAG_ADDR, false);
{ packet2_utils_gif_add_set(staticDataPacket, 1); }
@@ -147,27 +147,27 @@ void StdpipQBufferRenderer::sendStaticData() const {
dma_channel_send_packet2(staticDataPacket, DMA_CHANNEL_VIF1, true);
}
void StdpipQBufferRenderer::setProgramsCache() {
void StapipQBufferRenderer::setProgramsCache() {
VU1Program** programs = new VU1Program*[8];
programs[0] = repository.getProgram(StdpipCullColor);
programs[1] = repository.getProgram(StdpipAsIsColor);
programs[2] = repository.getProgram(StdpipCullDirLights);
programs[3] = repository.getProgram(StdpipAsIsDirLights);
programs[4] = repository.getProgram(StdpipCullTextureDirLights);
programs[5] = repository.getProgram(StdpipAsIsTextureDirLights);
programs[6] = repository.getProgram(StdpipCullTextureColor);
programs[7] = repository.getProgram(StdpipAsIsTextureColor);
programs[0] = repository.getProgram(StapipCullColor);
programs[1] = repository.getProgram(StapipAsIsColor);
programs[2] = repository.getProgram(StapipCullDirLights);
programs[3] = repository.getProgram(StapipAsIsDirLights);
programs[4] = repository.getProgram(StapipCullTextureDirLights);
programs[5] = repository.getProgram(StapipAsIsTextureDirLights);
programs[6] = repository.getProgram(StapipCullTextureColor);
programs[7] = repository.getProgram(StapipAsIsTextureColor);
programsPacket = path1->createProgramsCache(programs, 8, 0);
delete[] programs;
}
void StdpipQBufferRenderer::uploadPrograms() {
void StapipQBufferRenderer::uploadPrograms() {
dma_channel_wait(DMA_CHANNEL_VIF1, 0);
dma_channel_send_packet2(programsPacket, DMA_CHANNEL_VIF1, true);
dma_channel_wait(DMA_CHANNEL_VIF1, 0);
}
void StdpipQBufferRenderer::setDoubleBuffer() {
void StapipQBufferRenderer::setDoubleBuffer() {
u16 startingAddr = VU1_LAST_ITEM_ADDR + 1;
const u16 bufferMaxSize = 1000;
bufferSize = (bufferMaxSize - startingAddr) / 2;
@@ -178,7 +178,7 @@ void StdpipQBufferRenderer::setDoubleBuffer() {
// buffer, to first addr of second buffer
}
void StdpipQBufferRenderer::cull(StdpipQBuffer* buffer) {
void StapipQBufferRenderer::cull(StapipQBuffer* buffer) {
if (buffer->size == 0) {
return;
}
@@ -188,8 +188,8 @@ void StdpipQBufferRenderer::cull(StdpipQBuffer* buffer) {
sendPacket();
}
// void StdpipQBufferRenderer::sendFinishTag() {
// StdpipQBufferRenderer way proposition
// void StapipQBufferRenderer::sendFinishTag() {
// StapipQBufferRenderer way proposition
// auto program = path1->getProgramByName(Draw_Finish);
// addBufferDataToPacket(program, nullptr);
// sendPacket();
@@ -206,7 +206,7 @@ void StdpipQBufferRenderer::cull(StdpipQBuffer* buffer) {
// packet2_free(packet2);
// }
void StdpipQBufferRenderer::clip(StdpipQBuffer* buffer) {
void StapipQBufferRenderer::clip(StapipQBuffer* buffer) {
if (buffer->size == 0) {
return;
}
@@ -220,12 +220,12 @@ void StdpipQBufferRenderer::clip(StdpipQBuffer* buffer) {
}
}
void StdpipQBufferRenderer::clearLastProgramName() {
void StapipQBufferRenderer::clearLastProgramName() {
lastProgramName = StdipUndefinedProgram;
}
void StdpipQBufferRenderer::addBufferDataToPacket(StdpipVU1Program* program,
StdpipQBuffer* buffer) {
void StapipQBufferRenderer::addBufferDataToPacket(StapipVU1Program* program,
StapipQBuffer* buffer) {
currentPacket = packets[context];
packet2_reset(currentPacket, false);
@@ -241,7 +241,7 @@ void StdpipQBufferRenderer::addBufferDataToPacket(StdpipVU1Program* program,
packet2_utils_vu_add_end_tag(currentPacket);
}
void StdpipQBufferRenderer::sendPacket() {
void StapipQBufferRenderer::sendPacket() {
dma_channel_wait(DMA_CHANNEL_VIF1, 0);
dma_channel_send_packet2(currentPacket, DMA_CHANNEL_VIF1, true);
@@ -249,72 +249,72 @@ void StdpipQBufferRenderer::sendPacket() {
context = !context;
}
void StdpipQBufferRenderer::setMaxVertCount(const u32& count) {
void StapipQBufferRenderer::setMaxVertCount(const u32& count) {
buffers[0].setMaxVertCount(count);
buffers[1].setMaxVertCount(count);
clipper.setMaxVertCount(count);
}
StdpipVU1Program* StdpipQBufferRenderer::getAsIsProgramByBag(
const StdpipBag* bag) {
StapipVU1Program* StapipQBufferRenderer::getAsIsProgramByBag(
const StapipBag* bag) {
auto programType = getDrawProgramTypeByBag(bag);
if (programType == StdpipVU1TextureDirLights)
return getProgramByName(StdpipAsIsTextureDirLights);
else if (programType == StdpipVU1DirLights)
return getProgramByName(StdpipAsIsDirLights);
else if (programType == StdpipVU1TextureColor)
return getProgramByName(StdpipAsIsTextureColor);
if (programType == StapipVU1TextureDirLights)
return getProgramByName(StapipAsIsTextureDirLights);
else if (programType == StapipVU1DirLights)
return getProgramByName(StapipAsIsDirLights);
else if (programType == StapipVU1TextureColor)
return getProgramByName(StapipAsIsTextureColor);
else
return getProgramByName(StdpipAsIsColor);
return getProgramByName(StapipAsIsColor);
}
StdpipVU1Program* StdpipQBufferRenderer::getCullProgramByBag(
const StdpipBag* bag) {
StapipVU1Program* StapipQBufferRenderer::getCullProgramByBag(
const StapipBag* bag) {
auto programType = getDrawProgramTypeByBag(bag);
return getCullProgramByType(programType);
}
StdpipVU1Program* StdpipQBufferRenderer::getProgramByName(
const StdpipProgramName& name) {
StapipVU1Program* StapipQBufferRenderer::getProgramByName(
const StapipProgramName& name) {
return repository.getProgram(name);
}
StdpipVU1Program* StdpipQBufferRenderer::getCullProgramByParams(
StapipVU1Program* StapipQBufferRenderer::getCullProgramByParams(
const bool& isLightingEnabled, const bool& isTextureEnabled) {
auto type = getDrawProgramTypeByParams(isLightingEnabled, isTextureEnabled);
return getCullProgramByType(type);
}
StdpipVU1Program* StdpipQBufferRenderer::getCullProgramByType(
const StdpipProgramType& programType) {
if (programType == StdpipVU1TextureDirLights)
return getProgramByName(StdpipCullTextureDirLights);
else if (programType == StdpipVU1DirLights)
return getProgramByName(StdpipCullDirLights);
else if (programType == StdpipVU1TextureColor)
return getProgramByName(StdpipCullTextureColor);
StapipVU1Program* StapipQBufferRenderer::getCullProgramByType(
const StapipProgramType& programType) {
if (programType == StapipVU1TextureDirLights)
return getProgramByName(StapipCullTextureDirLights);
else if (programType == StapipVU1DirLights)
return getProgramByName(StapipCullDirLights);
else if (programType == StapipVU1TextureColor)
return getProgramByName(StapipCullTextureColor);
else
return getProgramByName(StdpipCullColor);
return getProgramByName(StapipCullColor);
}
StdpipProgramType StdpipQBufferRenderer::getDrawProgramTypeByBag(
const StdpipBag* bag) const {
StapipProgramType StapipQBufferRenderer::getDrawProgramTypeByBag(
const StapipBag* bag) const {
auto isLightingEnabled = bag->lighting != nullptr;
auto isTextureEnabled = bag->texture != nullptr;
return getDrawProgramTypeByParams(isLightingEnabled, isTextureEnabled);
}
StdpipProgramType StdpipQBufferRenderer::getDrawProgramTypeByParams(
StapipProgramType StapipQBufferRenderer::getDrawProgramTypeByParams(
const bool& isLightingEnabled, const bool& isTextureEnabled) const {
if (isLightingEnabled && isTextureEnabled)
return StdpipVU1TextureDirLights;
return StapipVU1TextureDirLights;
else if (isLightingEnabled)
return StdpipVU1DirLights;
return StapipVU1DirLights;
else if (isTextureEnabled)
return StdpipVU1TextureColor;
return StapipVU1TextureColor;
else
return StdpipVU1Color;
return StapipVU1Color;
}
} // namespace Tyra
@@ -8,11 +8,11 @@
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
*/
#include "renderer/3d/pipeline/std/core/path1/stdpip_vu1_program.hpp"
#include "renderer/3d/pipeline/static/core/stapip_vu1_program.hpp"
namespace Tyra {
StdpipVU1Program::StdpipVU1Program(const StdpipProgramName& t_name,
StapipVU1Program::StapipVU1Program(const StapipProgramName& t_name,
u32* t_start, u32* t_end,
const u32& t_reglist,
const u8& t_reglistCount,
@@ -26,21 +26,21 @@ StdpipVU1Program::StdpipVU1Program(const StdpipProgramName& t_name,
programSize = calculateProgramSize();
}
StdpipVU1Program::~StdpipVU1Program() {}
StapipVU1Program::~StapipVU1Program() {}
const StdpipProgramName& StdpipVU1Program::getName() const { return name; }
const StapipProgramName& StapipVU1Program::getName() const { return name; }
u32& StdpipVU1Program::getReglist() { return reglist; }
u32& StapipVU1Program::getReglist() { return reglist; }
void StdpipVU1Program::addBufferDataToPacket(packet2_t* packet,
StdpipQBuffer* buffer,
void StapipVU1Program::addBufferDataToPacket(packet2_t* packet,
StapipQBuffer* buffer,
prim_t* prim) {
addStandardBufferDataToPacket(packet, buffer, prim);
addProgramQBufferDataToPacket(packet, buffer);
}
void StdpipVU1Program::addStandardBufferDataToPacket(packet2_t* packet,
StdpipQBuffer* buffer,
void StapipVU1Program::addStandardBufferDataToPacket(packet2_t* packet,
StapipQBuffer* buffer,
prim_t* prim) {
if (buffer->bag->texture)
prim->mapping = 1;
@@ -61,7 +61,7 @@ void StdpipVU1Program::addStandardBufferDataToPacket(packet2_t* packet,
packet2_utils_vu_close_unpack(packet);
}
u16 StdpipVU1Program::getMaxVertCount(const bool& singleColorEnabled,
u16 StapipVU1Program::getMaxVertCount(const bool& singleColorEnabled,
const u16& bufferSize) const {
u16 res = bufferSize - 4;
u8 colorElementsPerVertex =
@@ -8,7 +8,7 @@
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
*/
#include "renderer/3d/pipeline/std/core/std_pipeline_core.hpp"
#include "renderer/3d/pipeline/static/core/static_pipeline_core.hpp"
#include "renderer/core/renderer_core.hpp"
#include "thread/threading.hpp"
@@ -22,26 +22,26 @@
namespace Tyra {
StdPipelineCore::StdPipelineCore() { maxVertCount = 0; }
StapipelineCore::StapipelineCore() { maxVertCount = 0; }
StdPipelineCore::~StdPipelineCore() {}
StapipelineCore::~StapipelineCore() {}
void StdPipelineCore::init(RendererCore* t_core) {
void StapipelineCore::init(RendererCore* t_core) {
rendererCore = t_core;
qbufferRenderer.init(t_core);
packager.init(&rendererCore->renderer3D.frustumPlanes);
}
void StdPipelineCore::reinitStandardVU1Programs() {
void StapipelineCore::reinitStandardVU1Programs() {
qbufferRenderer.reinitVU1();
}
u32 StdPipelineCore::getMaxVertCountByBag(const StdpipBag* bag) {
u32 StapipelineCore::getMaxVertCountByBag(const StapipBag* bag) {
return qbufferRenderer.getCullProgramByBag(bag)->getMaxVertCount(
bag->color->many == nullptr, qbufferRenderer.getBufferSize());
}
u32 StdPipelineCore::getMaxVertCountByParams(const bool& isSingleColor,
u32 StapipelineCore::getMaxVertCountByParams(const bool& isSingleColor,
const bool& isLightingEnabled,
const bool& isTextureEnabled) {
return qbufferRenderer
@@ -49,7 +49,7 @@ u32 StdPipelineCore::getMaxVertCountByParams(const bool& isSingleColor,
->getMaxVertCount(isSingleColor, qbufferRenderer.getBufferSize());
}
void StdPipelineCore::render(StdpipBag* bag, StdpipBagPackagesBBox* bbox) {
void StapipelineCore::render(StapipBag* bag, StapipBagPackagesBBox* bbox) {
if (bag->count <= 0) return;
TYRA_ASSERT(bag->vertices != nullptr,
@@ -71,7 +71,7 @@ void StdPipelineCore::render(StdpipBag* bag, StdpipBagPackagesBBox* bbox) {
!bag->texture || (bag->texture->texture && bag->texture->coordinates),
"If you want texture, please provide texture and coordinates!");
StdpipBagPackagesBBox* renderBbox;
StapipBagPackagesBBox* renderBbox;
u32 maxVertCount = getMaxVertCountByBag(bag);
@@ -79,7 +79,7 @@ void StdPipelineCore::render(StdpipBag* bag, StdpipBagPackagesBBox* bbox) {
if (!bbox)
renderBbox =
new StdpipBagPackagesBBox(bag->vertices, bag->count, maxVertCount);
new StapipBagPackagesBBox(bag->vertices, bag->count, maxVertCount);
else
renderBbox = bbox;
@@ -141,7 +141,7 @@ void StdPipelineCore::render(StdpipBag* bag, StdpipBagPackagesBBox* bbox) {
Verbose("Render finished");
}
void StdPipelineCore::renderPkgs(StdpipBagPackage* packages, u16 count) {
void StapipelineCore::renderPkgs(StapipBagPackage* packages, u16 count) {
for (u16 i = 0; i < count; i++) {
if (packages[i].isInFrustum == IN_FRUSTUM) {
Verbose(i, " - package in frustum -> cull");
@@ -161,7 +161,7 @@ void StdPipelineCore::renderPkgs(StdpipBagPackage* packages, u16 count) {
}
}
void StdPipelineCore::renderSubpkgs(StdpipBagPackage* subpkgs, u16 count) {
void StapipelineCore::renderSubpkgs(StapipBagPackage* subpkgs, u16 count) {
std::vector<u16> doneIndexes;
std::vector<u16> loadedIndexes;
@@ -218,7 +218,7 @@ void StdPipelineCore::renderSubpkgs(StdpipBagPackage* subpkgs, u16 count) {
}
}
void StdPipelineCore::setMaxVertCount(const u32& count) {
void StapipelineCore::setMaxVertCount(const u32& count) {
maxVertCount = count;
packager.setMaxVertCount(count);
qbufferRenderer.setMaxVertCount(count);
@@ -8,22 +8,22 @@
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
*/
#include "renderer/3d/pipeline/std/std_pipeline.hpp"
#include "renderer/3d/pipeline/static/static_pipeline.hpp"
namespace Tyra {
StdPipeline::StdPipeline() { colorsCache = new Vec4[4]; }
Stapipeline::Stapipeline() { colorsCache = new Vec4[4]; }
StdPipeline::~StdPipeline() { delete[] colorsCache; }
Stapipeline::~Stapipeline() { delete[] colorsCache; }
void StdPipeline::init(RendererCore* t_core) {
void Stapipeline::init(RendererCore* t_core) {
rendererCore = t_core;
core.init(t_core);
}
void StdPipeline::onUse() { core.reinitStandardVU1Programs(); }
void Stapipeline::onUse() { core.reinitStandardVU1Programs(); }
void StdPipeline::render(Mesh* mesh, const StdpipOptions* options) {
void Stapipeline::render(Mesh* mesh, const StapipOptions* options) {
auto model = mesh->getModelMatrix();
MeshFrame* frameFrom = mesh->getFramesCount() > 0
@@ -49,7 +49,7 @@ void StdPipeline::render(Mesh* mesh, const StdpipOptions* options) {
// material->isSingleColorActivated(), material->getNormalFaces(),
// material->getTextureCoordFaces());
StdpipBag bag;
StapipBag bag;
addVertices(mesh, material, &bag, frameFrom, frameTo);
bag.info = infoBag;
bag.color = getColorBag(mesh, material, frameFrom, frameTo);
@@ -65,8 +65,8 @@ void StdPipeline::render(Mesh* mesh, const StdpipOptions* options) {
delete infoBag;
}
void StdPipeline::addVertices(Mesh* mesh, MeshMaterial* material,
StdpipBag* bag, MeshFrame* frameFrom,
void Stapipeline::addVertices(Mesh* mesh, MeshMaterial* material,
StapipBag* bag, MeshFrame* frameFrom,
MeshFrame* frameTo) const {
bag->count = material->getFacesCount();
bag->vertices = new Vec4[bag->count];
@@ -83,9 +83,9 @@ void StdPipeline::addVertices(Mesh* mesh, MeshMaterial* material,
}
}
StdpipInfoBag* StdPipeline::getInfoBag(Mesh* mesh, const StdpipOptions* options,
StapipInfoBag* Stapipeline::getInfoBag(Mesh* mesh, const StapipOptions* options,
M4x4* model) const {
auto* result = new StdpipInfoBag();
auto* result = new StapipInfoBag();
if (options) {
result->antiAliasingEnabled = options->antiAliasingEnabled;
@@ -95,7 +95,7 @@ StdpipInfoBag* StdPipeline::getInfoBag(Mesh* mesh, const StdpipOptions* options,
} else {
result->antiAliasingEnabled = false;
result->blendingEnabled = true;
result->shadingType = StdpipShadingFlat;
result->shadingType = StapipShadingFlat;
result->noClipChecks = true;
}
@@ -104,10 +104,10 @@ StdpipInfoBag* StdPipeline::getInfoBag(Mesh* mesh, const StdpipOptions* options,
return result;
}
StdpipColorBag* StdPipeline::getColorBag(Mesh* mesh, MeshMaterial* material,
StapipColorBag* Stapipeline::getColorBag(Mesh* mesh, MeshMaterial* material,
MeshFrame* frameFrom,
MeshFrame* frameTo) const {
auto* result = new StdpipColorBag();
auto* result = new StapipColorBag();
if (material->isSingleColorActivated()) {
result->single = &material->singleColor;
@@ -131,12 +131,12 @@ StdpipColorBag* StdPipeline::getColorBag(Mesh* mesh, MeshMaterial* material,
return result;
}
StdpipTextureBag* StdPipeline::getTextureBag(Mesh* mesh, MeshMaterial* material,
StapipTextureBag* Stapipeline::getTextureBag(Mesh* mesh, MeshMaterial* material,
MeshFrame* frameFrom,
MeshFrame* frameTo) {
if (!material->getTextureCoordFaces()) return nullptr;
auto* result = new StdpipTextureBag();
auto* result = new StapipTextureBag();
result->texture =
rendererCore->texture.repository.getBySpriteOrMesh(material->getId());
@@ -160,14 +160,14 @@ StdpipTextureBag* StdPipeline::getTextureBag(Mesh* mesh, MeshMaterial* material,
return result;
}
StdpipLightingBag* StdPipeline::getLightingBag(
StapipLightingBag* Stapipeline::getLightingBag(
Mesh* mesh, MeshMaterial* material, M4x4* model, MeshFrame* frameFrom,
MeshFrame* frameTo, const StdpipOptions* options) const {
MeshFrame* frameTo, const StapipOptions* options) const {
if (!material->getNormalFaces() || options == nullptr ||
options->lighting == nullptr)
return nullptr;
auto* result = new StdpipLightingBag(true);
auto* result = new StapipLightingBag(true);
result->lightMatrix = model;
result->setLightsManually(colorsCache,
@@ -189,8 +189,8 @@ StdpipLightingBag* StdPipeline::getLightingBag(
return result;
}
void StdPipeline::setLightingColorsCache(
StdpipLightingOptions* lightingOptions) {
void Stapipeline::setLightingColorsCache(
StapipLightingOptions* lightingOptions) {
for (int i = 0; i < 3; i++) {
colorsCache[i] =
reinterpret_cast<Vec4&>(lightingOptions->directionalColors[i]);
@@ -198,7 +198,7 @@ void StdPipeline::setLightingColorsCache(
colorsCache[3] = reinterpret_cast<Vec4&>(*lightingOptions->ambientColor);
}
void StdPipeline::deallocDrawBags(StdpipBag* bag,
void Stapipeline::deallocDrawBags(StapipBag* bag,
MeshMaterial* material) const {
if (bag->color->many) {
delete[] bag->color->many;
@@ -1,48 +0,0 @@
/*
# ______ ____ ___
# | \/ ____| |___|
# | | | \ | |
#-----------------------------------------------------------------------
# Copyright 2022, tyra - https://github.com/h4570/tyra
# Licenced under Apache License 2.0
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
*/
#include "renderer/3d/pipeline/std/core/path1/stdpip_programs_repository.hpp"
namespace Tyra {
StdpipProgramsRepository::StdpipProgramsRepository() {}
StdpipProgramsRepository::~StdpipProgramsRepository() {}
StdpipVU1Program* StdpipProgramsRepository::getProgram(
const StdpipProgramName& name) {
switch (name) {
case StdpipProgramName::StdpipAsIsColor:
return &asIsColor;
case StdpipProgramName::StdpipCullColor:
return &cullColor;
case StdpipProgramName::StdpipAsIsDirLights:
return &asIsLightingColor;
case StdpipProgramName::StdpipCullDirLights:
return &cullLightingColor;
case StdpipProgramName::StdpipAsIsTextureDirLights:
return &asIsLightingTextureColor;
case StdpipProgramName::StdpipCullTextureDirLights:
return &cullLightingTextureColor;
case StdpipProgramName::StdpipAsIsTextureColor:
return &asIsTextureColor;
case StdpipProgramName::StdpipCullTextureColor:
return &cullTextureColor;
default:
TYRA_TRAP("Unknown VU1 program name");
return &cullLightingTextureColor;
}
}
} // namespace Tyra
@@ -18,7 +18,7 @@
#include "src/renderer/core/paths/path1/programs/vcl_sml.i"
#include "src/renderer/core/paths/path1/programs/tyra_macros.i"
#include "inc/renderer/3d/pipeline/std/core/path1/programs/stdpip_vu1_shared_defines.h"
#include "inc/renderer/3d/pipeline/static/core/programs/stapip_vu1_shared_defines.h"
--enter
--endenter
+3 -3
View File
@@ -13,7 +13,7 @@
#include <engine.hpp>
#include <game.hpp>
#include "renderer/3d/pipeline/minecraft/minecraft_pipeline.hpp"
#include "renderer/3d/pipeline/std/std_pipeline.hpp"
#include "renderer/3d/pipeline/static/static_pipeline.hpp"
namespace Tyra {
@@ -39,8 +39,8 @@ class H4570 : public Game {
Vec4 cameraPosition, cameraLookAt;
MinecraftPipeline mcPip;
StdPipeline stdPip;
StdpipOptions* renderOptions;
Stapipeline stapip;
StapipOptions* renderOptions;
Texture* blocksTex;
u32 blocksCount;
+11 -11
View File
@@ -18,7 +18,7 @@ H4570::H4570(Engine* t_engine) { engine = t_engine; }
H4570::~H4570() {}
Mesh* getWarrior(Renderer* renderer);
StdpipOptions* getRenderingOptions();
StapipOptions* getRenderingOptions();
Sprite* get2DPicture(Renderer* renderer);
void H4570::init() {
@@ -65,7 +65,7 @@ void H4570::init() {
FileUtils::fromCwd("blocks.png"));
mcPip.init(&engine->renderer.core);
stdPip.init(&engine->renderer.core);
stapip.init(&engine->renderer.core);
picture = get2DPicture(&engine->renderer);
@@ -137,12 +137,12 @@ void H4570::loop() {
// engine->renderer.renderer2D.render(picture);
engine->renderer.renderer3D.usePipeline(&stdPip);
engine->renderer.renderer3D.usePipeline(&stapip);
{
stdPip.render(warrior, renderOptions);
// stdPip.render(warrior2, renderOptions);
// stdPip.render(warrior3, renderOptions);
// stdPip.render(warrior4, renderOptions);
stapip.render(warrior, renderOptions);
// stapip.render(warrior2, renderOptions);
// stapip.render(warrior3, renderOptions);
// stapip.render(warrior4, renderOptions);
}
engine->renderer.renderer3D.usePipeline(&mcPip);
@@ -179,8 +179,8 @@ Sprite* get2DPicture(Renderer* renderer) {
return sprite;
}
StdpipOptions* getRenderingOptions() {
auto* options = new StdpipOptions();
StapipOptions* getRenderingOptions() {
auto* options = new StapipOptions();
auto* ambientColor = new Color(32.0F, 32.0F, 32.0F, 32.0F);
auto* directionalColors = new Color[3];
@@ -189,12 +189,12 @@ StdpipOptions* getRenderingOptions() {
for (int i = 0; i < 3; i++)
directionalDirections[i].set(1.0F, 1.0F, 1.0F, 1.0F);
auto* lightingOptions = new StdpipLightingOptions(); // Memory leak!
auto* lightingOptions = new StapipLightingOptions(); // Memory leak!
lightingOptions->ambientColor = ambientColor;
lightingOptions->directionalColors = directionalColors;
lightingOptions->directionalDirections = directionalDirections;
options->shadingType = Tyra::StdpipShadingGouraud;
options->shadingType = Tyra::StapipShadingGouraud;
options->blendingEnabled = true;
options->antiAliasingEnabled = false;
options->lighting = lightingOptions;
+3 -3
View File
@@ -13,7 +13,7 @@
#include <engine.hpp>
#include <game.hpp>
#include "renderer/3d/pipeline/minecraft/minecraft_pipeline.hpp"
#include "renderer/3d/pipeline/std/std_pipeline.hpp"
#include "renderer/3d/pipeline/static/static_pipeline.hpp"
namespace Tyra {
@@ -36,8 +36,8 @@ class Wellinator : public Game {
Vec4 cameraPosition, cameraLookAt;
MinecraftPipeline mcPip;
StdPipeline stdPip;
StdpipOptions* renderOptions;
Stapipeline stapip;
StapipOptions* renderOptions;
Texture* blocksTex;
u32 blocksCount;
+8 -8
View File
@@ -18,7 +18,7 @@ Wellinator::Wellinator(Engine* t_engine) { engine = t_engine; }
Wellinator::~Wellinator() {}
Mesh* getWarrior(Renderer* renderer);
StdpipOptions* getRenderingOptions();
StapipOptions* getRenderingOptions();
Sprite* get2DPicture(Renderer* renderer);
void Wellinator::init() {
@@ -42,7 +42,7 @@ void Wellinator::init() {
FileUtils::fromCwd("blocks.png"));
mcPip.init(&engine->renderer.core);
stdPip.init(&engine->renderer.core);
stapip.init(&engine->renderer.core);
picture = get2DPicture(&engine->renderer);
@@ -116,8 +116,8 @@ void Wellinator::loop() {
// warrior->setPosition(*nextPos);
engine->renderer.renderer3D.usePipeline(&stdPip);
{ stdPip.render(warrior, renderOptions); }
engine->renderer.renderer3D.usePipeline(&stapip);
{ stapip.render(warrior, renderOptions); }
engine->renderer.renderer3D.usePipeline(&mcPip);
{ mcPip.render(blocks, blocksCount, blocksTex, false); }
@@ -150,8 +150,8 @@ Sprite* get2DPicture(Renderer* renderer) {
return sprite;
}
StdpipOptions* getRenderingOptions() {
auto* options = new StdpipOptions();
StapipOptions* getRenderingOptions() {
auto* options = new StapipOptions();
auto* ambientColor = new Color(32.0F, 32.0F, 32.0F, 128.0F);
auto* directionalColors = new Color[3];
@@ -160,12 +160,12 @@ StdpipOptions* getRenderingOptions() {
for (int i = 0; i < 3; i++)
directionalDirections[i].set(1.0F, 1.0F, 1.0F, 1.0F);
auto* lightingOptions = new StdpipLightingOptions(); // Memory leak!
auto* lightingOptions = new StapipLightingOptions(); // Memory leak!
lightingOptions->ambientColor = ambientColor;
lightingOptions->directionalColors = directionalColors;
lightingOptions->directionalDirections = directionalDirections;
options->shadingType = Tyra::StdpipShadingGouraud;
options->shadingType = Tyra::StapipShadingGouraud;
options->blendingEnabled = true;
options->antiAliasingEnabled = false;
options->lighting = lightingOptions;