mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-15 22:09:19 -07:00
461077b1a1
New right-click popup menu in game list - allow editing patch files easily. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@31 8ced0084-cf51-0410-be5f-012b33b47a6e
86 lines
2.5 KiB
C++
86 lines
2.5 KiB
C++
#ifndef _DECODED_VARRAY_H
|
|
#define _DECODED_VARRAY_H
|
|
|
|
#include "Vec3.h"
|
|
#include "Common.h"
|
|
|
|
typedef Vec3 DecPos;
|
|
typedef Vec3 DecNormal;
|
|
|
|
struct DecUV
|
|
{
|
|
float u,v;
|
|
};
|
|
|
|
typedef u32 DecColor;
|
|
typedef u8 DecMtxInd;
|
|
|
|
int ComputeVertexSize(u32 components);
|
|
|
|
//TODO(ector): Change the internal implementation to pack it tight according to components
|
|
// The tight packing will be fed directly to the gfx card in the mystic future.
|
|
class DecodedVArray
|
|
{
|
|
int size;
|
|
u32 components;
|
|
int vertexSize;
|
|
|
|
public:
|
|
int count;
|
|
DecodedVArray();
|
|
~DecodedVArray();
|
|
void SetComponents(u32 comps) {components = comps; vertexSize = ComputeVertexSize(components);}
|
|
u32 GetComponents() const {return components;}
|
|
void Create(int _size, int pmcount, int tmcount, int nrmcount, int colcount, int tccount);
|
|
void Zero();
|
|
void Destroy();
|
|
void Reset() {count=0;}
|
|
int GetSize() {return size;}
|
|
int GetCount() {return count;}
|
|
void Next() {count++;}
|
|
void SetPosNrmIdx(int i) {posMtxInds[count] = i;}
|
|
void SetTcIdx(int n, int i) {texMtxInds[n][count] = i;}
|
|
void SetPosX(float x) {positions[count].x=x;}
|
|
void SetPosY(float y) {positions[count].y=y;}
|
|
void SetPosZ(float z) {positions[count].z=z;}
|
|
|
|
void SetNormalX(int n,float x) {normals[n][count].x=x;}
|
|
void SetNormalY(int n,float y) {normals[n][count].y=y;}
|
|
void SetNormalZ(int n,float z) {normals[n][count].z=z;}
|
|
void SetU(int n, float u) {uvs[n][count].u = u;}
|
|
void SetV(int n, float v) {uvs[n][count].v = v;}
|
|
void SetPosition(float x, float y, float z) {
|
|
positions[count].x=x;
|
|
positions[count].y=y;
|
|
positions[count].z=z;
|
|
}
|
|
void SetNormal(int n, float x, float y, float z) {
|
|
normals[n][count].x=x;
|
|
normals[n][count].y=y;
|
|
normals[n][count].z=z;
|
|
}
|
|
void SetColor(int n, u32 c)
|
|
{
|
|
colors[n][count] = c;
|
|
}
|
|
void SetUV(int n, float u, float v) {
|
|
uvs[n][count].u=u;
|
|
uvs[n][count].v=v;
|
|
}
|
|
const DecPos &GetPos(int n) const { return positions[n]; }
|
|
const DecNormal &GetNormal(int i, int n) const { return normals[i][n]; }
|
|
const DecColor &GetColor(int i, int n) const { return colors[i][n]; }
|
|
const DecUV &GetUV(int i, int n) const { return uvs[i][n]; }
|
|
const DecMtxInd &GetPosMtxInd(int n) const { return posMtxInds[n]; }
|
|
const DecMtxInd &GetTexMtxInd(int i, int n) const { return texMtxInds[i][n]; }
|
|
//private:
|
|
DecPos *positions;
|
|
DecNormal *normals[3];
|
|
DecColor *colors[2];
|
|
DecUV *uvs[8];
|
|
DecMtxInd *posMtxInds;
|
|
DecMtxInd *texMtxInds[8];
|
|
};
|
|
|
|
#endif
|