dynamic pipeline base
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
# ______ ____ ___
|
||||
# | \/ ____| |___|
|
||||
# | | | \ | |
|
||||
#-----------------------------------------------------------------------
|
||||
# Copyright 2022, tyra - https://github.com/h4570/tyra
|
||||
# Licenced under Apache License 2.0
|
||||
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <tamtypes.h>
|
||||
#include "../renderer_3d_pipeline.hpp"
|
||||
#include "./dynpip_options.hpp"
|
||||
#include "renderer/core/renderer_core.hpp"
|
||||
#include "renderer/3d/mesh/dynamic/dynamic_mesh.hpp"
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
class DynamicPipeline : public Renderer3DPipeline {
|
||||
public:
|
||||
DynamicPipeline();
|
||||
~DynamicPipeline();
|
||||
|
||||
void init(RendererCore* core);
|
||||
|
||||
void onUse();
|
||||
|
||||
/**
|
||||
* Render 3D data via "meshes".
|
||||
* This render() method is a bridge to core.render() method.
|
||||
*/
|
||||
void render(DynamicMesh* mesh, const DynPipOptions* options = nullptr);
|
||||
};
|
||||
|
||||
} // namespace Tyra
|
||||
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
# ______ ____ ___
|
||||
# | \/ ____| |___|
|
||||
# | | | \ | |
|
||||
#-----------------------------------------------------------------------
|
||||
# Copyright 2022, tyra - https://github.com/h4570/tyra
|
||||
# Licenced under Apache License 2.0
|
||||
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
class DynPipOptions {
|
||||
public:
|
||||
DynPipOptions() {}
|
||||
~DynPipOptions() {}
|
||||
};
|
||||
|
||||
} // namespace Tyra
|
||||
@@ -15,12 +15,12 @@
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
class StapipBagPackage {
|
||||
class StaPipBagPackage {
|
||||
public:
|
||||
StapipBagPackage();
|
||||
~StapipBagPackage();
|
||||
StaPipBagPackage();
|
||||
~StaPipBagPackage();
|
||||
|
||||
StapipBag* bag;
|
||||
StaPipBag* bag;
|
||||
|
||||
Vec4* vertices;
|
||||
Vec4* sts;
|
||||
@@ -32,12 +32,12 @@ class StapipBagPackage {
|
||||
CoreBBoxFrustum isInFrustum;
|
||||
|
||||
/**
|
||||
* We are creating StapipBagPackagesBBox which checks CoreBBoxBBox for every
|
||||
* We are creating StaPipBagPackagesBBox which checks CoreBBoxBBox for every
|
||||
* maxVertCount / 3. So this variable is index of starting
|
||||
* StapipBagPackagesBBox'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
|
||||
* StapipBagPackagesBBox's bboxes.
|
||||
* StaPipBagPackagesBBox's bboxes.
|
||||
*/
|
||||
u32 indexOf1By3BBox;
|
||||
|
||||
|
||||
@@ -19,13 +19,13 @@
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
class StapipBagPackager {
|
||||
class StaPipBagPackager {
|
||||
public:
|
||||
StapipBagPackager();
|
||||
~StapipBagPackager();
|
||||
StaPipBagPackager();
|
||||
~StaPipBagPackager();
|
||||
|
||||
void init(Renderer3DFrustumPlanes* frustumPlanes);
|
||||
void setRenderBBox(StapipBagPackagesBBox* bbox) { renderBBox = bbox; }
|
||||
void setRenderBBox(StaPipBagPackagesBBox* bbox) { renderBBox = bbox; }
|
||||
void setMaxVertCount(const u32& count);
|
||||
|
||||
/**
|
||||
@@ -33,20 +33,20 @@ class StapipBagPackager {
|
||||
*
|
||||
* @param size Max maxVertCount verts (VU1 buffer size)
|
||||
*/
|
||||
StapipBagPackage* create(u16* o_size, StapipBag* 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)
|
||||
*/
|
||||
StapipBagPackage* create(u16* o_size, const StapipBagPackage& pkg, u16 size);
|
||||
StaPipBagPackage* create(u16* o_size, const StaPipBagPackage& pkg, u16 size);
|
||||
|
||||
CoreBBoxFrustum checkFrustum(const StapipBagPackage& pkg);
|
||||
CoreBBoxFrustum checkFrustum(const StaPipBagPackage& pkg);
|
||||
|
||||
private:
|
||||
u32 maxVertCount;
|
||||
Renderer3DFrustumPlanes* frustumPlanes;
|
||||
StapipBagPackagesBBox* renderBBox;
|
||||
StaPipBagPackagesBBox* renderBBox;
|
||||
};
|
||||
|
||||
} // namespace Tyra
|
||||
|
||||
+4
-4
@@ -18,13 +18,13 @@ namespace Tyra {
|
||||
* Splits all 3D input vertices into 16vert parts and creates child bboxes for
|
||||
* it
|
||||
*/
|
||||
class StapipBagPackagesBBox {
|
||||
class StaPipBagPackagesBBox {
|
||||
public:
|
||||
StapipBagPackagesBBox(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);
|
||||
StapipBagPackagesBBox(Vec4* t_vertices, const u32& t_counts,
|
||||
StaPipBagPackagesBBox(Vec4* t_vertices, const u32& t_counts,
|
||||
const u32& t_maxVertCount);
|
||||
~StapipBagPackagesBBox();
|
||||
~StaPipBagPackagesBBox();
|
||||
|
||||
void setMaxVertCount(const u32& count);
|
||||
|
||||
|
||||
@@ -25,16 +25,16 @@ namespace Tyra {
|
||||
* Supports frustum culling, clipping, lighting,
|
||||
* texture and single color / many colors.
|
||||
*/
|
||||
class StapipBag {
|
||||
class StaPipBag {
|
||||
public:
|
||||
StapipBag();
|
||||
~StapipBag();
|
||||
StaPipBag();
|
||||
~StaPipBag();
|
||||
|
||||
/** Mandatory. Object info. */
|
||||
StapipInfoBag* info;
|
||||
StaPipInfoBag* info;
|
||||
|
||||
/** Mandatory. Object color(s). */
|
||||
StapipColorBag* color;
|
||||
StaPipColorBag* color;
|
||||
|
||||
/** Mandatory. Vertex count. */
|
||||
u32 count;
|
||||
@@ -43,15 +43,15 @@ class StapipBag {
|
||||
Vec4* vertices;
|
||||
|
||||
/** Optional. Texture coordinates and image. */
|
||||
StapipTextureBag* texture;
|
||||
StaPipTextureBag* texture;
|
||||
|
||||
/** Optional. Object lighting. */
|
||||
StapipLightingBag* lighting;
|
||||
StaPipLightingBag* lighting;
|
||||
|
||||
/**
|
||||
* @param maxVertCount This parameter is available in renderer API.
|
||||
*/
|
||||
StapipBagPackagesBBox 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 StapipColorBag {
|
||||
class StaPipColorBag {
|
||||
public:
|
||||
StapipColorBag();
|
||||
~StapipColorBag();
|
||||
StaPipColorBag();
|
||||
~StaPipColorBag();
|
||||
|
||||
/** Optional. Single color for all vertices. */
|
||||
Color* single;
|
||||
|
||||
@@ -17,15 +17,15 @@
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
class StapipInfoBag {
|
||||
class StaPipInfoBag {
|
||||
public:
|
||||
StapipInfoBag();
|
||||
~StapipInfoBag();
|
||||
StaPipInfoBag();
|
||||
~StaPipInfoBag();
|
||||
|
||||
/** Mandatory. Model matrix */
|
||||
M4x4* model;
|
||||
|
||||
StapipShadingType shadingType;
|
||||
StaPipShadingType shadingType;
|
||||
bool blendingEnabled;
|
||||
bool antiAliasingEnabled;
|
||||
bool noClipChecks;
|
||||
|
||||
@@ -16,12 +16,12 @@
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
enum StapipLightingBagMode { Auto, Manual };
|
||||
enum StaPipLightingBagMode { Auto, Manual };
|
||||
|
||||
class StapipLightingBag {
|
||||
class StaPipLightingBag {
|
||||
public:
|
||||
explicit StapipLightingBag(const bool& manual = false);
|
||||
~StapipLightingBag();
|
||||
explicit StaPipLightingBag(const bool& manual = false);
|
||||
~StaPipLightingBag();
|
||||
|
||||
Vec4* normals;
|
||||
M4x4* lightMatrix;
|
||||
@@ -47,7 +47,7 @@ class StapipLightingBag {
|
||||
void deallocate();
|
||||
void forceDeallocate();
|
||||
u8 isAllocated;
|
||||
StapipLightingBagMode mode;
|
||||
StaPipLightingBagMode mode;
|
||||
|
||||
Vec4* lightColors;
|
||||
Vec4* lightDirections;
|
||||
|
||||
@@ -15,10 +15,10 @@
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
class StapipTextureBag {
|
||||
class StaPipTextureBag {
|
||||
public:
|
||||
StapipTextureBag();
|
||||
~StapipTextureBag();
|
||||
StaPipTextureBag();
|
||||
~StaPipTextureBag();
|
||||
|
||||
/** Mandatory. Texture coordinates per vertex. */
|
||||
Vec4* coordinates;
|
||||
|
||||
+4
-4
@@ -16,15 +16,15 @@
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
class StapipAsIsCVU1Program : public StapipVU1Program {
|
||||
class StaPipAsIsCVU1Program : public StaPipVU1Program {
|
||||
public:
|
||||
StapipAsIsCVU1Program();
|
||||
~StapipAsIsCVU1Program();
|
||||
StaPipAsIsCVU1Program();
|
||||
~StaPipAsIsCVU1Program();
|
||||
|
||||
std::string getStringName() const;
|
||||
|
||||
void addProgramQBufferDataToPacket(packet2_t* packet,
|
||||
StapipQBuffer* qbuffer) const;
|
||||
StaPipQBuffer* qbuffer) const;
|
||||
};
|
||||
|
||||
} // namespace Tyra
|
||||
|
||||
+4
-4
@@ -16,14 +16,14 @@
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
class StapipAsIsDVU1Program : public StapipVU1Program {
|
||||
class StaPipAsIsDVU1Program : public StaPipVU1Program {
|
||||
public:
|
||||
StapipAsIsDVU1Program();
|
||||
~StapipAsIsDVU1Program();
|
||||
StaPipAsIsDVU1Program();
|
||||
~StaPipAsIsDVU1Program();
|
||||
|
||||
std::string getStringName() const;
|
||||
void addProgramQBufferDataToPacket(packet2_t* packet,
|
||||
StapipQBuffer* qbuffer) const;
|
||||
StaPipQBuffer* qbuffer) const;
|
||||
};
|
||||
|
||||
} // namespace Tyra
|
||||
|
||||
+4
-4
@@ -16,14 +16,14 @@
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
class StapipAsIsTCVU1Program : public StapipVU1Program {
|
||||
class StaPipAsIsTCVU1Program : public StaPipVU1Program {
|
||||
public:
|
||||
StapipAsIsTCVU1Program();
|
||||
~StapipAsIsTCVU1Program();
|
||||
StaPipAsIsTCVU1Program();
|
||||
~StaPipAsIsTCVU1Program();
|
||||
|
||||
std::string getStringName() const;
|
||||
void addProgramQBufferDataToPacket(packet2_t* packet,
|
||||
StapipQBuffer* qbuffer) const;
|
||||
StaPipQBuffer* qbuffer) const;
|
||||
};
|
||||
|
||||
} // namespace Tyra
|
||||
|
||||
+4
-4
@@ -16,14 +16,14 @@
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
class StapipAsIsTDVU1Program : public StapipVU1Program {
|
||||
class StaPipAsIsTDVU1Program : public StaPipVU1Program {
|
||||
public:
|
||||
StapipAsIsTDVU1Program();
|
||||
~StapipAsIsTDVU1Program();
|
||||
StaPipAsIsTDVU1Program();
|
||||
~StaPipAsIsTDVU1Program();
|
||||
|
||||
std::string getStringName() const;
|
||||
void addProgramQBufferDataToPacket(packet2_t* packet,
|
||||
StapipQBuffer* qbuffer) const;
|
||||
StaPipQBuffer* qbuffer) const;
|
||||
};
|
||||
|
||||
} // namespace Tyra
|
||||
|
||||
+4
-4
@@ -16,14 +16,14 @@
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
class StapipCullCVU1Program : public StapipVU1Program {
|
||||
class StaPipCullCVU1Program : public StaPipVU1Program {
|
||||
public:
|
||||
StapipCullCVU1Program();
|
||||
~StapipCullCVU1Program();
|
||||
StaPipCullCVU1Program();
|
||||
~StaPipCullCVU1Program();
|
||||
|
||||
std::string getStringName() const;
|
||||
void addProgramQBufferDataToPacket(packet2_t* packet,
|
||||
StapipQBuffer* qbuffer) const;
|
||||
StaPipQBuffer* qbuffer) const;
|
||||
};
|
||||
|
||||
} // namespace Tyra
|
||||
|
||||
+4
-4
@@ -16,14 +16,14 @@
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
class StapipCullDVU1Program : public StapipVU1Program {
|
||||
class StaPipCullDVU1Program : public StaPipVU1Program {
|
||||
public:
|
||||
StapipCullDVU1Program();
|
||||
~StapipCullDVU1Program();
|
||||
StaPipCullDVU1Program();
|
||||
~StaPipCullDVU1Program();
|
||||
|
||||
std::string getStringName() const;
|
||||
void addProgramQBufferDataToPacket(packet2_t* packet,
|
||||
StapipQBuffer* qbuffer) const;
|
||||
StaPipQBuffer* qbuffer) const;
|
||||
};
|
||||
|
||||
} // namespace Tyra
|
||||
|
||||
+4
-4
@@ -16,14 +16,14 @@
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
class StapipCullTCVU1Program : public StapipVU1Program {
|
||||
class StaPipCullTCVU1Program : public StaPipVU1Program {
|
||||
public:
|
||||
StapipCullTCVU1Program();
|
||||
~StapipCullTCVU1Program();
|
||||
StaPipCullTCVU1Program();
|
||||
~StaPipCullTCVU1Program();
|
||||
|
||||
std::string getStringName() const;
|
||||
void addProgramQBufferDataToPacket(packet2_t* packet,
|
||||
StapipQBuffer* qbuffer) const;
|
||||
StaPipQBuffer* qbuffer) const;
|
||||
};
|
||||
|
||||
} // namespace Tyra
|
||||
|
||||
+4
-4
@@ -16,14 +16,14 @@
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
class StapipCullTDVU1Program : public StapipVU1Program {
|
||||
class StaPipCullTDVU1Program : public StaPipVU1Program {
|
||||
public:
|
||||
StapipCullTDVU1Program();
|
||||
~StapipCullTDVU1Program();
|
||||
StaPipCullTDVU1Program();
|
||||
~StaPipCullTDVU1Program();
|
||||
|
||||
std::string getStringName() const;
|
||||
void addProgramQBufferDataToPacket(packet2_t* packet,
|
||||
StapipQBuffer* qbuffer) const;
|
||||
StaPipQBuffer* qbuffer) const;
|
||||
};
|
||||
|
||||
} // namespace Tyra
|
||||
|
||||
@@ -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 StapipClipper {
|
||||
class StaPipClipper {
|
||||
public:
|
||||
StapipClipper();
|
||||
~StapipClipper();
|
||||
void clip(StapipQBuffer* 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 StapipClipper {
|
||||
|
||||
void perspectiveDivide(std::vector<Path1ClipVertex>* vertices);
|
||||
void moveDataToBuffer(const std::vector<Path1ClipVertex>& vertices,
|
||||
StapipQBuffer* buffer);
|
||||
StaPipQBuffer* buffer);
|
||||
};
|
||||
|
||||
} // namespace Tyra
|
||||
|
||||
@@ -12,20 +12,20 @@
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
enum StapipProgramName {
|
||||
enum StaPipProgramName {
|
||||
StdipUndefinedProgram,
|
||||
|
||||
StapipCullColor,
|
||||
StapipAsIsColor,
|
||||
StaPipCullColor,
|
||||
StaPipAsIsColor,
|
||||
|
||||
StapipCullDirLights,
|
||||
StapipAsIsDirLights,
|
||||
StaPipCullDirLights,
|
||||
StaPipAsIsDirLights,
|
||||
|
||||
StapipCullTextureDirLights,
|
||||
StapipAsIsTextureDirLights,
|
||||
StaPipCullTextureDirLights,
|
||||
StaPipAsIsTextureDirLights,
|
||||
|
||||
StapipCullTextureColor,
|
||||
StapipAsIsTextureColor,
|
||||
StaPipCullTextureColor,
|
||||
StaPipAsIsTextureColor,
|
||||
};
|
||||
|
||||
} // namespace Tyra
|
||||
|
||||
@@ -12,11 +12,11 @@
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
enum StapipProgramType {
|
||||
StapipVU1Color,
|
||||
StapipVU1DirLights,
|
||||
StapipVU1TextureDirLights,
|
||||
StapipVU1TextureColor,
|
||||
enum StaPipProgramType {
|
||||
StaPipVU1Color,
|
||||
StaPipVU1DirLights,
|
||||
StaPipVU1TextureDirLights,
|
||||
StaPipVU1TextureColor,
|
||||
};
|
||||
|
||||
} // namespace Tyra
|
||||
|
||||
@@ -27,22 +27,22 @@
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
class StapipProgramsRepository {
|
||||
class StaPipProgramsRepository {
|
||||
public:
|
||||
StapipProgramsRepository();
|
||||
~StapipProgramsRepository();
|
||||
StaPipProgramsRepository();
|
||||
~StaPipProgramsRepository();
|
||||
|
||||
StapipVU1Program* getProgram(const StapipProgramName& name);
|
||||
StaPipVU1Program* getProgram(const StaPipProgramName& name);
|
||||
|
||||
private:
|
||||
StapipAsIsCVU1Program asIsColor;
|
||||
StapipCullCVU1Program cullColor;
|
||||
StapipAsIsDVU1Program asIsLightingColor;
|
||||
StapipCullDVU1Program cullLightingColor;
|
||||
StapipAsIsTDVU1Program asIsLightingTextureColor;
|
||||
StapipCullTDVU1Program cullLightingTextureColor;
|
||||
StapipAsIsTCVU1Program asIsTextureColor;
|
||||
StapipCullTCVU1Program cullTextureColor;
|
||||
StaPipAsIsCVU1Program asIsColor;
|
||||
StaPipCullCVU1Program cullColor;
|
||||
StaPipAsIsDVU1Program asIsLightingColor;
|
||||
StaPipCullDVU1Program cullLightingColor;
|
||||
StaPipAsIsTDVU1Program asIsLightingTextureColor;
|
||||
StaPipCullTDVU1Program cullLightingTextureColor;
|
||||
StaPipAsIsTCVU1Program asIsTextureColor;
|
||||
StaPipCullTCVU1Program cullTextureColor;
|
||||
VU1DrawFinish drawFinish;
|
||||
};
|
||||
|
||||
|
||||
@@ -18,10 +18,10 @@
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
class StapipQBuffer {
|
||||
class StaPipQBuffer {
|
||||
public:
|
||||
StapipQBuffer();
|
||||
~StapipQBuffer();
|
||||
StaPipQBuffer();
|
||||
~StaPipQBuffer();
|
||||
|
||||
void setMaxVertCount(const u32& count);
|
||||
|
||||
@@ -29,27 +29,27 @@ class StapipQBuffer {
|
||||
* @brief Dont allocate any dynamic data in buffer.
|
||||
* Just copy pointers to input data.
|
||||
*/
|
||||
void fillByPointer(const StapipBagPackage& pkg);
|
||||
void fillByPointer(const StaPipBagPackage& pkg);
|
||||
|
||||
/**
|
||||
* @brief Allocate dynamic data in buffer
|
||||
* And copy input data to it.
|
||||
*/
|
||||
void fillByCopyMax(const StapipBagPackage& pkg1, const StapipBagPackage& pkg2,
|
||||
const StapipBagPackage& 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 StapipBagPackage& pkg1,
|
||||
const StapipBagPackage& pkg2);
|
||||
void fillByCopy1By2(const StaPipBagPackage& pkg1,
|
||||
const StaPipBagPackage& pkg2);
|
||||
|
||||
/**
|
||||
* @brief Allocate dynamic data in buffer
|
||||
* And copy input data to it.
|
||||
*/
|
||||
void fillByCopy1By3(const StapipBagPackage& pkg);
|
||||
void fillByCopy1By3(const StaPipBagPackage& pkg);
|
||||
|
||||
/**
|
||||
* @brief Deallocate dynamic data if it was allocated and allocate new data
|
||||
@@ -60,7 +60,7 @@ class StapipQBuffer {
|
||||
|
||||
bool any() const;
|
||||
|
||||
StapipBag* bag;
|
||||
StaPipBag* bag;
|
||||
|
||||
Vec4* vertices;
|
||||
Vec4* sts;
|
||||
@@ -76,7 +76,7 @@ class StapipQBuffer {
|
||||
private:
|
||||
u32 maxVertCount;
|
||||
void deallocateDynamicData();
|
||||
void allocateDynamicData(u16 size, StapipBag* bag);
|
||||
void allocateDynamicData(u16 size, StaPipBag* bag);
|
||||
u8 _isDynamicallyAllocated, _stAllocated, _colorAllocated, _normalAllocated;
|
||||
};
|
||||
|
||||
|
||||
@@ -28,10 +28,10 @@
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
class StapipQBufferRenderer {
|
||||
class StaPipQBufferRenderer {
|
||||
public:
|
||||
StapipQBufferRenderer();
|
||||
~StapipQBufferRenderer();
|
||||
StaPipQBufferRenderer();
|
||||
~StaPipQBufferRenderer();
|
||||
|
||||
void init(RendererCore* t_core);
|
||||
|
||||
@@ -39,26 +39,26 @@ class StapipQBufferRenderer {
|
||||
|
||||
void setClipperMVP(M4x4* mvp) { clipper.setMVP(mvp); }
|
||||
|
||||
StapipQBuffer* getBuffer();
|
||||
StaPipQBuffer* getBuffer();
|
||||
|
||||
void sendObjectData(StapipBag* bag, M4x4* mvp,
|
||||
void sendObjectData(StaPipBag* bag, M4x4* mvp,
|
||||
RendererCoreTextureBuffers* texBuffers) const;
|
||||
|
||||
void setMaxVertCount(const u32& count);
|
||||
|
||||
void setInfo(StapipInfoBag* bag);
|
||||
void setInfo(StaPipInfoBag* bag);
|
||||
|
||||
/** Fast render with culling */
|
||||
void cull(StapipQBuffer* buffer);
|
||||
void cull(StaPipQBuffer* buffer);
|
||||
|
||||
/** Slower render with clipping */
|
||||
void clip(StapipQBuffer* buffer);
|
||||
void clip(StaPipQBuffer* buffer);
|
||||
|
||||
void clearLastProgramName();
|
||||
|
||||
StapipVU1Program* getCullProgramByBag(const StapipBag* bag);
|
||||
StaPipVU1Program* getCullProgramByBag(const StaPipBag* bag);
|
||||
|
||||
StapipVU1Program* getCullProgramByParams(const bool& isLightingEnabled,
|
||||
StaPipVU1Program* getCullProgramByParams(const bool& isLightingEnabled,
|
||||
const bool& isTextureEnabled);
|
||||
|
||||
const u16& getBufferSize() { return bufferSize; }
|
||||
@@ -69,27 +69,27 @@ class StapipQBufferRenderer {
|
||||
void uploadPrograms();
|
||||
void setDoubleBuffer();
|
||||
|
||||
StapipVU1Program* getProgramByName(const StapipProgramName& name);
|
||||
void addBufferDataToPacket(StapipVU1Program* program, StapipQBuffer* buffer);
|
||||
StaPipVU1Program* getProgramByName(const StaPipProgramName& name);
|
||||
void addBufferDataToPacket(StaPipVU1Program* program, StaPipQBuffer* buffer);
|
||||
void sendPacket();
|
||||
StapipVU1Program* getAsIsProgramByBag(const StapipBag* bag);
|
||||
StapipVU1Program* getCullProgramByType(const StapipProgramType& programType);
|
||||
StapipProgramType getDrawProgramTypeByBag(const StapipBag* bag) const;
|
||||
StapipProgramType 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;
|
||||
StapipQBuffer buffers[2];
|
||||
StaPipQBuffer buffers[2];
|
||||
packet2_t* currentPacket;
|
||||
packet2_t* staticDataPacket;
|
||||
packet2_t* objectDataPacket;
|
||||
|
||||
RendererCore* rendererCore;
|
||||
|
||||
StapipProgramName lastProgramName;
|
||||
StaPipProgramName lastProgramName;
|
||||
Path1* path1;
|
||||
StapipClipper clipper;
|
||||
StapipProgramsRepository repository;
|
||||
StaPipClipper clipper;
|
||||
StaPipProgramsRepository repository;
|
||||
|
||||
u16 bufferSize;
|
||||
u8 context;
|
||||
|
||||
@@ -17,33 +17,33 @@
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
class StapipVU1Program : public VU1Program {
|
||||
class StaPipVU1Program : public VU1Program {
|
||||
public:
|
||||
StapipVU1Program(const StapipProgramName& 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);
|
||||
~StapipVU1Program();
|
||||
~StaPipVU1Program();
|
||||
|
||||
u32& getReglist();
|
||||
|
||||
const StapipProgramName& getName() const;
|
||||
const StaPipProgramName& getName() const;
|
||||
|
||||
u16 getMaxVertCount(const bool& singleColorEnabled,
|
||||
const u16& vu1DBufferSize) const;
|
||||
|
||||
void addBufferDataToPacket(packet2_t* packet, StapipQBuffer* buffer,
|
||||
void addBufferDataToPacket(packet2_t* packet, StaPipQBuffer* buffer,
|
||||
prim_t* prim);
|
||||
|
||||
protected:
|
||||
StapipProgramName name;
|
||||
StaPipProgramName name;
|
||||
u8 reglistCount, elementsPerVertex;
|
||||
u32 destinationAddress, reglist;
|
||||
|
||||
virtual void addProgramQBufferDataToPacket(packet2_t* packet,
|
||||
StapipQBuffer* qbuffer) const = 0;
|
||||
StaPipQBuffer* qbuffer) const = 0;
|
||||
|
||||
private:
|
||||
void addStandardBufferDataToPacket(packet2_t* packet, StapipQBuffer* buffer,
|
||||
void addStandardBufferDataToPacket(packet2_t* packet, StaPipQBuffer* buffer,
|
||||
prim_t* prim);
|
||||
};
|
||||
|
||||
|
||||
@@ -19,15 +19,15 @@
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
class StapipelineCore {
|
||||
class StaPipelineCore {
|
||||
public:
|
||||
StapipelineCore();
|
||||
~StapipelineCore();
|
||||
StaPipelineCore();
|
||||
~StaPipelineCore();
|
||||
|
||||
void init(RendererCore* t_core);
|
||||
|
||||
/** Render 3D data via "bags" */
|
||||
void render(StapipBag* data, StapipBagPackagesBBox* 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 StapipelineCore {
|
||||
const bool& isTextureEnabled);
|
||||
|
||||
/** Get max vert count of VU1 qbuffer (for optimizations) */
|
||||
u32 getMaxVertCountByBag(const StapipBag* bag);
|
||||
u32 getMaxVertCountByBag(const StaPipBag* bag);
|
||||
|
||||
/**
|
||||
* - Uploads standard VU1 programs.
|
||||
@@ -50,10 +50,10 @@ class StapipelineCore {
|
||||
RendererCore* rendererCore;
|
||||
|
||||
void setMaxVertCount(const u32& count);
|
||||
StapipBagPackager packager;
|
||||
StapipQBufferRenderer qbufferRenderer;
|
||||
void renderPkgs(StapipBagPackage* packages, u16 count);
|
||||
void renderSubpkgs(StapipBagPackage* 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 StapipLightingOptions {
|
||||
class StaPipLightingOptions {
|
||||
public:
|
||||
StapipLightingOptions() {}
|
||||
~StapipLightingOptions() {}
|
||||
StaPipLightingOptions() {}
|
||||
~StaPipLightingOptions() {}
|
||||
|
||||
/**
|
||||
* Mandatory.
|
||||
|
||||
@@ -15,18 +15,18 @@
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
class StapipOptions {
|
||||
class StaPipOptions {
|
||||
public:
|
||||
StapipOptions() {}
|
||||
~StapipOptions() {}
|
||||
StaPipOptions() {}
|
||||
~StaPipOptions() {}
|
||||
|
||||
StapipShadingType shadingType;
|
||||
StaPipShadingType shadingType;
|
||||
bool blendingEnabled;
|
||||
bool antiAliasingEnabled;
|
||||
bool noClipChecks;
|
||||
|
||||
/** Optional */
|
||||
StapipLightingOptions* lighting;
|
||||
StaPipLightingOptions* lighting;
|
||||
};
|
||||
|
||||
} // namespace Tyra
|
||||
|
||||
@@ -12,9 +12,9 @@
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
enum StapipShadingType {
|
||||
StapipShadingFlat,
|
||||
StapipShadingGouraud,
|
||||
enum StaPipShadingType {
|
||||
StaPipShadingFlat,
|
||||
StaPipShadingGouraud,
|
||||
};
|
||||
|
||||
} // namespace Tyra
|
||||
|
||||
@@ -19,10 +19,10 @@
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
class Stapipeline : public Renderer3DPipeline {
|
||||
class StaticPipeline : public Renderer3DPipeline {
|
||||
public:
|
||||
Stapipeline();
|
||||
~Stapipeline();
|
||||
StaticPipeline();
|
||||
~StaticPipeline();
|
||||
|
||||
void init(RendererCore* core);
|
||||
|
||||
@@ -30,30 +30,30 @@ class Stapipeline : public Renderer3DPipeline {
|
||||
|
||||
/**
|
||||
* Render 3D data via "meshes".
|
||||
* This render() method is a bridge to core.renderer3D.render() method.
|
||||
* This render() method is a bridge to core.render() method.
|
||||
*/
|
||||
void render(DynamicMesh* mesh, const StapipOptions* options = nullptr);
|
||||
void render(DynamicMesh* mesh, const StaPipOptions* options = nullptr);
|
||||
|
||||
private:
|
||||
StapipelineCore core;
|
||||
StaPipelineCore core;
|
||||
RendererCore* rendererCore;
|
||||
Vec4* colorsCache;
|
||||
|
||||
void addVertices(DynamicMesh* mesh, MeshMaterial* material, StapipBag* bag,
|
||||
void addVertices(DynamicMesh* mesh, MeshMaterial* material, StaPipBag* bag,
|
||||
MeshFrame* frameFrom, MeshFrame* frameTo) const;
|
||||
StapipInfoBag* getInfoBag(DynamicMesh* mesh, const StapipOptions* options,
|
||||
StaPipInfoBag* getInfoBag(DynamicMesh* mesh, const StaPipOptions* options,
|
||||
M4x4* model) const;
|
||||
StapipColorBag* getColorBag(DynamicMesh* mesh, MeshMaterial* material,
|
||||
StaPipColorBag* getColorBag(DynamicMesh* mesh, MeshMaterial* material,
|
||||
MeshFrame* frameFrom, MeshFrame* frameTo) const;
|
||||
StapipTextureBag* getTextureBag(DynamicMesh* mesh, MeshMaterial* material,
|
||||
StaPipTextureBag* getTextureBag(DynamicMesh* mesh, MeshMaterial* material,
|
||||
MeshFrame* frameFrom, MeshFrame* frameTo);
|
||||
StapipLightingBag* getLightingBag(DynamicMesh* mesh, MeshMaterial* material,
|
||||
StaPipLightingBag* getLightingBag(DynamicMesh* mesh, MeshMaterial* material,
|
||||
M4x4* model, MeshFrame* frameFrom,
|
||||
MeshFrame* frameTo,
|
||||
const StapipOptions* options) const;
|
||||
void deallocDrawBags(StapipBag* bag, MeshMaterial* material) const;
|
||||
const StaPipOptions* options) const;
|
||||
void deallocDrawBags(StaPipBag* bag, MeshMaterial* material) const;
|
||||
|
||||
void setLightingColorsCache(StapipLightingOptions* lightingOptions);
|
||||
void setLightingColorsCache(StaPipLightingOptions* lightingOptions);
|
||||
};
|
||||
|
||||
} // namespace Tyra
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
# ______ ____ ___
|
||||
# | \/ ____| |___|
|
||||
# | | | \ | |
|
||||
#-----------------------------------------------------------------------
|
||||
# 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/dynamic/dynamic_pipeline.hpp"
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
DynamicPipeline::DynamicPipeline() {}
|
||||
|
||||
DynamicPipeline::~DynamicPipeline() {}
|
||||
|
||||
void DynamicPipeline::init(RendererCore* t_core) {}
|
||||
|
||||
void DynamicPipeline::onUse() {}
|
||||
|
||||
void DynamicPipeline::render(DynamicMesh* mesh, const DynPipOptions* options) {}
|
||||
|
||||
} // namespace Tyra
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
StapipBagPackage::StapipBagPackage() {
|
||||
StaPipBagPackage::StaPipBagPackage() {
|
||||
size = 0;
|
||||
bag = nullptr;
|
||||
vertices = nullptr;
|
||||
@@ -24,24 +24,24 @@ StapipBagPackage::StapipBagPackage() {
|
||||
normals = nullptr;
|
||||
colors = nullptr;
|
||||
}
|
||||
StapipBagPackage::~StapipBagPackage() {}
|
||||
StaPipBagPackage::~StaPipBagPackage() {}
|
||||
|
||||
void StapipBagPackage::print() const {
|
||||
void StaPipBagPackage::print() const {
|
||||
auto text = getPrint(nullptr);
|
||||
printf("%s\n", text.c_str());
|
||||
}
|
||||
|
||||
void StapipBagPackage::print(const char* name) const {
|
||||
void StaPipBagPackage::print(const char* name) const {
|
||||
auto text = getPrint(name);
|
||||
printf("%s\n", text.c_str());
|
||||
}
|
||||
|
||||
std::string StapipBagPackage::getPrint(const char* name) const {
|
||||
std::string StaPipBagPackage::getPrint(const char* name) const {
|
||||
std::stringstream res;
|
||||
if (name) {
|
||||
res << name << "(";
|
||||
} else {
|
||||
res << "StapipBagPackage(";
|
||||
res << "StaPipBagPackage(";
|
||||
}
|
||||
res << std::fixed << std::setprecision(2);
|
||||
res << std::endl;
|
||||
|
||||
@@ -15,10 +15,10 @@
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
StapipBagPackager::StapipBagPackager() {}
|
||||
StapipBagPackager::~StapipBagPackager() {}
|
||||
StaPipBagPackager::StaPipBagPackager() {}
|
||||
StaPipBagPackager::~StaPipBagPackager() {}
|
||||
|
||||
void StapipBagPackager::init(Renderer3DFrustumPlanes* t_frustumPlanes) {
|
||||
void StaPipBagPackager::init(Renderer3DFrustumPlanes* t_frustumPlanes) {
|
||||
frustumPlanes = t_frustumPlanes;
|
||||
}
|
||||
|
||||
@@ -27,13 +27,13 @@ void StapipBagPackager::init(Renderer3DFrustumPlanes* t_frustumPlanes) {
|
||||
*
|
||||
* @param size Max maxVertCount verts (VU1 buffer size)
|
||||
*/
|
||||
StapipBagPackage* StapipBagPackager::create(u16* o_size, StapipBag* data,
|
||||
StaPipBagPackage* StaPipBagPackager::create(u16* o_size, StaPipBag* data,
|
||||
u16 size) {
|
||||
TYRA_ASSERT(size <= maxVertCount, "StapipBagPackage can have max ",
|
||||
TYRA_ASSERT(size <= maxVertCount, "StaPipBagPackage can have max ",
|
||||
maxVertCount, " verts. Provided \"", size, "\"");
|
||||
|
||||
*o_size = ceil(data->count / static_cast<float>(size));
|
||||
StapipBagPackage* result = new StapipBagPackage[*o_size];
|
||||
StaPipBagPackage* result = new StaPipBagPackage[*o_size];
|
||||
|
||||
for (u16 i = 0; i < *o_size; i++) {
|
||||
result[i].bag = data;
|
||||
@@ -65,14 +65,14 @@ StapipBagPackage* StapipBagPackager::create(u16* o_size, StapipBag* data,
|
||||
*
|
||||
* @param size Max maxVertCount verts (VU1 buffer size)
|
||||
*/
|
||||
StapipBagPackage* StapipBagPackager::create(u16* o_count,
|
||||
const StapipBagPackage& pkg,
|
||||
StaPipBagPackage* StaPipBagPackager::create(u16* o_count,
|
||||
const StaPipBagPackage& pkg,
|
||||
u16 size) {
|
||||
TYRA_ASSERT(size <= maxVertCount, "StapipBagPackage 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 StapipBagPackage[*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 @@ StapipBagPackage* StapipBagPackager::create(u16* o_count,
|
||||
return result;
|
||||
}
|
||||
|
||||
CoreBBoxFrustum StapipBagPackager::checkFrustum(const StapipBagPackage& 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 StapipBagPackager::checkFrustum(const StapipBagPackage& pkg) {
|
||||
}
|
||||
}
|
||||
|
||||
void StapipBagPackager::setMaxVertCount(const u32& count) {
|
||||
void StaPipBagPackager::setMaxVertCount(const u32& count) {
|
||||
maxVertCount = count;
|
||||
}
|
||||
|
||||
|
||||
+12
-12
@@ -18,7 +18,7 @@
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
StapipBagPackagesBBox::StapipBagPackagesBBox(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;
|
||||
@@ -35,7 +35,7 @@ StapipBagPackagesBBox::StapipBagPackagesBBox(Vec4* t_vertices, u32* t_faces,
|
||||
mainBBox = new RenderBBox(*bboxParts, 0, partsCount);
|
||||
}
|
||||
|
||||
StapipBagPackagesBBox::StapipBagPackagesBBox(Vec4* t_vertices,
|
||||
StaPipBagPackagesBBox::StaPipBagPackagesBBox(Vec4* t_vertices,
|
||||
const u32& t_count,
|
||||
const u32& t_maxVertCount) {
|
||||
u32 splitPartSize = t_maxVertCount / 3;
|
||||
@@ -52,40 +52,40 @@ StapipBagPackagesBBox::StapipBagPackagesBBox(Vec4* t_vertices,
|
||||
mainBBox = new RenderBBox(*bboxParts, 0, partsCount);
|
||||
}
|
||||
|
||||
const RenderBBox& StapipBagPackagesBBox::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* StapipBagPackagesBBox::getMainBBox() { return mainBBox; }
|
||||
RenderBBox* StaPipBagPackagesBBox::getMainBBox() { return mainBBox; }
|
||||
|
||||
const u32& StapipBagPackagesBBox::getPartsCount() const { return partsCount; }
|
||||
const u32& StaPipBagPackagesBBox::getPartsCount() const { return partsCount; }
|
||||
|
||||
const u32& StapipBagPackagesBBox::getVertexCount() const { return vertexCount; }
|
||||
const u32& StaPipBagPackagesBBox::getVertexCount() const { return vertexCount; }
|
||||
|
||||
RenderBBox StapipBagPackagesBBox::createChildBBox(const u32& index,
|
||||
RenderBBox StaPipBagPackagesBBox::createChildBBox(const u32& index,
|
||||
const u16& partsSize) const {
|
||||
return RenderBBox(*bboxParts, index, partsSize);
|
||||
}
|
||||
|
||||
void StapipBagPackagesBBox::print() const {
|
||||
void StaPipBagPackagesBBox::print() const {
|
||||
auto text = getPrint(nullptr);
|
||||
printf("%s\n", text.c_str());
|
||||
}
|
||||
|
||||
void StapipBagPackagesBBox::print(const char* name) const {
|
||||
void StaPipBagPackagesBBox::print(const char* name) const {
|
||||
auto text = getPrint(name);
|
||||
printf("%s\n", text.c_str());
|
||||
}
|
||||
|
||||
std::string StapipBagPackagesBBox::getPrint(const char* name) const {
|
||||
std::string StaPipBagPackagesBBox::getPrint(const char* name) const {
|
||||
std::stringstream res;
|
||||
if (name) {
|
||||
res << name << "(";
|
||||
} else {
|
||||
res << "StapipBagPackagesBBox(";
|
||||
res << "StaPipBagPackagesBBox(";
|
||||
}
|
||||
res << std::fixed << std::setprecision(2);
|
||||
res << std::endl;
|
||||
@@ -106,7 +106,7 @@ std::string StapipBagPackagesBBox::getPrint(const char* name) const {
|
||||
return res.str();
|
||||
}
|
||||
|
||||
StapipBagPackagesBBox::~StapipBagPackagesBBox() {
|
||||
StaPipBagPackagesBBox::~StaPipBagPackagesBBox() {
|
||||
delete bboxParts;
|
||||
delete mainBBox;
|
||||
}
|
||||
|
||||
@@ -14,37 +14,37 @@
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
StapipBag::StapipBag() {
|
||||
StaPipBag::StaPipBag() {
|
||||
info = nullptr;
|
||||
color = nullptr;
|
||||
texture = nullptr;
|
||||
lighting = nullptr;
|
||||
}
|
||||
|
||||
StapipBag::~StapipBag() {}
|
||||
StaPipBag::~StaPipBag() {}
|
||||
|
||||
StapipBagPackagesBBox StapipBag::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 StapipBagPackagesBBox(vertices, count, maxVertCount);
|
||||
return StaPipBagPackagesBBox(vertices, count, maxVertCount);
|
||||
}
|
||||
|
||||
void StapipBag::print() const {
|
||||
void StaPipBag::print() const {
|
||||
auto text = getPrint(nullptr);
|
||||
printf("%s\n", text.c_str());
|
||||
}
|
||||
|
||||
void StapipBag::print(const char* name) const {
|
||||
void StaPipBag::print(const char* name) const {
|
||||
auto text = getPrint(name);
|
||||
printf("%s\n", text.c_str());
|
||||
}
|
||||
|
||||
std::string StapipBag::getPrint(const char* name) const {
|
||||
std::string StaPipBag::getPrint(const char* name) const {
|
||||
std::stringstream res;
|
||||
if (name) {
|
||||
res << name << "(";
|
||||
} else {
|
||||
res << "StapipBag(";
|
||||
res << "StaPipBag(";
|
||||
}
|
||||
res << std::fixed << std::setprecision(4);
|
||||
res << std::endl;
|
||||
|
||||
@@ -12,11 +12,11 @@
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
StapipColorBag::StapipColorBag() {
|
||||
StaPipColorBag::StaPipColorBag() {
|
||||
single = nullptr;
|
||||
many = nullptr;
|
||||
}
|
||||
|
||||
StapipColorBag::~StapipColorBag() {}
|
||||
StaPipColorBag::~StaPipColorBag() {}
|
||||
|
||||
} // namespace Tyra
|
||||
|
||||
@@ -12,13 +12,13 @@
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
StapipInfoBag::StapipInfoBag() {
|
||||
shadingType = StapipShadingFlat;
|
||||
StaPipInfoBag::StaPipInfoBag() {
|
||||
shadingType = StaPipShadingFlat;
|
||||
blendingEnabled = true;
|
||||
antiAliasingEnabled = false;
|
||||
model = nullptr;
|
||||
}
|
||||
|
||||
StapipInfoBag::~StapipInfoBag() {}
|
||||
StaPipInfoBag::~StaPipInfoBag() {}
|
||||
|
||||
} // namespace Tyra
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
StapipLightingBag::StapipLightingBag(const bool& manual) {
|
||||
StaPipLightingBag::StaPipLightingBag(const bool& manual) {
|
||||
isAllocated = false;
|
||||
mode = Auto;
|
||||
normals = nullptr;
|
||||
@@ -27,24 +27,24 @@ StapipLightingBag::StapipLightingBag(const bool& manual) {
|
||||
}
|
||||
}
|
||||
|
||||
StapipLightingBag::~StapipLightingBag() { deallocate(); }
|
||||
StaPipLightingBag::~StaPipLightingBag() { deallocate(); }
|
||||
|
||||
void StapipLightingBag::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 StapipLightingBag::setDirectionalLightColors(Color* colors,
|
||||
void StaPipLightingBag::setDirectionalLightColors(Color* colors,
|
||||
const u8& count) {
|
||||
for (u8 i = 0; i < count; i++) setDirectionalLightColor(colors[i], i);
|
||||
}
|
||||
|
||||
void StapipLightingBag::setDirectionalLightDirections(Vec4* directions,
|
||||
void StaPipLightingBag::setDirectionalLightDirections(Vec4* directions,
|
||||
const u8& count) {
|
||||
for (u8 i = 0; i < count; i++) setDirectionalLightDirection(directions[i], i);
|
||||
}
|
||||
|
||||
void StapipLightingBag::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 StapipLightingBag::setDirectionalLightColor(const Color& color,
|
||||
lightColors[index].set(reinterpret_cast<const Vec4&>(color));
|
||||
}
|
||||
|
||||
void StapipLightingBag::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 StapipLightingBag::setDirectionalLightDirection(const Vec4& direction,
|
||||
lightDirections[index].set(direction);
|
||||
}
|
||||
|
||||
void StapipLightingBag::setLightsManually(Vec4* colors, Vec4* directions) {
|
||||
void StaPipLightingBag::setLightsManually(Vec4* colors, Vec4* directions) {
|
||||
deallocate();
|
||||
lightColors = colors;
|
||||
lightDirections = directions;
|
||||
mode = Manual;
|
||||
}
|
||||
|
||||
void StapipLightingBag::disableManualMode() {
|
||||
void StaPipLightingBag::disableManualMode() {
|
||||
allocate();
|
||||
mode = Auto;
|
||||
}
|
||||
|
||||
void StapipLightingBag::allocate() {
|
||||
void StaPipLightingBag::allocate() {
|
||||
if (isAllocated) return;
|
||||
|
||||
lightColors = new Vec4[4];
|
||||
@@ -92,27 +92,27 @@ void StapipLightingBag::allocate() {
|
||||
isAllocated = true;
|
||||
}
|
||||
|
||||
void StapipLightingBag::deallocate() {
|
||||
void StaPipLightingBag::deallocate() {
|
||||
if (!isAllocated) return;
|
||||
|
||||
forceDeallocate();
|
||||
}
|
||||
|
||||
void StapipLightingBag::forceDeallocate() {
|
||||
void StaPipLightingBag::forceDeallocate() {
|
||||
forceDeallocateColors();
|
||||
forceDeallocateDirections();
|
||||
|
||||
isAllocated = false;
|
||||
}
|
||||
|
||||
void StapipLightingBag::forceDeallocateColors() {
|
||||
void StaPipLightingBag::forceDeallocateColors() {
|
||||
if (lightColors != nullptr) {
|
||||
delete[] lightColors;
|
||||
lightColors = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void StapipLightingBag::forceDeallocateDirections() {
|
||||
void StaPipLightingBag::forceDeallocateDirections() {
|
||||
if (lightDirections != nullptr) {
|
||||
delete[] lightDirections;
|
||||
lightDirections = nullptr;
|
||||
|
||||
@@ -12,11 +12,11 @@
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
StapipTextureBag::StapipTextureBag() {
|
||||
StaPipTextureBag::StaPipTextureBag() {
|
||||
coordinates = nullptr;
|
||||
texture = nullptr;
|
||||
}
|
||||
|
||||
StapipTextureBag::~StapipTextureBag() {}
|
||||
StaPipTextureBag::~StaPipTextureBag() {}
|
||||
|
||||
} // namespace Tyra
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
;---------------------------------------------------------------
|
||||
|
||||
.syntax new
|
||||
.name StapipVU1As_Is_C
|
||||
.name StaPipVU1As_Is_C
|
||||
.vu
|
||||
.init_vf_all
|
||||
.init_vi_all
|
||||
@@ -28,7 +28,7 @@
|
||||
--enter
|
||||
--endenter
|
||||
|
||||
#vuprog StapipVU1AsIsC
|
||||
#vuprog StaPipVU1AsIsC
|
||||
|
||||
LoadTyraStaticData{ gifSetTag }
|
||||
LoadTyraSingleColor{ singleColor, singleColorEnabled, VU1_SINGLE_COLOR_ADDR, VU1_OPTIONS_ADDR }
|
||||
|
||||
+9
-9
@@ -11,25 +11,25 @@
|
||||
#include "debug/debug.hpp"
|
||||
#include "renderer/3d/pipeline/static/core/programs/as_is/stapip_as_is_c_vu1_program.hpp"
|
||||
|
||||
extern u32 StapipVU1As_Is_C_CodeStart __attribute__((section(".vudata")));
|
||||
extern u32 StapipVU1As_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 {
|
||||
|
||||
StapipAsIsCVU1Program::StapipAsIsCVU1Program()
|
||||
: StapipVU1Program(StapipAsIsColor, &StapipVU1As_Is_C_CodeStart,
|
||||
&StapipVU1As_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) {}
|
||||
|
||||
StapipAsIsCVU1Program::~StapipAsIsCVU1Program() {}
|
||||
StaPipAsIsCVU1Program::~StaPipAsIsCVU1Program() {}
|
||||
|
||||
std::string StapipAsIsCVU1Program::getStringName() const {
|
||||
std::string StaPipAsIsCVU1Program::getStringName() const {
|
||||
return std::string("As is - C");
|
||||
}
|
||||
|
||||
void StapipAsIsCVU1Program::addProgramQBufferDataToPacket(
|
||||
packet2_t* packet, StapipQBuffer* qbuffer) const {
|
||||
void StaPipAsIsCVU1Program::addProgramQBufferDataToPacket(
|
||||
packet2_t* packet, StaPipQBuffer* qbuffer) const {
|
||||
u32 addr = VU1_VERT_DATA_ADDR;
|
||||
|
||||
// Add vertices
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
;---------------------------------------------------------------
|
||||
|
||||
.syntax new
|
||||
.name StapipVU1As_Is_D
|
||||
.name StaPipVU1As_Is_D
|
||||
.vu
|
||||
.init_vf_all
|
||||
.init_vi_all
|
||||
@@ -28,7 +28,7 @@
|
||||
--enter
|
||||
--endenter
|
||||
|
||||
#vuprog StapipVU1AsIsD
|
||||
#vuprog StaPipVU1AsIsD
|
||||
|
||||
LoadTyraStaticData{ gifSetTag }
|
||||
LoadTyraDirectionalLights{ lightMatrix, lightDirections, lightColors, ambientColor, VU1_LIGHTS_DIRS_ADDR, VU1_LIGHTS_COLORS_ADDR, VU1_LIGHTS_MATRIX_ADDR }
|
||||
|
||||
+9
-9
@@ -11,25 +11,25 @@
|
||||
#include "debug/debug.hpp"
|
||||
#include "renderer/3d/pipeline/static/core/programs/as_is/stapip_as_is_d_vu1_program.hpp"
|
||||
|
||||
extern u32 StapipVU1As_Is_D_CodeStart __attribute__((section(".vudata")));
|
||||
extern u32 StapipVU1As_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 {
|
||||
|
||||
StapipAsIsDVU1Program::StapipAsIsDVU1Program()
|
||||
: StapipVU1Program(StapipAsIsDirLights, &StapipVU1As_Is_D_CodeStart,
|
||||
&StapipVU1As_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) {}
|
||||
|
||||
StapipAsIsDVU1Program::~StapipAsIsDVU1Program() {}
|
||||
StaPipAsIsDVU1Program::~StaPipAsIsDVU1Program() {}
|
||||
|
||||
std::string StapipAsIsDVU1Program::getStringName() const {
|
||||
std::string StaPipAsIsDVU1Program::getStringName() const {
|
||||
return std::string("As is - LC");
|
||||
}
|
||||
|
||||
void StapipAsIsDVU1Program::addProgramQBufferDataToPacket(
|
||||
packet2_t* packet, StapipQBuffer* qbuffer) const {
|
||||
void StaPipAsIsDVU1Program::addProgramQBufferDataToPacket(
|
||||
packet2_t* packet, StaPipQBuffer* qbuffer) const {
|
||||
u32 addr = VU1_VERT_DATA_ADDR;
|
||||
|
||||
// Add vertices
|
||||
|
||||
+2
-2
@@ -13,7 +13,7 @@
|
||||
;---------------------------------------------------------------
|
||||
|
||||
.syntax new
|
||||
.name StapipVU1As_Is_TC
|
||||
.name StaPipVU1As_Is_TC
|
||||
.vu
|
||||
.init_vf_all
|
||||
.init_vi_all
|
||||
@@ -29,7 +29,7 @@
|
||||
--enter
|
||||
--endenter
|
||||
|
||||
#vuprog StapipVU1AsIsTC
|
||||
#vuprog StaPipVU1AsIsTC
|
||||
|
||||
LoadTyraStaticData{ gifSetTag }
|
||||
LoadTyraSingleColor{ singleColor, singleColorEnabled, VU1_SINGLE_COLOR_ADDR, VU1_OPTIONS_ADDR }
|
||||
|
||||
+9
-9
@@ -11,26 +11,26 @@
|
||||
#include "debug/debug.hpp"
|
||||
#include "renderer/3d/pipeline/static/core/programs/as_is/stapip_as_is_tc_vu1_program.hpp"
|
||||
|
||||
extern u32 StapipVU1As_Is_TC_CodeStart __attribute__((section(".vudata")));
|
||||
extern u32 StapipVU1As_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 {
|
||||
|
||||
StapipAsIsTCVU1Program::StapipAsIsTCVU1Program()
|
||||
: StapipVU1Program(StapipAsIsTextureColor, &StapipVU1As_Is_TC_CodeStart,
|
||||
&StapipVU1As_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) {}
|
||||
|
||||
StapipAsIsTCVU1Program::~StapipAsIsTCVU1Program() {}
|
||||
StaPipAsIsTCVU1Program::~StaPipAsIsTCVU1Program() {}
|
||||
|
||||
std::string StapipAsIsTCVU1Program::getStringName() const {
|
||||
std::string StaPipAsIsTCVU1Program::getStringName() const {
|
||||
return std::string("As is - TC");
|
||||
}
|
||||
|
||||
void StapipAsIsTCVU1Program::addProgramQBufferDataToPacket(
|
||||
packet2_t* packet, StapipQBuffer* qbuffer) const {
|
||||
void StaPipAsIsTCVU1Program::addProgramQBufferDataToPacket(
|
||||
packet2_t* packet, StaPipQBuffer* qbuffer) const {
|
||||
u32 addr = VU1_VERT_DATA_ADDR;
|
||||
|
||||
// Add vertices
|
||||
|
||||
+2
-2
@@ -13,7 +13,7 @@
|
||||
;---------------------------------------------------------------
|
||||
|
||||
.syntax new
|
||||
.name StapipVU1As_Is_TD
|
||||
.name StaPipVU1As_Is_TD
|
||||
.vu
|
||||
.init_vf_all
|
||||
.init_vi_all
|
||||
@@ -29,7 +29,7 @@
|
||||
--enter
|
||||
--endenter
|
||||
|
||||
#vuprog StapipVU1AsIsTD
|
||||
#vuprog StaPipVU1AsIsTD
|
||||
|
||||
LoadTyraStaticData{ gifSetTag }
|
||||
LoadTyraDirectionalLights{ lightMatrix, lightDirections, lightColors, ambientColor, VU1_LIGHTS_DIRS_ADDR, VU1_LIGHTS_COLORS_ADDR, VU1_LIGHTS_MATRIX_ADDR }
|
||||
|
||||
+9
-9
@@ -11,26 +11,26 @@
|
||||
#include "debug/debug.hpp"
|
||||
#include "renderer/3d/pipeline/static/core/programs/as_is/stapip_as_is_td_vu1_program.hpp"
|
||||
|
||||
extern u32 StapipVU1As_Is_TD_CodeStart __attribute__((section(".vudata")));
|
||||
extern u32 StapipVU1As_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 {
|
||||
|
||||
StapipAsIsTDVU1Program::StapipAsIsTDVU1Program()
|
||||
: StapipVU1Program(StapipAsIsTextureDirLights, &StapipVU1As_Is_TD_CodeStart,
|
||||
&StapipVU1As_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) {}
|
||||
|
||||
StapipAsIsTDVU1Program::~StapipAsIsTDVU1Program() {}
|
||||
StaPipAsIsTDVU1Program::~StaPipAsIsTDVU1Program() {}
|
||||
|
||||
std::string StapipAsIsTDVU1Program::getStringName() const {
|
||||
std::string StaPipAsIsTDVU1Program::getStringName() const {
|
||||
return std::string("As is - LTC");
|
||||
}
|
||||
|
||||
void StapipAsIsTDVU1Program::addProgramQBufferDataToPacket(
|
||||
packet2_t* packet, StapipQBuffer* qbuffer) const {
|
||||
void StaPipAsIsTDVU1Program::addProgramQBufferDataToPacket(
|
||||
packet2_t* packet, StaPipQBuffer* qbuffer) const {
|
||||
u32 addr = VU1_VERT_DATA_ADDR;
|
||||
|
||||
// Add vertices
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
;---------------------------------------------------------------
|
||||
|
||||
.syntax new
|
||||
.name StapipVU1Cull_C
|
||||
.name StaPipVU1Cull_C
|
||||
.vu
|
||||
.init_vf_all
|
||||
.init_vi_all
|
||||
@@ -28,7 +28,7 @@
|
||||
--enter
|
||||
--endenter
|
||||
|
||||
#vuprog StapipVU1CullC
|
||||
#vuprog StaPipVU1CullC
|
||||
|
||||
ResetClipFlags{ }
|
||||
LoadTyraStaticData{ gifSetTag }
|
||||
|
||||
+9
-9
@@ -11,24 +11,24 @@
|
||||
#include "debug/debug.hpp"
|
||||
#include "renderer/3d/pipeline/static/core/programs/cull/stapip_cull_c_vu1_program.hpp"
|
||||
|
||||
extern u32 StapipVU1Cull_C_CodeStart __attribute__((section(".vudata")));
|
||||
extern u32 StapipVU1Cull_C_CodeEnd __attribute__((section(".vudata")));
|
||||
extern u32 StaPipVU1Cull_C_CodeStart __attribute__((section(".vudata")));
|
||||
extern u32 StaPipVU1Cull_C_CodeEnd __attribute__((section(".vudata")));
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
StapipCullCVU1Program::StapipCullCVU1Program()
|
||||
: StapipVU1Program(
|
||||
StapipCullColor, &StapipVU1Cull_C_CodeStart, &StapipVU1Cull_C_CodeEnd,
|
||||
StaPipCullCVU1Program::StaPipCullCVU1Program()
|
||||
: StaPipVU1Program(
|
||||
StaPipCullColor, &StaPipVU1Cull_C_CodeStart, &StaPipVU1Cull_C_CodeEnd,
|
||||
((u64)GIF_REG_RGBAQ) << 0 | ((u64)GIF_REG_XYZ2) << 4, 2, 2) {}
|
||||
|
||||
StapipCullCVU1Program::~StapipCullCVU1Program() {}
|
||||
StaPipCullCVU1Program::~StaPipCullCVU1Program() {}
|
||||
|
||||
std::string StapipCullCVU1Program::getStringName() const {
|
||||
std::string StaPipCullCVU1Program::getStringName() const {
|
||||
return std::string("Cull - C");
|
||||
}
|
||||
|
||||
void StapipCullCVU1Program::addProgramQBufferDataToPacket(
|
||||
packet2_t* packet, StapipQBuffer* qbuffer) const {
|
||||
void StaPipCullCVU1Program::addProgramQBufferDataToPacket(
|
||||
packet2_t* packet, StaPipQBuffer* qbuffer) const {
|
||||
u32 addr = VU1_VERT_DATA_ADDR;
|
||||
|
||||
// Add vertices
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
;---------------------------------------------------------------
|
||||
|
||||
.syntax new
|
||||
.name StapipVU1Cull_D
|
||||
.name StaPipVU1Cull_D
|
||||
.vu
|
||||
.init_vf_all
|
||||
.init_vi_all
|
||||
@@ -28,7 +28,7 @@
|
||||
--enter
|
||||
--endenter
|
||||
|
||||
#vuprog StapipVU1CullD
|
||||
#vuprog StaPipVU1CullD
|
||||
|
||||
ResetClipFlags{ }
|
||||
LoadTyraStaticData{ gifSetTag }
|
||||
|
||||
+9
-9
@@ -11,25 +11,25 @@
|
||||
#include "debug/debug.hpp"
|
||||
#include "renderer/3d/pipeline/static/core/programs/cull/stapip_cull_d_vu1_program.hpp"
|
||||
|
||||
extern u32 StapipVU1Cull_D_CodeStart __attribute__((section(".vudata")));
|
||||
extern u32 StapipVU1Cull_D_CodeEnd __attribute__((section(".vudata")));
|
||||
extern u32 StaPipVU1Cull_D_CodeStart __attribute__((section(".vudata")));
|
||||
extern u32 StaPipVU1Cull_D_CodeEnd __attribute__((section(".vudata")));
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
StapipCullDVU1Program::StapipCullDVU1Program()
|
||||
: StapipVU1Program(StapipCullDirLights, &StapipVU1Cull_D_CodeStart,
|
||||
&StapipVU1Cull_D_CodeEnd,
|
||||
StaPipCullDVU1Program::StaPipCullDVU1Program()
|
||||
: StaPipVU1Program(StaPipCullDirLights, &StaPipVU1Cull_D_CodeStart,
|
||||
&StaPipVU1Cull_D_CodeEnd,
|
||||
((u64)GIF_REG_RGBAQ) << 0 | ((u64)GIF_REG_XYZ2) << 4, 2,
|
||||
3) {}
|
||||
|
||||
StapipCullDVU1Program::~StapipCullDVU1Program() {}
|
||||
StaPipCullDVU1Program::~StaPipCullDVU1Program() {}
|
||||
|
||||
std::string StapipCullDVU1Program::getStringName() const {
|
||||
std::string StaPipCullDVU1Program::getStringName() const {
|
||||
return std::string("Cull - LC");
|
||||
}
|
||||
|
||||
void StapipCullDVU1Program::addProgramQBufferDataToPacket(
|
||||
packet2_t* packet, StapipQBuffer* qbuffer) const {
|
||||
void StaPipCullDVU1Program::addProgramQBufferDataToPacket(
|
||||
packet2_t* packet, StaPipQBuffer* qbuffer) const {
|
||||
u32 addr = VU1_VERT_DATA_ADDR;
|
||||
|
||||
// Add vertices
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
;---------------------------------------------------------------
|
||||
|
||||
.syntax new
|
||||
.name StapipVU1Cull_TC
|
||||
.name StaPipVU1Cull_TC
|
||||
.vu
|
||||
.init_vf_all
|
||||
.init_vi_all
|
||||
@@ -29,7 +29,7 @@
|
||||
--enter
|
||||
--endenter
|
||||
|
||||
#vuprog StapipVU1CullTC
|
||||
#vuprog StaPipVU1CullTC
|
||||
|
||||
ResetClipFlags{ }
|
||||
LoadTyraStaticData{ gifSetTag }
|
||||
|
||||
+9
-9
@@ -11,26 +11,26 @@
|
||||
#include "debug/debug.hpp"
|
||||
#include "renderer/3d/pipeline/static/core/programs/cull/stapip_cull_tc_vu1_program.hpp"
|
||||
|
||||
extern u32 StapipVU1Cull_TC_CodeStart __attribute__((section(".vudata")));
|
||||
extern u32 StapipVU1Cull_TC_CodeEnd __attribute__((section(".vudata")));
|
||||
extern u32 StaPipVU1Cull_TC_CodeStart __attribute__((section(".vudata")));
|
||||
extern u32 StaPipVU1Cull_TC_CodeEnd __attribute__((section(".vudata")));
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
StapipCullTCVU1Program::StapipCullTCVU1Program()
|
||||
: StapipVU1Program(StapipCullTextureColor, &StapipVU1Cull_TC_CodeStart,
|
||||
&StapipVU1Cull_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) {}
|
||||
|
||||
StapipCullTCVU1Program::~StapipCullTCVU1Program() {}
|
||||
StaPipCullTCVU1Program::~StaPipCullTCVU1Program() {}
|
||||
|
||||
std::string StapipCullTCVU1Program::getStringName() const {
|
||||
std::string StaPipCullTCVU1Program::getStringName() const {
|
||||
return std::string("Cull - TC");
|
||||
}
|
||||
|
||||
void StapipCullTCVU1Program::addProgramQBufferDataToPacket(
|
||||
packet2_t* packet, StapipQBuffer* qbuffer) const {
|
||||
void StaPipCullTCVU1Program::addProgramQBufferDataToPacket(
|
||||
packet2_t* packet, StaPipQBuffer* qbuffer) const {
|
||||
u32 addr = VU1_VERT_DATA_ADDR;
|
||||
|
||||
// Add vertices
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
;---------------------------------------------------------------
|
||||
|
||||
.syntax new
|
||||
.name StapipVU1Cull_TD
|
||||
.name StaPipVU1Cull_TD
|
||||
.vu
|
||||
.init_vf_all
|
||||
.init_vi_all
|
||||
@@ -29,7 +29,7 @@
|
||||
--enter
|
||||
--endenter
|
||||
|
||||
#vuprog StapipVU1CullTD
|
||||
#vuprog StaPipVU1CullTD
|
||||
|
||||
ResetClipFlags{ }
|
||||
LoadTyraStaticData{ gifSetTag }
|
||||
|
||||
+9
-9
@@ -11,26 +11,26 @@
|
||||
#include "debug/debug.hpp"
|
||||
#include "renderer/3d/pipeline/static/core/programs/cull/stapip_cull_td_vu1_program.hpp"
|
||||
|
||||
extern u32 StapipVU1Cull_TD_CodeStart __attribute__((section(".vudata")));
|
||||
extern u32 StapipVU1Cull_TD_CodeEnd __attribute__((section(".vudata")));
|
||||
extern u32 StaPipVU1Cull_TD_CodeStart __attribute__((section(".vudata")));
|
||||
extern u32 StaPipVU1Cull_TD_CodeEnd __attribute__((section(".vudata")));
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
StapipCullTDVU1Program::StapipCullTDVU1Program()
|
||||
: StapipVU1Program(StapipCullTextureDirLights, &StapipVU1Cull_TD_CodeStart,
|
||||
&StapipVU1Cull_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) {}
|
||||
|
||||
StapipCullTDVU1Program::~StapipCullTDVU1Program() {}
|
||||
StaPipCullTDVU1Program::~StaPipCullTDVU1Program() {}
|
||||
|
||||
std::string StapipCullTDVU1Program::getStringName() const {
|
||||
std::string StaPipCullTDVU1Program::getStringName() const {
|
||||
return std::string("Cull - LTC");
|
||||
}
|
||||
|
||||
void StapipCullTDVU1Program::addProgramQBufferDataToPacket(
|
||||
packet2_t* packet, StapipQBuffer* qbuffer) const {
|
||||
void StaPipCullTDVU1Program::addProgramQBufferDataToPacket(
|
||||
packet2_t* packet, StaPipQBuffer* qbuffer) const {
|
||||
u32 addr = VU1_VERT_DATA_ADDR;
|
||||
|
||||
// Add vertices
|
||||
|
||||
@@ -12,18 +12,18 @@
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
StapipClipper::StapipClipper() {}
|
||||
StapipClipper::~StapipClipper() {}
|
||||
StaPipClipper::StaPipClipper() {}
|
||||
StaPipClipper::~StaPipClipper() {}
|
||||
|
||||
void StapipClipper::setMVP(M4x4* t_mvp) { mvp = t_mvp; }
|
||||
void StaPipClipper::setMVP(M4x4* t_mvp) { mvp = t_mvp; }
|
||||
|
||||
void StapipClipper::init(const RendererSettings& settings) {
|
||||
void StaPipClipper::init(const RendererSettings& settings) {
|
||||
algorithm.init(settings);
|
||||
}
|
||||
|
||||
void StapipClipper::setMaxVertCount(const u32& count) { maxVertCount = count; }
|
||||
void StaPipClipper::setMaxVertCount(const u32& count) { maxVertCount = count; }
|
||||
|
||||
void StapipClipper::clip(StapipQBuffer* 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 StapipClipper::clip(StapipQBuffer* buffer) {
|
||||
moveDataToBuffer(clippedVertices, buffer);
|
||||
}
|
||||
|
||||
void StapipClipper::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 StapipClipper::moveDataToBuffer(
|
||||
const std::vector<Path1ClipVertex>& vertices, StapipQBuffer* buffer) {
|
||||
void StaPipClipper::moveDataToBuffer(
|
||||
const std::vector<Path1ClipVertex>& vertices, StaPipQBuffer* buffer) {
|
||||
buffer->reallocateManually(vertices.size());
|
||||
|
||||
for (u32 i = 0; i < vertices.size(); i++) {
|
||||
|
||||
@@ -12,31 +12,31 @@
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
StapipProgramsRepository::StapipProgramsRepository() {}
|
||||
StaPipProgramsRepository::StaPipProgramsRepository() {}
|
||||
|
||||
StapipProgramsRepository::~StapipProgramsRepository() {}
|
||||
StaPipProgramsRepository::~StaPipProgramsRepository() {}
|
||||
|
||||
StapipVU1Program* StapipProgramsRepository::getProgram(
|
||||
const StapipProgramName& name) {
|
||||
StaPipVU1Program* StaPipProgramsRepository::getProgram(
|
||||
const StaPipProgramName& name) {
|
||||
switch (name) {
|
||||
case StapipProgramName::StapipAsIsColor:
|
||||
case StaPipProgramName::StaPipAsIsColor:
|
||||
return &asIsColor;
|
||||
case StapipProgramName::StapipCullColor:
|
||||
case StaPipProgramName::StaPipCullColor:
|
||||
return &cullColor;
|
||||
|
||||
case StapipProgramName::StapipAsIsDirLights:
|
||||
case StaPipProgramName::StaPipAsIsDirLights:
|
||||
return &asIsLightingColor;
|
||||
case StapipProgramName::StapipCullDirLights:
|
||||
case StaPipProgramName::StaPipCullDirLights:
|
||||
return &cullLightingColor;
|
||||
|
||||
case StapipProgramName::StapipAsIsTextureDirLights:
|
||||
case StaPipProgramName::StaPipAsIsTextureDirLights:
|
||||
return &asIsLightingTextureColor;
|
||||
case StapipProgramName::StapipCullTextureDirLights:
|
||||
case StaPipProgramName::StaPipCullTextureDirLights:
|
||||
return &cullLightingTextureColor;
|
||||
|
||||
case StapipProgramName::StapipAsIsTextureColor:
|
||||
case StaPipProgramName::StaPipAsIsTextureColor:
|
||||
return &asIsTextureColor;
|
||||
case StapipProgramName::StapipCullTextureColor:
|
||||
case StaPipProgramName::StaPipCullTextureColor:
|
||||
return &cullTextureColor;
|
||||
|
||||
default:
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
StapipQBuffer::StapipQBuffer() {
|
||||
StaPipQBuffer::StaPipQBuffer() {
|
||||
size = 0;
|
||||
_isDynamicallyAllocated = false;
|
||||
_stAllocated = false;
|
||||
@@ -27,11 +27,11 @@ StapipQBuffer::StapipQBuffer() {
|
||||
normals = nullptr;
|
||||
}
|
||||
|
||||
StapipQBuffer::~StapipQBuffer() { deallocateDynamicData(); }
|
||||
StaPipQBuffer::~StaPipQBuffer() { deallocateDynamicData(); }
|
||||
|
||||
void StapipQBuffer::setMaxVertCount(const u32& count) { maxVertCount = count; }
|
||||
void StaPipQBuffer::setMaxVertCount(const u32& count) { maxVertCount = count; }
|
||||
|
||||
void StapipQBuffer::fillByPointer(const StapipBagPackage& pkg) {
|
||||
void StaPipQBuffer::fillByPointer(const StaPipBagPackage& pkg) {
|
||||
TYRA_ASSERT(pkg.size <= maxVertCount, "VU1 buffer supports only ",
|
||||
maxVertCount, " verts. Provided: ", pkg.size);
|
||||
|
||||
@@ -45,9 +45,9 @@ void StapipQBuffer::fillByPointer(const StapipBagPackage& pkg) {
|
||||
bag = pkg.bag;
|
||||
}
|
||||
|
||||
void StapipQBuffer::fillByCopyMax(const StapipBagPackage& pkg1,
|
||||
const StapipBagPackage& pkg2,
|
||||
const StapipBagPackage& 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,
|
||||
@@ -97,8 +97,8 @@ void StapipQBuffer::fillByCopyMax(const StapipBagPackage& pkg1,
|
||||
bag = pkg1.bag;
|
||||
}
|
||||
|
||||
void StapipQBuffer::fillByCopy1By2(const StapipBagPackage& pkg1,
|
||||
const StapipBagPackage& 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,
|
||||
@@ -133,7 +133,7 @@ void StapipQBuffer::fillByCopy1By2(const StapipBagPackage& pkg1,
|
||||
bag = pkg1.bag;
|
||||
}
|
||||
|
||||
void StapipQBuffer::fillByCopy1By3(const StapipBagPackage& pkg) {
|
||||
void StaPipQBuffer::fillByCopy1By3(const StaPipBagPackage& pkg) {
|
||||
TYRA_ASSERT(pkg.size <= maxVertCount / 3,
|
||||
"Wrong package size (1). Provided: ", pkg.size);
|
||||
|
||||
@@ -155,13 +155,13 @@ void StapipQBuffer::fillByCopy1By3(const StapipBagPackage& pkg) {
|
||||
bag = pkg.bag;
|
||||
}
|
||||
|
||||
void StapipQBuffer::reallocateManually(const u16& t_size) {
|
||||
void StaPipQBuffer::reallocateManually(const u16& t_size) {
|
||||
deallocateDynamicData();
|
||||
allocateDynamicData(t_size, bag);
|
||||
size = t_size;
|
||||
}
|
||||
|
||||
void StapipQBuffer::deallocateDynamicData() {
|
||||
void StaPipQBuffer::deallocateDynamicData() {
|
||||
if (_isDynamicallyAllocated) {
|
||||
delete[] vertices;
|
||||
|
||||
@@ -186,7 +186,7 @@ void StapipQBuffer::deallocateDynamicData() {
|
||||
|
||||
/** When we not receive maxVertCount vertices, we must align it by ourself.
|
||||
* Too bad - not efficient. */
|
||||
void StapipQBuffer::allocateDynamicData(u16 size, StapipBag* 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");
|
||||
@@ -211,19 +211,19 @@ void StapipQBuffer::allocateDynamicData(u16 size, StapipBag* bag) {
|
||||
_isDynamicallyAllocated = true;
|
||||
}
|
||||
|
||||
bool StapipQBuffer::any() const { return size > 0; }
|
||||
bool StaPipQBuffer::any() const { return size > 0; }
|
||||
|
||||
void StapipQBuffer::print() const {
|
||||
void StaPipQBuffer::print() const {
|
||||
auto text = getPrint(nullptr);
|
||||
printf("%s\n", text.c_str());
|
||||
}
|
||||
|
||||
void StapipQBuffer::print(const char* name) const {
|
||||
void StaPipQBuffer::print(const char* name) const {
|
||||
auto text = getPrint(name);
|
||||
printf("%s\n", text.c_str());
|
||||
}
|
||||
|
||||
std::string StapipQBuffer::getPrint(const char* name) const {
|
||||
std::string StaPipQBuffer::getPrint(const char* name) const {
|
||||
std::stringstream res;
|
||||
if (name) {
|
||||
res << name << "(";
|
||||
|
||||
@@ -34,14 +34,14 @@ namespace Tyra {
|
||||
*
|
||||
*/
|
||||
|
||||
StapipQBufferRenderer::StapipQBufferRenderer() {
|
||||
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;
|
||||
}
|
||||
StapipQBufferRenderer::~StapipQBufferRenderer() {
|
||||
StaPipQBufferRenderer::~StaPipQBufferRenderer() {
|
||||
packet2_free(packets[0]);
|
||||
packet2_free(packets[1]);
|
||||
packet2_free(staticDataPacket);
|
||||
@@ -50,7 +50,7 @@ StapipQBufferRenderer::~StapipQBufferRenderer() {
|
||||
if (programsPacket) packet2_free(programsPacket);
|
||||
}
|
||||
|
||||
void StapipQBufferRenderer::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 StapipQBufferRenderer::init(RendererCore* t_core) {
|
||||
TYRA_LOG("Renderer3DQBufferRenderer initialized");
|
||||
}
|
||||
|
||||
void StapipQBufferRenderer::reinitVU1() {
|
||||
void StaPipQBufferRenderer::reinitVU1() {
|
||||
sendStaticData();
|
||||
uploadPrograms();
|
||||
setDoubleBuffer();
|
||||
}
|
||||
|
||||
StapipQBuffer* StapipQBufferRenderer::getBuffer() { return &buffers[context]; }
|
||||
StaPipQBuffer* StaPipQBufferRenderer::getBuffer() { return &buffers[context]; }
|
||||
|
||||
void StapipQBufferRenderer::sendObjectData(
|
||||
StapipBag* 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 StapipQBufferRenderer::sendObjectData(
|
||||
dma_channel_send_packet2(objectDataPacket, DMA_CHANNEL_VIF1, true);
|
||||
}
|
||||
|
||||
void StapipQBufferRenderer::setInfo(StapipInfoBag* 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 StapipQBufferRenderer::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 StapipQBufferRenderer::sendStaticData() const {
|
||||
dma_channel_send_packet2(staticDataPacket, DMA_CHANNEL_VIF1, true);
|
||||
}
|
||||
|
||||
void StapipQBufferRenderer::setProgramsCache() {
|
||||
void StaPipQBufferRenderer::setProgramsCache() {
|
||||
VU1Program** programs = new VU1Program*[8];
|
||||
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);
|
||||
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 StapipQBufferRenderer::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 StapipQBufferRenderer::setDoubleBuffer() {
|
||||
void StaPipQBufferRenderer::setDoubleBuffer() {
|
||||
u16 startingAddr = VU1_LAST_ITEM_ADDR + 1;
|
||||
const u16 bufferMaxSize = 1000;
|
||||
bufferSize = (bufferMaxSize - startingAddr) / 2;
|
||||
@@ -178,7 +178,7 @@ void StapipQBufferRenderer::setDoubleBuffer() {
|
||||
// buffer, to first addr of second buffer
|
||||
}
|
||||
|
||||
void StapipQBufferRenderer::cull(StapipQBuffer* buffer) {
|
||||
void StaPipQBufferRenderer::cull(StaPipQBuffer* buffer) {
|
||||
if (buffer->size == 0) {
|
||||
return;
|
||||
}
|
||||
@@ -188,8 +188,8 @@ void StapipQBufferRenderer::cull(StapipQBuffer* buffer) {
|
||||
sendPacket();
|
||||
}
|
||||
|
||||
// void StapipQBufferRenderer::sendFinishTag() {
|
||||
// StapipQBufferRenderer way proposition
|
||||
// void StaPipQBufferRenderer::sendFinishTag() {
|
||||
// StaPipQBufferRenderer way proposition
|
||||
// auto program = path1->getProgramByName(Draw_Finish);
|
||||
// addBufferDataToPacket(program, nullptr);
|
||||
// sendPacket();
|
||||
@@ -206,7 +206,7 @@ void StapipQBufferRenderer::cull(StapipQBuffer* buffer) {
|
||||
// packet2_free(packet2);
|
||||
// }
|
||||
|
||||
void StapipQBufferRenderer::clip(StapipQBuffer* buffer) {
|
||||
void StaPipQBufferRenderer::clip(StaPipQBuffer* buffer) {
|
||||
if (buffer->size == 0) {
|
||||
return;
|
||||
}
|
||||
@@ -220,12 +220,12 @@ void StapipQBufferRenderer::clip(StapipQBuffer* buffer) {
|
||||
}
|
||||
}
|
||||
|
||||
void StapipQBufferRenderer::clearLastProgramName() {
|
||||
void StaPipQBufferRenderer::clearLastProgramName() {
|
||||
lastProgramName = StdipUndefinedProgram;
|
||||
}
|
||||
|
||||
void StapipQBufferRenderer::addBufferDataToPacket(StapipVU1Program* program,
|
||||
StapipQBuffer* buffer) {
|
||||
void StaPipQBufferRenderer::addBufferDataToPacket(StaPipVU1Program* program,
|
||||
StaPipQBuffer* buffer) {
|
||||
currentPacket = packets[context];
|
||||
packet2_reset(currentPacket, false);
|
||||
|
||||
@@ -241,7 +241,7 @@ void StapipQBufferRenderer::addBufferDataToPacket(StapipVU1Program* program,
|
||||
packet2_utils_vu_add_end_tag(currentPacket);
|
||||
}
|
||||
|
||||
void StapipQBufferRenderer::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 StapipQBufferRenderer::sendPacket() {
|
||||
context = !context;
|
||||
}
|
||||
|
||||
void StapipQBufferRenderer::setMaxVertCount(const u32& count) {
|
||||
void StaPipQBufferRenderer::setMaxVertCount(const u32& count) {
|
||||
buffers[0].setMaxVertCount(count);
|
||||
buffers[1].setMaxVertCount(count);
|
||||
clipper.setMaxVertCount(count);
|
||||
}
|
||||
|
||||
StapipVU1Program* StapipQBufferRenderer::getAsIsProgramByBag(
|
||||
const StapipBag* bag) {
|
||||
StaPipVU1Program* StaPipQBufferRenderer::getAsIsProgramByBag(
|
||||
const StaPipBag* bag) {
|
||||
auto programType = getDrawProgramTypeByBag(bag);
|
||||
|
||||
if (programType == StapipVU1TextureDirLights)
|
||||
return getProgramByName(StapipAsIsTextureDirLights);
|
||||
else if (programType == StapipVU1DirLights)
|
||||
return getProgramByName(StapipAsIsDirLights);
|
||||
else if (programType == StapipVU1TextureColor)
|
||||
return getProgramByName(StapipAsIsTextureColor);
|
||||
if (programType == StaPipVU1TextureDirLights)
|
||||
return getProgramByName(StaPipAsIsTextureDirLights);
|
||||
else if (programType == StaPipVU1DirLights)
|
||||
return getProgramByName(StaPipAsIsDirLights);
|
||||
else if (programType == StaPipVU1TextureColor)
|
||||
return getProgramByName(StaPipAsIsTextureColor);
|
||||
else
|
||||
return getProgramByName(StapipAsIsColor);
|
||||
return getProgramByName(StaPipAsIsColor);
|
||||
}
|
||||
|
||||
StapipVU1Program* StapipQBufferRenderer::getCullProgramByBag(
|
||||
const StapipBag* bag) {
|
||||
StaPipVU1Program* StaPipQBufferRenderer::getCullProgramByBag(
|
||||
const StaPipBag* bag) {
|
||||
auto programType = getDrawProgramTypeByBag(bag);
|
||||
return getCullProgramByType(programType);
|
||||
}
|
||||
|
||||
StapipVU1Program* StapipQBufferRenderer::getProgramByName(
|
||||
const StapipProgramName& name) {
|
||||
StaPipVU1Program* StaPipQBufferRenderer::getProgramByName(
|
||||
const StaPipProgramName& name) {
|
||||
return repository.getProgram(name);
|
||||
}
|
||||
|
||||
StapipVU1Program* StapipQBufferRenderer::getCullProgramByParams(
|
||||
StaPipVU1Program* StaPipQBufferRenderer::getCullProgramByParams(
|
||||
const bool& isLightingEnabled, const bool& isTextureEnabled) {
|
||||
auto type = getDrawProgramTypeByParams(isLightingEnabled, isTextureEnabled);
|
||||
return getCullProgramByType(type);
|
||||
}
|
||||
|
||||
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);
|
||||
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(StapipCullColor);
|
||||
return getProgramByName(StaPipCullColor);
|
||||
}
|
||||
|
||||
StapipProgramType StapipQBufferRenderer::getDrawProgramTypeByBag(
|
||||
const StapipBag* bag) const {
|
||||
StaPipProgramType StaPipQBufferRenderer::getDrawProgramTypeByBag(
|
||||
const StaPipBag* bag) const {
|
||||
auto isLightingEnabled = bag->lighting != nullptr;
|
||||
auto isTextureEnabled = bag->texture != nullptr;
|
||||
return getDrawProgramTypeByParams(isLightingEnabled, isTextureEnabled);
|
||||
}
|
||||
|
||||
StapipProgramType StapipQBufferRenderer::getDrawProgramTypeByParams(
|
||||
StaPipProgramType StaPipQBufferRenderer::getDrawProgramTypeByParams(
|
||||
const bool& isLightingEnabled, const bool& isTextureEnabled) const {
|
||||
if (isLightingEnabled && isTextureEnabled)
|
||||
return StapipVU1TextureDirLights;
|
||||
return StaPipVU1TextureDirLights;
|
||||
else if (isLightingEnabled)
|
||||
return StapipVU1DirLights;
|
||||
return StaPipVU1DirLights;
|
||||
else if (isTextureEnabled)
|
||||
return StapipVU1TextureColor;
|
||||
return StaPipVU1TextureColor;
|
||||
else
|
||||
return StapipVU1Color;
|
||||
return StaPipVU1Color;
|
||||
}
|
||||
|
||||
} // namespace Tyra
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
StapipVU1Program::StapipVU1Program(const StapipProgramName& 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 @@ StapipVU1Program::StapipVU1Program(const StapipProgramName& t_name,
|
||||
programSize = calculateProgramSize();
|
||||
}
|
||||
|
||||
StapipVU1Program::~StapipVU1Program() {}
|
||||
StaPipVU1Program::~StaPipVU1Program() {}
|
||||
|
||||
const StapipProgramName& StapipVU1Program::getName() const { return name; }
|
||||
const StaPipProgramName& StaPipVU1Program::getName() const { return name; }
|
||||
|
||||
u32& StapipVU1Program::getReglist() { return reglist; }
|
||||
u32& StaPipVU1Program::getReglist() { return reglist; }
|
||||
|
||||
void StapipVU1Program::addBufferDataToPacket(packet2_t* packet,
|
||||
StapipQBuffer* buffer,
|
||||
void StaPipVU1Program::addBufferDataToPacket(packet2_t* packet,
|
||||
StaPipQBuffer* buffer,
|
||||
prim_t* prim) {
|
||||
addStandardBufferDataToPacket(packet, buffer, prim);
|
||||
addProgramQBufferDataToPacket(packet, buffer);
|
||||
}
|
||||
|
||||
void StapipVU1Program::addStandardBufferDataToPacket(packet2_t* packet,
|
||||
StapipQBuffer* buffer,
|
||||
void StaPipVU1Program::addStandardBufferDataToPacket(packet2_t* packet,
|
||||
StaPipQBuffer* buffer,
|
||||
prim_t* prim) {
|
||||
if (buffer->bag->texture)
|
||||
prim->mapping = 1;
|
||||
@@ -61,7 +61,7 @@ void StapipVU1Program::addStandardBufferDataToPacket(packet2_t* packet,
|
||||
packet2_utils_vu_close_unpack(packet);
|
||||
}
|
||||
|
||||
u16 StapipVU1Program::getMaxVertCount(const bool& singleColorEnabled,
|
||||
u16 StaPipVU1Program::getMaxVertCount(const bool& singleColorEnabled,
|
||||
const u16& bufferSize) const {
|
||||
u16 res = bufferSize - 4;
|
||||
u8 colorElementsPerVertex =
|
||||
|
||||
@@ -22,26 +22,26 @@
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
StapipelineCore::StapipelineCore() { maxVertCount = 0; }
|
||||
StaPipelineCore::StaPipelineCore() { maxVertCount = 0; }
|
||||
|
||||
StapipelineCore::~StapipelineCore() {}
|
||||
StaPipelineCore::~StaPipelineCore() {}
|
||||
|
||||
void StapipelineCore::init(RendererCore* t_core) {
|
||||
void StaPipelineCore::init(RendererCore* t_core) {
|
||||
rendererCore = t_core;
|
||||
qbufferRenderer.init(t_core);
|
||||
packager.init(&rendererCore->renderer3D.frustumPlanes);
|
||||
}
|
||||
|
||||
void StapipelineCore::reinitStandardVU1Programs() {
|
||||
void StaPipelineCore::reinitStandardVU1Programs() {
|
||||
qbufferRenderer.reinitVU1();
|
||||
}
|
||||
|
||||
u32 StapipelineCore::getMaxVertCountByBag(const StapipBag* bag) {
|
||||
u32 StaPipelineCore::getMaxVertCountByBag(const StaPipBag* bag) {
|
||||
return qbufferRenderer.getCullProgramByBag(bag)->getMaxVertCount(
|
||||
bag->color->many == nullptr, qbufferRenderer.getBufferSize());
|
||||
}
|
||||
|
||||
u32 StapipelineCore::getMaxVertCountByParams(const bool& isSingleColor,
|
||||
u32 StaPipelineCore::getMaxVertCountByParams(const bool& isSingleColor,
|
||||
const bool& isLightingEnabled,
|
||||
const bool& isTextureEnabled) {
|
||||
return qbufferRenderer
|
||||
@@ -49,7 +49,7 @@ u32 StapipelineCore::getMaxVertCountByParams(const bool& isSingleColor,
|
||||
->getMaxVertCount(isSingleColor, qbufferRenderer.getBufferSize());
|
||||
}
|
||||
|
||||
void StapipelineCore::render(StapipBag* bag, StapipBagPackagesBBox* bbox) {
|
||||
void StaPipelineCore::render(StaPipBag* bag, StaPipBagPackagesBBox* bbox) {
|
||||
if (bag->count <= 0) return;
|
||||
|
||||
TYRA_ASSERT(bag->vertices != nullptr,
|
||||
@@ -71,7 +71,7 @@ void StapipelineCore::render(StapipBag* bag, StapipBagPackagesBBox* bbox) {
|
||||
!bag->texture || (bag->texture->texture && bag->texture->coordinates),
|
||||
"If you want texture, please provide texture and coordinates!");
|
||||
|
||||
StapipBagPackagesBBox* renderBbox;
|
||||
StaPipBagPackagesBBox* renderBbox;
|
||||
|
||||
u32 maxVertCount = getMaxVertCountByBag(bag);
|
||||
|
||||
@@ -79,7 +79,7 @@ void StapipelineCore::render(StapipBag* bag, StapipBagPackagesBBox* bbox) {
|
||||
|
||||
if (!bbox)
|
||||
renderBbox =
|
||||
new StapipBagPackagesBBox(bag->vertices, bag->count, maxVertCount);
|
||||
new StaPipBagPackagesBBox(bag->vertices, bag->count, maxVertCount);
|
||||
else
|
||||
renderBbox = bbox;
|
||||
|
||||
@@ -141,7 +141,7 @@ void StapipelineCore::render(StapipBag* bag, StapipBagPackagesBBox* bbox) {
|
||||
Verbose("Render finished");
|
||||
}
|
||||
|
||||
void StapipelineCore::renderPkgs(StapipBagPackage* 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 StapipelineCore::renderPkgs(StapipBagPackage* packages, u16 count) {
|
||||
}
|
||||
}
|
||||
|
||||
void StapipelineCore::renderSubpkgs(StapipBagPackage* subpkgs, u16 count) {
|
||||
void StaPipelineCore::renderSubpkgs(StaPipBagPackage* subpkgs, u16 count) {
|
||||
std::vector<u16> doneIndexes;
|
||||
std::vector<u16> loadedIndexes;
|
||||
|
||||
@@ -218,7 +218,7 @@ void StapipelineCore::renderSubpkgs(StapipBagPackage* subpkgs, u16 count) {
|
||||
}
|
||||
}
|
||||
|
||||
void StapipelineCore::setMaxVertCount(const u32& count) {
|
||||
void StaPipelineCore::setMaxVertCount(const u32& count) {
|
||||
maxVertCount = count;
|
||||
packager.setMaxVertCount(count);
|
||||
qbufferRenderer.setMaxVertCount(count);
|
||||
|
||||
@@ -12,18 +12,18 @@
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
Stapipeline::Stapipeline() { colorsCache = new Vec4[4]; }
|
||||
StaticPipeline::StaticPipeline() { colorsCache = new Vec4[4]; }
|
||||
|
||||
Stapipeline::~Stapipeline() { delete[] colorsCache; }
|
||||
StaticPipeline::~StaticPipeline() { delete[] colorsCache; }
|
||||
|
||||
void Stapipeline::init(RendererCore* t_core) {
|
||||
void StaticPipeline::init(RendererCore* t_core) {
|
||||
rendererCore = t_core;
|
||||
core.init(t_core);
|
||||
}
|
||||
|
||||
void Stapipeline::onUse() { core.reinitStandardVU1Programs(); }
|
||||
void StaticPipeline::onUse() { core.reinitStandardVU1Programs(); }
|
||||
|
||||
void Stapipeline::render(DynamicMesh* mesh, const StapipOptions* options) {
|
||||
void StaticPipeline::render(DynamicMesh* mesh, const StaPipOptions* options) {
|
||||
auto model = mesh->getModelMatrix();
|
||||
|
||||
MeshFrame* frameFrom = mesh->getFramesCount() > 0
|
||||
@@ -49,7 +49,7 @@ void Stapipeline::render(DynamicMesh* mesh, const StapipOptions* options) {
|
||||
// material->isSingleColorActivated(), material->getNormalFaces(),
|
||||
// material->getTextureCoordFaces());
|
||||
|
||||
StapipBag bag;
|
||||
StaPipBag bag;
|
||||
addVertices(mesh, material, &bag, frameFrom, frameTo);
|
||||
bag.info = infoBag;
|
||||
bag.color = getColorBag(mesh, material, frameFrom, frameTo);
|
||||
@@ -65,8 +65,8 @@ void Stapipeline::render(DynamicMesh* mesh, const StapipOptions* options) {
|
||||
delete infoBag;
|
||||
}
|
||||
|
||||
void Stapipeline::addVertices(DynamicMesh* mesh, MeshMaterial* material,
|
||||
StapipBag* bag, MeshFrame* frameFrom,
|
||||
void StaticPipeline::addVertices(DynamicMesh* mesh, MeshMaterial* material,
|
||||
StaPipBag* bag, MeshFrame* frameFrom,
|
||||
MeshFrame* frameTo) const {
|
||||
bag->count = material->getFacesCount();
|
||||
bag->vertices = new Vec4[bag->count];
|
||||
@@ -83,10 +83,10 @@ void Stapipeline::addVertices(DynamicMesh* mesh, MeshMaterial* material,
|
||||
}
|
||||
}
|
||||
|
||||
StapipInfoBag* Stapipeline::getInfoBag(DynamicMesh* mesh,
|
||||
const StapipOptions* options,
|
||||
StaPipInfoBag* StaticPipeline::getInfoBag(DynamicMesh* mesh,
|
||||
const StaPipOptions* options,
|
||||
M4x4* model) const {
|
||||
auto* result = new StapipInfoBag();
|
||||
auto* result = new StaPipInfoBag();
|
||||
|
||||
if (options) {
|
||||
result->antiAliasingEnabled = options->antiAliasingEnabled;
|
||||
@@ -96,7 +96,7 @@ StapipInfoBag* Stapipeline::getInfoBag(DynamicMesh* mesh,
|
||||
} else {
|
||||
result->antiAliasingEnabled = false;
|
||||
result->blendingEnabled = true;
|
||||
result->shadingType = StapipShadingFlat;
|
||||
result->shadingType = StaPipShadingFlat;
|
||||
result->noClipChecks = true;
|
||||
}
|
||||
|
||||
@@ -105,11 +105,11 @@ StapipInfoBag* Stapipeline::getInfoBag(DynamicMesh* mesh,
|
||||
return result;
|
||||
}
|
||||
|
||||
StapipColorBag* Stapipeline::getColorBag(DynamicMesh* mesh,
|
||||
StaPipColorBag* StaticPipeline::getColorBag(DynamicMesh* mesh,
|
||||
MeshMaterial* material,
|
||||
MeshFrame* frameFrom,
|
||||
MeshFrame* frameTo) const {
|
||||
auto* result = new StapipColorBag();
|
||||
auto* result = new StaPipColorBag();
|
||||
|
||||
if (material->isSingleColorActivated()) {
|
||||
result->single = &material->singleColor;
|
||||
@@ -133,13 +133,13 @@ StapipColorBag* Stapipeline::getColorBag(DynamicMesh* mesh,
|
||||
return result;
|
||||
}
|
||||
|
||||
StapipTextureBag* Stapipeline::getTextureBag(DynamicMesh* mesh,
|
||||
StaPipTextureBag* StaticPipeline::getTextureBag(DynamicMesh* mesh,
|
||||
MeshMaterial* material,
|
||||
MeshFrame* frameFrom,
|
||||
MeshFrame* frameTo) {
|
||||
if (!material->getTextureCoordFaces()) return nullptr;
|
||||
|
||||
auto* result = new StapipTextureBag();
|
||||
auto* result = new StaPipTextureBag();
|
||||
|
||||
result->texture =
|
||||
rendererCore->texture.repository.getBySpriteOrMesh(material->getId());
|
||||
@@ -163,15 +163,15 @@ StapipTextureBag* Stapipeline::getTextureBag(DynamicMesh* mesh,
|
||||
return result;
|
||||
}
|
||||
|
||||
StapipLightingBag* Stapipeline::getLightingBag(
|
||||
StaPipLightingBag* StaticPipeline::getLightingBag(
|
||||
DynamicMesh* mesh, MeshMaterial* material, M4x4* model,
|
||||
MeshFrame* frameFrom, MeshFrame* frameTo,
|
||||
const StapipOptions* options) const {
|
||||
const StaPipOptions* options) const {
|
||||
if (!material->getNormalFaces() || options == nullptr ||
|
||||
options->lighting == nullptr)
|
||||
return nullptr;
|
||||
|
||||
auto* result = new StapipLightingBag(true);
|
||||
auto* result = new StaPipLightingBag(true);
|
||||
result->lightMatrix = model;
|
||||
|
||||
result->setLightsManually(colorsCache,
|
||||
@@ -193,8 +193,8 @@ StapipLightingBag* Stapipeline::getLightingBag(
|
||||
return result;
|
||||
}
|
||||
|
||||
void Stapipeline::setLightingColorsCache(
|
||||
StapipLightingOptions* lightingOptions) {
|
||||
void StaticPipeline::setLightingColorsCache(
|
||||
StaPipLightingOptions* lightingOptions) {
|
||||
for (int i = 0; i < 3; i++) {
|
||||
colorsCache[i] =
|
||||
reinterpret_cast<Vec4&>(lightingOptions->directionalColors[i]);
|
||||
@@ -202,7 +202,7 @@ void Stapipeline::setLightingColorsCache(
|
||||
colorsCache[3] = reinterpret_cast<Vec4&>(*lightingOptions->ambientColor);
|
||||
}
|
||||
|
||||
void Stapipeline::deallocDrawBags(StapipBag* bag,
|
||||
void StaticPipeline::deallocDrawBags(StaPipBag* bag,
|
||||
MeshMaterial* material) const {
|
||||
if (bag->color->many) {
|
||||
delete[] bag->color->many;
|
||||
|
||||
@@ -39,8 +39,8 @@ class H4570 : public Game {
|
||||
Vec4 cameraPosition, cameraLookAt;
|
||||
|
||||
MinecraftPipeline mcPip;
|
||||
Stapipeline stapip;
|
||||
StapipOptions* renderOptions;
|
||||
StaticPipeline stapip;
|
||||
StaPipOptions* renderOptions;
|
||||
Texture* blocksTex;
|
||||
|
||||
u32 blocksCount;
|
||||
|
||||
@@ -18,7 +18,7 @@ H4570::H4570(Engine* t_engine) { engine = t_engine; }
|
||||
H4570::~H4570() {}
|
||||
|
||||
DynamicMesh* getWarrior(Renderer* renderer);
|
||||
StapipOptions* getRenderingOptions();
|
||||
StaPipOptions* getRenderingOptions();
|
||||
Sprite* get2DPicture(Renderer* renderer);
|
||||
|
||||
void H4570::init() {
|
||||
@@ -179,8 +179,8 @@ Sprite* get2DPicture(Renderer* renderer) {
|
||||
return sprite;
|
||||
}
|
||||
|
||||
StapipOptions* getRenderingOptions() {
|
||||
auto* options = new StapipOptions();
|
||||
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 @@ StapipOptions* getRenderingOptions() {
|
||||
for (int i = 0; i < 3; i++)
|
||||
directionalDirections[i].set(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
auto* lightingOptions = new StapipLightingOptions(); // Memory leak!
|
||||
auto* lightingOptions = new StaPipLightingOptions(); // Memory leak!
|
||||
lightingOptions->ambientColor = ambientColor;
|
||||
lightingOptions->directionalColors = directionalColors;
|
||||
lightingOptions->directionalDirections = directionalDirections;
|
||||
|
||||
options->shadingType = Tyra::StapipShadingGouraud;
|
||||
options->shadingType = Tyra::StaPipShadingGouraud;
|
||||
options->blendingEnabled = true;
|
||||
options->antiAliasingEnabled = false;
|
||||
options->lighting = lightingOptions;
|
||||
|
||||
@@ -36,8 +36,8 @@ class Wellinator : public Game {
|
||||
Vec4 cameraPosition, cameraLookAt;
|
||||
|
||||
MinecraftPipeline mcPip;
|
||||
Stapipeline stapip;
|
||||
StapipOptions* renderOptions;
|
||||
StaticPipeline stapip;
|
||||
StaPipOptions* renderOptions;
|
||||
Texture* blocksTex;
|
||||
|
||||
u32 blocksCount;
|
||||
|
||||
@@ -18,7 +18,7 @@ Wellinator::Wellinator(Engine* t_engine) { engine = t_engine; }
|
||||
Wellinator::~Wellinator() {}
|
||||
|
||||
DynamicMesh* getWarrior(Renderer* renderer);
|
||||
StapipOptions* getRenderingOptions();
|
||||
StaPipOptions* getRenderingOptions();
|
||||
Sprite* get2DPicture(Renderer* renderer);
|
||||
|
||||
void Wellinator::init() {
|
||||
@@ -150,8 +150,8 @@ Sprite* get2DPicture(Renderer* renderer) {
|
||||
return sprite;
|
||||
}
|
||||
|
||||
StapipOptions* getRenderingOptions() {
|
||||
auto* options = new StapipOptions();
|
||||
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 @@ StapipOptions* getRenderingOptions() {
|
||||
for (int i = 0; i < 3; i++)
|
||||
directionalDirections[i].set(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
auto* lightingOptions = new StapipLightingOptions(); // Memory leak!
|
||||
auto* lightingOptions = new StaPipLightingOptions(); // Memory leak!
|
||||
lightingOptions->ambientColor = ambientColor;
|
||||
lightingOptions->directionalColors = directionalColors;
|
||||
lightingOptions->directionalDirections = directionalDirections;
|
||||
|
||||
options->shadingType = Tyra::StapipShadingGouraud;
|
||||
options->shadingType = Tyra::StaPipShadingGouraud;
|
||||
options->blendingEnabled = true;
|
||||
options->antiAliasingEnabled = false;
|
||||
options->lighting = lightingOptions;
|
||||
|
||||
Reference in New Issue
Block a user