// //--------------------------------------------------------------------------- // // Copyright(C) 2005-2016 Christoph Oelckers // All rights reserved. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License // along with this program. If not, see http://www.gnu.org/licenses/ // //-------------------------------------------------------------------------- // #ifndef _HW__VERTEXBUFFER_H #define _HW__VERTEXBUFFER_H #include "tarray.h" struct FFlatVertex { float x, z, y; // world position float u, v; // texture coordinates void SetFlatVertex(vertex_t *vt, const secplane_t &plane); void Set(float xx, float zz, float yy, float uu, float vv) { x = xx; z = zz; y = yy; u = uu; v = vv; } }; class FFlatVertexGenerator { protected: TArray vbo_shadowdata; void CheckPlanes(sector_t *sector); public: enum { QUAD_INDEX = 0, FULLSCREEN_INDEX = 4, PRESENT_INDEX = 8, STENCILTOP_INDEX = 12, STENCILBOTTOM_INDEX = 16, NUM_RESERVED = 20 }; FFlatVertexGenerator(int width, int height); void OutputResized(int width, int height); private: int CreateSubsectorVertices(subsector_t *sub, const secplane_t &plane, int floor); int CreateSectorVertices(sector_t *sec, const secplane_t &plane, int floor); int CreateVertices(int h, sector_t *sec, const secplane_t &plane, int floor); void CreateFlatVertices(); void UpdatePlaneVertices(sector_t *sec, int plane, FFlatVertex *map); protected: void CreateVertices(); void CheckPlanes(sector_t *sector, FFlatVertex *map); void CheckUpdate(sector_t *sector, FFlatVertex *map); }; #endif