mirror of
https://github.com/ZDoom/Raze.git
synced 2025-05-29 16:31:43 +00:00
- updated backend from GZDoom.
This commit is contained in:
parent
88eea8269a
commit
5728241c1c
107 changed files with 5548 additions and 778 deletions
43
source/common/rendering/i_modelvertexbuffer.h
Normal file
43
source/common/rendering/i_modelvertexbuffer.h
Normal file
|
@ -0,0 +1,43 @@
|
|||
#pragma once
|
||||
|
||||
#include "templates.h"
|
||||
|
||||
struct FModelVertex
|
||||
{
|
||||
float x, y, z; // world position
|
||||
float u, v; // texture coordinates
|
||||
unsigned packedNormal; // normal vector as GL_INT_2_10_10_10_REV.
|
||||
|
||||
void Set(float xx, float yy, float zz, float uu, float vv)
|
||||
{
|
||||
x = xx;
|
||||
y = yy;
|
||||
z = zz;
|
||||
u = uu;
|
||||
v = vv;
|
||||
}
|
||||
|
||||
void SetNormal(float nx, float ny, float nz)
|
||||
{
|
||||
int inx = clamp(int(nx * 512), -512, 511);
|
||||
int iny = clamp(int(ny * 512), -512, 511);
|
||||
int inz = clamp(int(nz * 512), -512, 511);
|
||||
int inw = 0;
|
||||
packedNormal = (inw << 30) | ((inz & 1023) << 20) | ((iny & 1023) << 10) | (inx & 1023);
|
||||
}
|
||||
};
|
||||
|
||||
#define VMO ((FModelVertex*)nullptr)
|
||||
|
||||
class IModelVertexBuffer
|
||||
{
|
||||
public:
|
||||
virtual ~IModelVertexBuffer() { }
|
||||
|
||||
virtual FModelVertex *LockVertexBuffer(unsigned int size) = 0;
|
||||
virtual void UnlockVertexBuffer() = 0;
|
||||
|
||||
virtual unsigned int *LockIndexBuffer(unsigned int size) = 0;
|
||||
virtual void UnlockIndexBuffer() = 0;
|
||||
};
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue