ScaleM() 方法更改 OpenGL ES 2.0/3.0 中的着色器效果

ScaleM() method changes the shader effects in OpenGL ES 2.0/3.0

我使用 ScaleM(modelMatrix, offset, x, y, z) 方法增加了对象的大小:

...
protected val projectionMatrix = FloatArray(16)
protected val modelMatrix = FloatArray(16)
protected val modelViewMatrix = FloatArray(16)
protected val mvpMatrix = FloatArray(16)
...
Matrix.setIdentityM(modelMatrix, 0)

Matrix.translateM(modelMatrix, 0, 1.0f, 0.0f, 100.0f)
Matrix.rotateM(modelMatrix, 0, angle, 0.0f, 0.5f, 0.0f)
Matrix.scaleM(modelMatrix, 0, 15f, 15f, 15f) // enlarge object
Matrix.multiplyMM(modelViewMatrix, 0, viewMatrix, 0, modelMatrix, 0)
Matrix.multiplyMM(mvpMatrix, 0, projectionMatrix, 0, modelViewMatrix, 0)
...

物体增加了,但这影响了它的显示(在我的例子中,照明增加了,虹彩减少了)。有没有一种简单的方法可以避免这种情况,或者我是否需要为它重新配置着色器和输入参数?

提前致谢!

也许有更好的选择,但我找到了以下解决方案:

private val modelViewMatrixForShader = FloatArray(16)
...
Matrix.translateM(modelMatrix, 0, 0.0f, 0.0f, -100.0f)
Matrix.rotateM(modelMatrix, 0, angle, 0.0f, 0.5f, 0.0f)
Matrix.multiplyMM(modelViewMatrixForShader, 0, viewMatrix, 0, modelMatrix, 0) 
Matrix.scaleM(modelMatrix, 0, 15f, 15f, 15f) 
Matrix.multiplyMM(modelViewMatrix, 0, viewMatrix, 0, modelMatrix, 0)
Matrix.multiplyMM(mvpMatrix, 0, projectionMatrix, 0, modelViewMatrix, 0)
... 
fun getMVMatrixAsFloatBuffer(): FloatBuffer = floatBuffer(modelViewMatrixForShader)
...
GLES20.glUniformMatrix4fv(mvMatrixLink, 1, false,
        view.getMVMatrixAsFloatBuffer());