From 325dca9f212f9fd44cd10a8180529970c7a08c72 Mon Sep 17 00:00:00 2001 From: Nguyễn Gia Phong Date: Mon, 21 Jun 2021 18:11:55 +0700 Subject: Remove trailing whitespaces and duplicated blank lines --- src/Decals.cpp | 42 ++++++++++++++++++++---------------------- 1 file changed, 20 insertions(+), 22 deletions(-) (limited to 'src/Decals.cpp') diff --git a/src/Decals.cpp b/src/Decals.cpp index 3cebb4c..7617420 100644 --- a/src/Decals.cpp +++ b/src/Decals.cpp @@ -26,21 +26,20 @@ int Decals::MakeDecal(int atype, XYZ location, float size, XYZ normal, int poly, XYZ nothing; XYZ axis[3]; XYZ temp; - + nothing=0; - + axis[0].x=1; axis[1].y=1; axis[2].z=1; - + normalv[0]=abs(normal.x); normalv[1]=abs(normal.y); normalv[2]=abs(normal.z); - - + if(normalv[1]>normalv[major])major=1; if(normalv[2]>normalv[major])major=2; - + if (normalv[0] == 1 || normalv[1] == 1 || normalv[2] == 1) { if ((major == 0 && normal.x > 0) || major == 1){ @@ -55,11 +54,11 @@ int Decals::MakeDecal(int atype, XYZ location, float size, XYZ normal, int poly, } else CrossProduct(axis[major], normal, &right); - + CrossProduct(normal, right, &up); - Normalise(&up); + Normalise(&up); Normalise(&right); - + float count; float count2; float countinc=1/size; @@ -67,7 +66,7 @@ int Decals::MakeDecal(int atype, XYZ location, float size, XYZ normal, int poly, if(countinc>.2)countinc=.2; float normaloffset=.02; int good; - + numpoints[howmanydecals]=0; points[howmanydecals*8+numpoints[howmanydecals]] = location + (nothing - right - up) * (size/3) /*+ normal/100*/; texcoordsx[howmanydecals*8+numpoints[howmanydecals]] = 0; @@ -113,7 +112,7 @@ int Decals::MakeDecal(int atype, XYZ location, float size, XYZ normal, int poly, if(good!=-1)numpoints[howmanydecals]++; } } - + points[howmanydecals*8+numpoints[howmanydecals]] = location + (nothing + right - up) * (size/3) /*+ normal/100*/; texcoordsx[howmanydecals*8+numpoints[howmanydecals]] = 1; texcoordsy[howmanydecals*8+numpoints[howmanydecals]] = 0; @@ -158,7 +157,7 @@ int Decals::MakeDecal(int atype, XYZ location, float size, XYZ normal, int poly, if(good!=-1)numpoints[howmanydecals]++; } } - + points[howmanydecals*8+numpoints[howmanydecals]] = location + (nothing + right + up) * (size/3) /*+ normal/100*/; texcoordsx[howmanydecals*8+numpoints[howmanydecals]] = 1; texcoordsy[howmanydecals*8+numpoints[howmanydecals]] = 1; @@ -203,7 +202,7 @@ int Decals::MakeDecal(int atype, XYZ location, float size, XYZ normal, int poly, if(good!=-1)numpoints[howmanydecals]++; } } - + points[howmanydecals*8+numpoints[howmanydecals]] = location + (nothing - right + up) * (size/3) /*+ normal/100*/; texcoordsx[howmanydecals*8+numpoints[howmanydecals]] = 0; texcoordsy[howmanydecals*8+numpoints[howmanydecals]] = 1; @@ -251,7 +250,7 @@ int Decals::MakeDecal(int atype, XYZ location, float size, XYZ normal, int poly, for(int i=0;i0){howmanydecals--;} } - + return 0; } @@ -302,9 +301,9 @@ void Decals::DoStuff() void Decals::draw() { glAlphaFunc(GL_GREATER, 0.01); - + float bloodpoolspeed=1; - + glDepthFunc(GL_LEQUAL); glEnable(GL_BLEND); glEnable(GL_CULL_FACE); @@ -320,7 +319,7 @@ void Decals::draw() if(type[i]==bullethole)glBindTexture(GL_TEXTURE_2D, bulletholetextureptr); if(type[i]==crater)glBindTexture(GL_TEXTURE_2D, cratertextureptr); if(type[i]!=bloodpool)glColor4f(1,1,1,10-alivetime[i]); - + if(type[i]==bloodpool&&alivetime[i]=bloodpoolspeed*.2&&alivetime[i]=bloodpoolspeed*.4&&alivetime[i]=bloodpoolspeed*2.0)glBindTexture(GL_TEXTURE_2D, bloodtextureptr[10]); if(type[i]==bloodpool&&alivetime[i]=bloodpoolspeed*2.0)glColor4f(1,1,1,20-alivetime[i]); - + glPushMatrix(); glBegin(GL_TRIANGLE_FAN); for(int j=0;j=bloodpoolspeed*.2&&alivetime[i]=bloodpoolspeed*1.6&&alivetime[i]=bloodpoolspeed*1.8&&alivetime[i]