mirror of
https://github.com/ZDoom/Raze.git
synced 2025-01-19 07:01:09 +00:00
- use SectionGeometry for 3D rendering.
This commit is contained in:
parent
d8a3035bcc
commit
7a9596ae81
3 changed files with 22 additions and 43 deletions
|
@ -597,7 +597,7 @@ void BunchDrawer::ProcessSection(int sectionnum, bool portal)
|
||||||
|
|
||||||
SetupFlat.Clock();
|
SetupFlat.Clock();
|
||||||
HWFlat flat;
|
HWFlat flat;
|
||||||
flat.ProcessSector(di, §or[sectnum], nullptr, sectionnum);
|
flat.ProcessSector(di, §or[sectnum], sectionnum);
|
||||||
SetupFlat.Unclock();
|
SetupFlat.Unclock();
|
||||||
|
|
||||||
//Todo: process subsectors
|
//Todo: process subsectors
|
||||||
|
|
|
@ -253,8 +253,7 @@ public:
|
||||||
class HWFlat
|
class HWFlat
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
int oldsection;
|
int section;
|
||||||
Section* section;
|
|
||||||
sectortype * sec;
|
sectortype * sec;
|
||||||
tspritetype* Sprite; // for flat sprites.
|
tspritetype* Sprite; // for flat sprites.
|
||||||
FGameTexture *texture;
|
FGameTexture *texture;
|
||||||
|
@ -281,7 +280,7 @@ public:
|
||||||
//void SetupLights(HWDrawInfo *di, FLightNode *head, FDynLightData &lightdata, int portalgroup);
|
//void SetupLights(HWDrawInfo *di, FLightNode *head, FDynLightData &lightdata, int portalgroup);
|
||||||
|
|
||||||
void PutFlat(HWDrawInfo* di, int whichplane);
|
void PutFlat(HWDrawInfo* di, int whichplane);
|
||||||
void ProcessSector(HWDrawInfo *di, sectortype * frontsector, Section* sectionp, int sectionnum, int which = 7 /*SSRF_RENDERALL*/); // cannot use constant due to circular dependencies.
|
void ProcessSector(HWDrawInfo *di, sectortype * frontsector, int sectionnum, int which = 7 /*SSRF_RENDERALL*/); // cannot use constant due to circular dependencies.
|
||||||
void ProcessFlatSprite(HWDrawInfo* di, tspritetype* sprite, sectortype* sector);
|
void ProcessFlatSprite(HWDrawInfo* di, tspritetype* sprite, sectortype* sector);
|
||||||
|
|
||||||
void DrawSubsectors(HWDrawInfo *di, FRenderState &state);
|
void DrawSubsectors(HWDrawInfo *di, FRenderState &state);
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
#include "hw_drawstructs.h"
|
#include "hw_drawstructs.h"
|
||||||
#include "hw_renderstate.h"
|
#include "hw_renderstate.h"
|
||||||
#include "sectorgeometry.h"
|
#include "sectorgeometry.h"
|
||||||
|
#include "hw_sections2.h"
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
CVAR(Int, gl_breaksec, -1, 0)
|
CVAR(Int, gl_breaksec, -1, 0)
|
||||||
|
@ -97,11 +98,9 @@ void HWFlat::MakeVertices()
|
||||||
if (vertcount > 0) return;
|
if (vertcount > 0) return;
|
||||||
bool canvas = texture->isHardwareCanvas();
|
bool canvas = texture->isHardwareCanvas();
|
||||||
if (Sprite == nullptr)
|
if (Sprite == nullptr)
|
||||||
{
|
|
||||||
if (section != nullptr)
|
|
||||||
{
|
{
|
||||||
TArray<int>* pIndices;
|
TArray<int>* pIndices;
|
||||||
auto mesh = sectionGeometry.get(section, plane, geoofs, &pIndices);
|
auto mesh = sectionGeometry.get(sections2[section], plane, geoofs, &pIndices);
|
||||||
|
|
||||||
auto ret = screen->mVertexData->AllocVertices(pIndices->Size());
|
auto ret = screen->mVertexData->AllocVertices(pIndices->Size());
|
||||||
auto vp = ret.first;
|
auto vp = ret.first;
|
||||||
|
@ -119,25 +118,6 @@ void HWFlat::MakeVertices()
|
||||||
vertcount = pIndices->Size();
|
vertcount = pIndices->Size();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
auto mesh = sectorGeometry.get(oldsection, plane, geoofs);
|
|
||||||
if (!mesh) return;
|
|
||||||
auto ret = screen->mVertexData->AllocVertices(mesh->vertices.Size());
|
|
||||||
auto vp = ret.first;
|
|
||||||
float base = (plane == 0 ? sec->floorz : sec->ceilingz) * (1 / -256.f);
|
|
||||||
for (unsigned i = 0; i < mesh->vertices.Size(); i++)
|
|
||||||
{
|
|
||||||
auto& pt = mesh->vertices[i];
|
|
||||||
auto& uv = mesh->texcoords[i];
|
|
||||||
vp->SetVertex(pt.X, base + pt.Z, pt.Y);
|
|
||||||
vp->SetTexCoord(uv.X, canvas ? 1.f - uv.Y : uv.Y);
|
|
||||||
vp++;
|
|
||||||
}
|
|
||||||
vertindex = ret.second;
|
|
||||||
vertcount = mesh->vertices.Size();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
vec2_t pos[4];
|
vec2_t pos[4];
|
||||||
GetFlatSpritePosition(Sprite, Sprite->pos.vec2, pos, true);
|
GetFlatSpritePosition(Sprite, Sprite->pos.vec2, pos, true);
|
||||||
|
@ -181,7 +161,8 @@ void HWFlat::DrawFlat(HWDrawInfo *di, FRenderState &state, bool translucent)
|
||||||
|
|
||||||
if (!Sprite)
|
if (!Sprite)
|
||||||
{
|
{
|
||||||
auto mesh = sectorGeometry.get(oldsection, plane, geoofs);
|
TArray<int> *indices;
|
||||||
|
auto mesh = sectionGeometry.get(sections2[section], plane, geoofs, &indices);
|
||||||
state.SetNormal(mesh->normal);
|
state.SetNormal(mesh->normal);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -261,7 +242,7 @@ void HWFlat::PutFlat(HWDrawInfo *di, int whichplane)
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
void HWFlat::ProcessSector(HWDrawInfo *di, sectortype * frontsector, Section* sectionp, int section_, int which)
|
void HWFlat::ProcessSector(HWDrawInfo *di, sectortype * frontsector, int section_, int which)
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
if (sectnum(sec) == gl_breaksec)
|
if (sectnum(sec) == gl_breaksec)
|
||||||
|
@ -279,8 +260,7 @@ void HWFlat::ProcessSector(HWDrawInfo *di, sectortype * frontsector, Section* se
|
||||||
|
|
||||||
visibility = sectorVisibility(frontsector);
|
visibility = sectorVisibility(frontsector);
|
||||||
sec = frontsector;
|
sec = frontsector;
|
||||||
oldsection = section_;
|
section = section_;
|
||||||
section = sectionp;
|
|
||||||
Sprite = nullptr;
|
Sprite = nullptr;
|
||||||
geoofs = di->geoofs;
|
geoofs = di->geoofs;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue