Newer
Older
gGL.vertex3f(center.mV[VX] - width ,center.mV[VY] - width,center.mV[VZ] + width);
gGL.vertex3f(center.mV[VX] - width ,center.mV[VY] - width,center.mV[VZ] - width);
gGL.vertex3f(center.mV[VX] + width ,center.mV[VY] - width,center.mV[VZ] + width);
gGL.vertex3f(center.mV[VX] + width ,center.mV[VY] - width,center.mV[VZ] - width);
}
void LLViewerObjectList::renderObjectBeacons()
{
if (mDebugBeacons.empty())
{
return;
}
S32 i;
//const LLFontGL *font = gResMgr->getRes(LLFONT_SANSSERIF);
LLGLSUIDefault gls_ui;
S32 last_line_width = -1;
{
LLGLSNoTexture gls_ui_no_texture;
gGL.begin(GL_LINES);
for (i = 0; i < mDebugBeacons.count(); i++)
{
const LLDebugBeacon &debug_beacon = mDebugBeacons[i];
LLColor4 color = debug_beacon.mColor;
color.mV[3] *= 0.25f;
S32 line_width = debug_beacon.mLineWidth;
if (line_width != last_line_width)
{
gGL.end();
gGL.flush();
glLineWidth( (F32)line_width );
last_line_width = line_width;
gGL.begin(GL_LINES);
}
const LLVector3 &thisline = debug_beacon.mPositionAgent;
gGL.color4fv(color.mV);
gGL.vertex3f(thisline.mV[VX],thisline.mV[VY],thisline.mV[VZ] - 50.f);
gGL.vertex3f(thisline.mV[VX],thisline.mV[VY],thisline.mV[VZ] + 50.f);
gGL.vertex3f(thisline.mV[VX] - 2.f,thisline.mV[VY],thisline.mV[VZ]);
gGL.vertex3f(thisline.mV[VX] + 2.f,thisline.mV[VY],thisline.mV[VZ]);
gGL.vertex3f(thisline.mV[VX],thisline.mV[VY] - 2.f,thisline.mV[VZ]);
gGL.vertex3f(thisline.mV[VX],thisline.mV[VY] + 2.f,thisline.mV[VZ]);
gGL.end();
}
{
LLGLSNoTexture gls_ui_no_texture;
LLGLDepthTest gls_depth(GL_TRUE);
gGL.begin(GL_LINES);
last_line_width = -1;
for (i = 0; i < mDebugBeacons.count(); i++)
{
const LLDebugBeacon &debug_beacon = mDebugBeacons[i];
S32 line_width = debug_beacon.mLineWidth;
if (line_width != last_line_width)
{
gGL.end();
gGL.flush();
glLineWidth( (F32)line_width );
last_line_width = line_width;
gGL.begin(GL_LINES);
}
const LLVector3 &thisline = debug_beacon.mPositionAgent;
gGL.color4fv(debug_beacon.mColor.mV);
gGL.vertex3f(thisline.mV[VX],thisline.mV[VY],thisline.mV[VZ] - 0.5f);
gGL.vertex3f(thisline.mV[VX],thisline.mV[VY],thisline.mV[VZ] + 0.5f);
gGL.vertex3f(thisline.mV[VX] - 0.5f,thisline.mV[VY],thisline.mV[VZ]);
gGL.vertex3f(thisline.mV[VX] + 0.5f,thisline.mV[VY],thisline.mV[VZ]);
gGL.vertex3f(thisline.mV[VX],thisline.mV[VY] - 0.5f,thisline.mV[VZ]);
gGL.vertex3f(thisline.mV[VX],thisline.mV[VY] + 0.5f,thisline.mV[VZ]);
gGL.end();
gGL.flush();
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
glLineWidth(1.f);
for (i = 0; i < mDebugBeacons.count(); i++)
{
LLDebugBeacon &debug_beacon = mDebugBeacons[i];
if (debug_beacon.mString == "")
{
continue;
}
LLHUDText *hud_textp = (LLHUDText *)LLHUDObject::addHUDObject(LLHUDObject::LL_HUD_TEXT);
hud_textp->setZCompare(FALSE);
LLColor4 color;
color = debug_beacon.mTextColor;
color.mV[3] *= 1.f;
hud_textp->setString(utf8str_to_wstring(debug_beacon.mString.c_str()));
hud_textp->setColor(color);
hud_textp->setPositionAgent(debug_beacon.mPositionAgent);
debug_beacon.mHUDObject = hud_textp;
}
}
}
void pre_show_depth_buffer()
{
glClear(GL_STENCIL_BUFFER_BIT);
glEnable(GL_STENCIL_TEST);
glStencilFunc(GL_ALWAYS,0,0);
glStencilOp(GL_INCR,GL_INCR,GL_INCR);
}
void post_show_depth_buffer()
{
int xsize =500, ysize =500;
U8 *buf = new U8[xsize*ysize];
glReadPixels(0,0,xsize,ysize,GL_STENCIL_INDEX,GL_UNSIGNED_BYTE, buf);
int total = 0;
int i;
for (i=0;i<xsize*ysize;i++)
{
total += buf[i];
buf[i] <<= 3;
}
float DC = (float)total/(float)(ysize*xsize);
int DCline = llfloor((xsize-20) * DC / 10.0f);
int stride = xsize / 10;
int y = 2;
for (i=0;i<DCline;i++)
{
if (i % stride == 0) i+=2;
if (i > xsize) y=6;
buf[ysize*(y+0)+i]=255;
buf[ysize*(y+1)+i]=255;
buf[ysize*(y+2)+i]=255;
}
glDrawPixels(xsize,ysize,GL_RED,GL_UNSIGNED_BYTE,buf);
Don Kjer
committed
delete [] buf;