| 1 |
From: Morten Kjeldgaard <[email protected]> |
| 2 |
Subject: modification to source code |
| 3 |
|
| 4 |
|
| 5 |
--- a/src/Common.cpp |
| 6 |
+++ b/src/Common.cpp |
| 7 |
@@ -136,8 +136,8 @@ |
| 8 |
Byte* GetSnapshot(int sx, int sy, bool alpha){ |
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
+ //static uint textureSnap = 666; |
| 14 |
+ //static uint frameSnap; |
| 15 |
|
| 16 |
// set offline rendering |
| 17 |
mainCanvas.RedirectToMemory(); |
| 18 |
@@ -448,7 +448,7 @@ |
| 19 |
); |
| 20 |
|
| 21 |
glBegin(GL_QUADS); |
| 22 |
|
| 23 |
+ for (int i=0; i < (int)atom.size(); i++) atom[i].DrawHalo(); |
| 24 |
glEnd(); |
| 25 |
|
| 26 |
/* |
| 27 |
@@ -496,7 +496,7 @@ |
| 28 |
|
| 29 |
shadowSettings.BindShaders(); |
| 30 |
glBegin(GL_QUADS); |
| 31 |
|
| 32 |
+ for (int i=0; i < (int)atom.size(); i++) atom[i].DrawShadowmap(); |
| 33 |
glEnd(); |
| 34 |
|
| 35 |
if (sticks) { |
| 36 |
@@ -507,7 +507,7 @@ |
| 37 |
|
| 38 |
|
| 39 |
glBegin(GL_QUADS); |
| 40 |
|
| 41 |
+ for (int i=0; i < (int)bond.size(); i++) bond[i].DrawShadowmap(); |
| 42 |
glEnd(); |
| 43 |
} |
| 44 |
glPopMatrix(); |
| 45 |
@@ -559,7 +559,7 @@ |
| 46 |
if (draw_balls) { |
| 47 |
if (draw_wireframe_balls) { |
| 48 |
glDisable(GL_FRAGMENT_PROGRAM_ARB); |
| 49 |
|
| 50 |
+ for (int i=0; i < (int)atom.size(); i++) { |
| 51 |
glColor3f(0,0,1); |
| 52 |
glBegin(GL_LINE_LOOP); |
| 53 |
atom[i].Draw(); |
| 54 |
@@ -571,7 +571,7 @@ |
| 55 |
//if (DL_atoms==666) glGenD |
| 56 |
|
| 57 |
glBegin(GL_QUADS); |
| 58 |
|
| 59 |
+ for (int i=0; i < (int)atom.size(); i++) atom[i].Draw(); |
| 60 |
glEnd(); |
| 61 |
|
| 62 |
glDisable(GL_VERTEX_PROGRAM_ARB); |
| 63 |
@@ -604,7 +604,7 @@ |
| 64 |
glColor3f(1,1,1); |
| 65 |
if (draw_wireframe_sticks) { |
| 66 |
glDisable(GL_FRAGMENT_PROGRAM_ARB); |
| 67 |
|
| 68 |
+ for (int i=0; i < (int)bond.size(); i++) { |
| 69 |
glColor3f(0,0.6,0.3); |
| 70 |
glBegin(GL_LINE_LOOP); |
| 71 |
bond[i].Draw(); |
| 72 |
@@ -613,7 +613,7 @@ |
| 73 |
} |
| 74 |
else { |
| 75 |
glBegin(GL_QUADS); |
| 76 |
|
| 77 |
+ for (int i=0; i < (int)bond.size(); i++) bond[i].Draw(); |
| 78 |
glEnd(); |
| 79 |
} |
| 80 |
cgSettings.BindShaders(); |
| 81 |
@@ -703,12 +703,12 @@ |
| 82 |
if (!ready) return false; |
| 83 |
if (cgSettings.P_texture==0) return false; |
| 84 |
if (DirV.size()==0) return true; |
| 85 |
|
| 86 |
+ return AOdoneLvl< (int)DirV.size(); |
| 87 |
} |
| 88 |
|
| 89 |
bool Mol::DecentAO(){ |
| 90 |
float k=1; |
| 91 |
|
| 92 |
+ if (AOdoneLvl >= (int)DirV.size()) return true; |
| 93 |
if (atom.size()<10) return (AOdoneLvl>6*k); |
| 94 |
if (atom.size()<100) return (AOdoneLvl>4*k); |
| 95 |
if (atom.size()<1000) return (AOdoneLvl>2*k); |
| 96 |
@@ -751,12 +751,12 @@ |
| 97 |
} |
| 98 |
|
| 99 |
// for testing purposes |
| 100 |
|
| 101 |
+void Mol::PrepareAOSingleView(){ |
| 102 |
static int i=0; |
| 103 |
PrepareAOstart(); |
| 104 |
AOgpu2::Bind(); |
| 105 |
AOgpu2 ao(DirV[i], *this, 4 ); |
| 106 |
|
| 107 |
+ i++; if (i > (int)DirV.size()) i=0; |
| 108 |
AOgpu2::UnBind(); |
| 109 |
AOdoneLvl=DirV.size(); |
| 110 |
} |
| 111 |
@@ -772,7 +772,7 @@ |
| 112 |
|
| 113 |
|
| 114 |
AOdoneLvl++; |
| 115 |
|
| 116 |
+ return (AOdoneLvl >= (int)DirV.size()) ; |
| 117 |
} |
| 118 |
|
| 119 |
void Mol::PrepareAOallAtOnce(){ |
| 120 |
@@ -786,12 +786,12 @@ |
| 121 |
//refresh(); |
| 122 |
|
| 123 |
FILE *f = fopen("res.txt", "w"); |
| 124 |
|
| 125 |
+ long int w=TakeTime(f, (char *)"sampled"); |
| 126 |
|
| 127 |
|
| 128 |
|
| 129 |
|
| 130 |
|
| 131 |
+ fprintf(f," %d views done in %ld msec (%.2f views x sec), with %d atoms & %d sticks.\n", |
| 132 |
+ (int)DirV.size(), w, |
| 133 |
+ (int)DirV.size()*1000.0/w, (int)this->atom.size(), |
| 134 |
+ (int)(this->sticks?(this->bond.size()):0) ); |
| 135 |
fclose(f); |
| 136 |
|
| 137 |
AOready=true; |
| 138 |
@@ -822,7 +822,7 @@ |
| 139 |
tb.GetView(); |
| 140 |
tb.Apply(false); |
| 141 |
|
| 142 |
|
| 143 |
+ //float pos[4]={0.0f,0.0f,-1.0f,0.0f}; |
| 144 |
float d[16]; |
| 145 |
glGetFloatv(GL_MODELVIEW_MATRIX,d); |
| 146 |
glPopMatrix(); |