Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate vtxarray with its related functions #225

Draft
wants to merge 33 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
dec13b4
move updatevabbs to vtxarray
no-lex Oct 12, 2021
d6c9103
change renderva find*shadowvas() to work on single objs
no-lex Oct 13, 2021
80f2d94
move find*shadowvas functions into vtxarray
no-lex Oct 13, 2021
6185409
make findvisiblevas<> a vtxarray method
no-lex Oct 14, 2021
320c9cb
move finddecals into vtxarray object
no-lex Oct 14, 2021
41ddf9b
move addvisibleva to vtxarray object
no-lex Oct 14, 2021
60ba375
move renderva into vtxarray
no-lex Oct 18, 2021
66936da
move renderstate constructor back to renderva
no-lex Oct 18, 2021
7ef701e
move findshadowvas() into vtxarray
no-lex Oct 19, 2021
1c9ceee
move vadist() into vtxarray
no-lex Oct 19, 2021
d59e8f9
move calcgeombb into vtxarray
no-lex Oct 20, 2021
24665fa
move bbinsideva into vtxarray
no-lex Oct 20, 2021
724a8fe
move mergetexs to vtxarray
no-lex Oct 20, 2021
b02aafe
move renderzpass into vtxarray
no-lex Oct 20, 2021
c212aee
move changevbuf() and changevbuf() to vtxarray
no-lex Oct 20, 2021
38a8270
move addshadowva(), drawvatris(), drawvaskytris() to vtxarray
no-lex Oct 20, 2021
4f97007
move calcmatbb to vtxarray
no-lex Oct 20, 2021
1eb927f
remove 'this' from START/ENDVAQUERY
no-lex Oct 22, 2021
5821dc4
move mergedecals() to vtxarray
no-lex Oct 22, 2021
3a78564
move addvbo() to vtxarray
no-lex Oct 25, 2021
7529429
move setupdata from vacollect to vtxarray
no-lex Oct 25, 2021
0e77739
move some vtxarray public vars to be private
no-lex Oct 25, 2021
6b82010
move destroyva to vtxarray
no-lex Oct 26, 2021
97719c2
make decalelems field private
no-lex Oct 26, 2021
718b81c
make vtxarray::addvbo private
no-lex Oct 26, 2021
1a6f9b0
create helper function vavbo inside vtxarray
no-lex Oct 27, 2021
25de428
make decaldata a private member of vtxarray
no-lex Oct 27, 2021
81770c3
move renderquery into vtxarray
no-lex Oct 28, 2021
5067c72
move gengrassquads() to vtxarray
no-lex Oct 28, 2021
44fbeaa
move rendergeom and renderoutline to vtxarray
no-lex Nov 1, 2021
0d72e4c
move findalphavas and renderexplicitsky to vtxarray
no-lex Nov 2, 2021
f2ae50e
fix rebase issues for vtxarray object
no-lex Jan 26, 2022
2220404
re-remove removed renderva engine.h entries
no-lex Jan 26, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 38 additions & 38 deletions src/engine/render/grass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,43 +273,6 @@ namespace //internal functionality not seen by other files
}
}

// generates grass geometry for a given vertex array
void gengrassquads(vtxarray *va)
{
for(int i = 0; i < va->grasstris.length(); i++)
{
grasstri &g = va->grasstris[i];
if(view.isfoggedsphere(g.radius, g.center))
{
continue;
}
float dist = g.center.dist(camera1->o);
if(dist - g.radius > grassdist)
{
continue;
}
Slot &s = *lookupvslot(g.texture, false).slot;
if(!s.grasstex)
{
if(!s.grass)
{
continue;
}
s.grasstex = textureload(s.grass, 2);
}
grassgroup *group = nullptr;
for(int i = 0; i < numgrasswedges; ++i)
{
grasswedge &w = grasswedges[i];
if(w.bound1.dist(g.center) > g.radius || w.bound2.dist(g.center) > g.radius)
{
continue;
}
gengrassquads(group, w, g, s.grasstex);
}
}
}

Shader *grassshader = nullptr;

void cleargrassshaders()
Expand All @@ -333,6 +296,43 @@ namespace //internal functionality not seen by other files
/* externally relevant functions */
///////////////////////////////////

// generates grass geometry for a given vertex array
void vtxarray::gengrassquads()
{
for(int i = 0; i < grasstris.length(); i++)
{
grasstri &g = grasstris[i];
if(view.isfoggedsphere(g.radius, g.center))
{
continue;
}
float dist = g.center.dist(camera1->o);
if(dist - g.radius > grassdist)
{
continue;
}
Slot &s = *lookupvslot(g.texture, false).slot;
if(!s.grasstex)
{
if(!s.grass)
{
continue;
}
s.grasstex = textureload(s.grass, 2);
}
grassgroup *group = nullptr;
for(int i = 0; i < numgrasswedges; ++i)
{
grasswedge &w = grasswedges[i];
if(w.bound1.dist(g.center) > g.radius || w.bound2.dist(g.center) > g.radius)
{
continue;
}
::gengrassquads(group, w, g, s.grasstex); //we want the free function, so need ::
}
}
}

void generategrass()
{
if(!grass || !grassdist)
Expand Down Expand Up @@ -367,7 +367,7 @@ void generategrass()
{
continue;
}
gengrassquads(va);
va->gengrassquads();
}

if(grassgroups.empty())
Expand Down
Loading