本文整理汇总了C++中vec3f::x方法的典型用法代码示例。如果您正苦于以下问题:C++ vec3f::x方法的具体用法?C++ vec3f::x怎么用?C++ vec3f::x使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vec3f
的用法示例。
在下文中一共展示了vec3f::x方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Overlap
bool BBox::Overlap( const vec3f& p ) const
{
bool x = (pMax.x() >= p.x()) && (pMin.x() <= p.x());
bool y = (pMax.y() >= p.y()) && (pMin.y() <= p.y());
bool z = (pMax.z() >= p.z()) && (pMin.z() <= p.z());
return (x && y && z);
}
示例2: DrawQuad
void GLVBO::DrawQuad( int type, const vec3f &p1, const vec3f &p2, const vec3f &p3, const vec3f &p4)
{
GLfloat verts[] = {
p1.x(), p1.y(), p1.z(),
p2.x(), p2.y(), p2.z(),
p3.x(), p3.y(), p3.z(),
p4.x(), p4.y(), p4.z()
};
glVertexPointer(3, GL_FLOAT, 0, verts);
glEnableClientState(GL_VERTEX_ARRAY);
glDrawArrays(type, 0, 4);
glDisableClientState(GL_VERTEX_ARRAY);
}
示例3: texture2D
color texture2D(vec3f coords, texture t){
int x = coords.x() * t.width;
int y = t.height-(coords.y() * t.height);
if(t.bytesperpixel == 4){
return t.data[y*t.height + x];
}
uint8_t* data = (uint8_t*)t.data;
int col= (int)(data[t.bytesperpixel*(y*t.height + x)]);
return gammaCorrect((color){static_cast<uint8_t>(col>>24),static_cast<uint8_t>((col>>16) &255),static_cast<uint8_t>((col>>8)&255),255});
示例4: clamp
void clamp(vec3f & v, float min, float max)
{
if(v.peekx() > max) v.x() = max;
if(v.peekx() < min) v.x() = min;
if(v.peeky() > max) v.y() = max;
if(v.peeky() < min) v.y() = min;
if(v.peekz() > max) v.z() = max;
if(v.peekz() < min) v.z() = min;
}
示例5: clamp
void clamp(vec3f & v, float vmin, float vmax)
{
if(v.peekx() > vmax) v.x() = vmax;
if(v.peekx() < vmin) v.x() = vmin;
if(v.peeky() > vmax) v.y() = vmax;
if(v.peeky() < vmin) v.y() = vmin;
if(v.peekz() > vmax) v.z() = vmax;
if(v.peekz() < vmin) v.z() = vmin;
}
示例6: baryCentricTriangle
bool baryCentricTriangle(vec2f p, vec3f v1, vec3f v2, vec3f v3, float &u, float &v, float &r)
{
float x1mx3 = v1.x() - v3.x();
float x2mx3 = v2.x() - v3.x();
float y1my3 = v1.y() - v3.y();
float y2my3 = v2.y() - v3.y();
float det = (x1mx3 * y2my3) - (y1my3*x2mx3);
float pxmx3 = p.x() - v3.x();
float pymy3 = p.y() - v3.y();
if(det == 0.0 || det == -0.0) return false;
u = (y2my3*pxmx3 + x2mx3*-1*pymy3)/det;
v = (y1my3*-1*pxmx3 + x1mx3*pymy3)/det;
r = 1-u-v;
if (u > 1.0f || v > 1.0f || r > 1.0f) return false;
if (u < 0.0f || v < 0.0f || r < 0.0f) return false;
return true;
}
示例7: coordsToMapPos
vec2f Grid::coordsToMapPos(vec3f coords) {
GLfloat width = d_cellWidth * d_rows;
GLfloat height = d_cellHeight * d_cols;
GLfloat x = floor(coords.x() / width);
GLfloat y = floor(coords.z() / height);
// Clamp the values into the bounds
if (x > d_rows) {
x = d_rows;
} else if (x < 0) {
x = 0;
}
if (y > d_cols) {
y = d_cols;
} else if (y < 0) {
y = 0;
}
return vec2f(x, y);
}
示例8: setUniform
void Shader::setUniform(const std::string &name, const vec3f v, bool warn) {
glUniform3f(uniform(name, warn), v.x(), v.y(), v.z());
}
示例9:
vec3i::vec3i( const vec3f &v )
{
m_x = (int)v.x();
m_y = (int)v.y();
m_z = (int)v.z();
}
示例10: Inside
bool BBox::Inside( const vec3f& pt) const
{
return (pt.x() >= pMin.x() && pt.x() <= pMax.x() &&
pt.y() >= pMin.y() && pt.y() <= pMax.y() &&
pt.z() >= pMin.z() && pt.z() <= pMax.z());
}