本文整理汇总了C++中Vector4::b方法的典型用法代码示例。如果您正苦于以下问题:C++ Vector4::b方法的具体用法?C++ Vector4::b怎么用?C++ Vector4::b使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vector4
的用法示例。
在下文中一共展示了Vector4::b方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: vec
void Vector4Test::access() {
Vector4 vec(1.0f, -2.0f, 5.0f, 0.5f);
CORRADE_COMPARE(vec.x(), 1.0f);
CORRADE_COMPARE(vec.r(), 1.0f);
CORRADE_COMPARE(vec.y(), -2.0f);
CORRADE_COMPARE(vec.g(), -2.0f);
CORRADE_COMPARE(vec.z(), 5.0f);
CORRADE_COMPARE(vec.b(), 5.0f);
CORRADE_COMPARE(vec.w(), 0.5f);
CORRADE_COMPARE(vec.a(), 0.5f);
constexpr Vector4 cvec(1.0f, -2.0f, 5.0f, 0.5f);
constexpr Float x = cvec.x();
constexpr Float r = cvec.r();
constexpr Float y = cvec.y();
constexpr Float g = cvec.g();
constexpr Float z = cvec.z();
constexpr Float b = cvec.b();
constexpr Float w = cvec.w();
constexpr Float a = cvec.a();
CORRADE_COMPARE(x, 1.0f);
CORRADE_COMPARE(r, 1.0f);
CORRADE_COMPARE(y, -2.0f);
CORRADE_COMPARE(g, -2.0f);
CORRADE_COMPARE(z, 5.0f);
CORRADE_COMPARE(b, 5.0f);
CORRADE_COMPARE(w, 0.5f);
CORRADE_COMPARE(a, 0.5f);
}
示例2: draw3DBackToFront
void draw3DBackToFront() {
glEnable(GL_BLEND);
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glBegin(GL_POINTS);
for(int c = 0; c < WIDTH; c++) {
for(int r = 0; r < HEIGHT; r++) {
//
Vector3 voxelLocation = rotationMatrix * Vector3(c, r, 0) + startingPosition + (directionVector * 256);
for (int i = 0; i < 256; i++) {
if (withinBounds(head->GetWidth(), head->GetHeight(), 256, voxelLocation) ) {
unsigned char val = head->Get((int)voxelLocation.r(), (int)voxelLocation.g(), (int)voxelLocation.b()*(100.0/256.0));
double normalisedVal = val/255.0;
if (normalisedVal > 0.3) {
Vector4 color = manualColoursAndOpacities(normalisedVal);
glColor4f(color.r(), color.g(), color.b(), color.a());
glVertex3f(c, r,0);
}
}
voxelLocation -= directionVector;
}
}
}
glEnd();
glFlush();
glutSwapBuffers();
}
示例3: manualDraw
void manualDraw() {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glBegin(GL_POINTS);
for (int x = 0; x < head->GetWidth() ; x++) {
for(int y = 0; y < head->GetHeight(); y++) {
//for(int z = 0; z < head->GetDepth(); z++) {
for(int z = head->GetDepth(); z > 0; z--) {
//for(int y = head->GetHeight(); y > 0; y--) {
//for(int x = head->GetWidth(); x > 0; x--) {
unsigned char val = head->Get(x, y, z);
double normalisedVal = val/255.0;
if (normalisedVal > 0.3) {
Vector4 color = manualColoursAndOpacities(normalisedVal);
glColor4f(color.r(), color.g(), color.b(), color.a());
glVertex3f(x, y,0);
}
}
}
}
glEnd();
glFlush();
glutSwapBuffers();
}
示例4: draw3DFrontToBack
void draw3DFrontToBack() {
glEnable(GL_BLEND);
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glBegin(GL_POINTS);
for(int c = 0; c < WIDTH; c++) {
for(int r = 0; r < HEIGHT; r++) {
double currentA = 0;
Vector3 currentI = Vector3(0,0,0);
Vector3 voxelLocation = rotationMatrix * Vector3(c, r, 0) + startingPosition;
for (int i = 0; i < 256; i++) {
if (withinBounds(head->GetWidth(), head->GetHeight(), 256, voxelLocation) ) {
double val = trilinearInterpolate(voxelLocation.r(), voxelLocation.g(), voxelLocation.b()*(100.0/256.0));
double normalisedVal = val/255.0;
if (normalisedVal > 0.2) {
Vector4 color = manualColoursAndOpacities(normalisedVal);
Vector3 justColor = Vector3(color.r(), color.g(), color.b());
currentI = currentI + justColor*color.a()*(1-currentA);
currentA = color.a() + currentA*(1-color.a());
if (currentA > 0.95) {
break;
}
}
}
voxelLocation += directionVector;
}
glColor4f(currentI.r(), currentI.g(), currentI.b(), currentA);
glVertex3f(c, r,0);
}
}
glEnd();
glFlush();
glutSwapBuffers();
}