git-svn-id: svn://db.shs.com.ru/libs@61 a8b55f48-bf90-11e4-a774-851b48703e85

This commit is contained in:
2015-12-04 14:34:44 +00:00
parent 822e1518ce
commit 576e28354b
3 changed files with 18 additions and 3 deletions

View File

@@ -222,6 +222,19 @@ void GLVBO::clear() {
}
void GLVBO::translatePoints(const QVector3D & dp) {
if (vertices_.isEmpty()) return;
int vcnt = vertices_.size() / 3;
for (int i = 0; i < vcnt; ++i) {
int vi = i * 3;
vertices_[vi + 0] += dp.x();
vertices_[vi + 1] += dp.y();
vertices_[vi + 2] += dp.z();
}
rebuffer();
}
bool GLVBO::saveToFile(const QString & filename) {
if (filename.isEmpty()) return false;
QFile f(filename);

View File

@@ -46,6 +46,8 @@ public:
QVector<GLfloat> & texcoords() {changed = true; return texcoords_;}
QVector<GLfloat> & colors() {changed = true; return colors_;}
void translatePoints(const QVector3D & dp);
bool saveToFile(const QString & filename);
bool loadFromFile(const QString & filename);

View File

@@ -129,9 +129,9 @@ void main(void) {
sh_pow = 1. / max((1. - v1.w), 0.0001);
sh_mul = max(1. - v1.w, 0.0001);
//for (int i = 0; i < 8; ++i)
// calcLight(i, n, v, v2);
calcLight(0, n, v, v2);
for (int i = 0; i < 8; ++i)
calcLight(i, n, v, v2);
// calcLight(0, n, v, v2);
qgl_FragData[0].rgb = li * dc + si * v2.rgb + v3.rgb + texelFetch(t_pp, tc, 0).rgb;
//qgl_FragData[0].rgb = li + vec3(texelFetch(t_pp, tc, 0).xyz);