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