本文整理汇总了Java中com.ra4king.opengl.util.math.Matrix4.mult方法的典型用法代码示例。如果您正苦于以下问题:Java Matrix4.mult方法的具体用法?Java Matrix4.mult怎么用?Java Matrix4.mult使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.ra4king.opengl.util.math.Matrix4
的用法示例。
在下文中一共展示了Matrix4.mult方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: calcMatrix
import com.ra4king.opengl.util.math.Matrix4; //导入方法依赖的package包/类
@Override
@CopyStruct
public Matrix4 calcMatrix() {
Matrix4 mat = new Matrix4().clearToIdentity();
mat.translate(0, 0, -currView.radius);
Quaternion fullRotation = Utils.angleAxisDeg(currView.degSpinRotation, new Vector3(0, 0, 1)).mult(currView.orient);
mat.mult(fullRotation.toMatrix(new Matrix4()));
mat.translate(new Vector3(currView.targetPos).mult(-1));
return mat;
}
示例2: buildLights
import com.ra4king.opengl.util.math.Matrix4; //导入方法依赖的package包/类
private void buildLights(Matrix4 cameraMatrix) {
LightBlock lightData = new LightBlock(new Vector4(0.2f, 0.2f, 0.2f, 1), 1f / 900f, 2);
lightData.lights[0] = new PerLight(cameraMatrix.mult(new Vector4(-0.2f, 0.5f, 0.5f, 0).normalize()), new Vector4(0.2f, 0.2f, 0.2f, 1));
lightData.lights[1] = new PerLight(cameraMatrix.mult(new Vector4(5, 6, 0.5f, 1)), new Vector4(3.5f, 6.5f, 3, 1).mult(0.5f));
if(showOtherLights)
lightNumBinder.setValue(2);
else
lightNumBinder.setValue(0);
glBindBuffer(GL_UNIFORM_BUFFER, lightUniformBuffer);
glBufferData(GL_UNIFORM_BUFFER, lightData.toBuffer(), GL_STREAM_DRAW);
glBindBuffer(GL_UNIFORM_BUFFER, 0);
}
示例3: buildLights
import com.ra4king.opengl.util.math.Matrix4; //导入方法依赖的package包/类
private void buildLights(Matrix4 cameraMatrix) {
LightBlock lightData = new LightBlock(new Vector4(0.2f, 0.2f, 0.2f, 1), 1f / 25f, 3);
lightData.lights[0] = new PerLight(cameraMatrix.mult(new Vector4(-0.2f, 0.5f, 0.5f, 0).normalize()), new Vector4(2, 2, 2.5f, 1));
lightData.lights[1] = new PerLight(cameraMatrix.mult(new Vector4(5, 6, 0.5f, 1)), new Vector4(3.5f, 6.5f, 3, 1).mult(1.2f));
lightNumBinder.setValue(2);
glBindBuffer(GL_UNIFORM_BUFFER, lightUniformBuffer);
glBufferData(GL_UNIFORM_BUFFER, lightData.toBuffer(), GL_STREAM_DRAW);
glBindBuffer(GL_UNIFORM_BUFFER, 0);
}
示例4: getLightBlock
import com.ra4king.opengl.util.math.Matrix4; //导入方法依赖的package包/类
public LightBlock getLightBlock(Matrix4 worldToCamera) {
LightBlock lightData = new LightBlock(ambientInterpolator.interpolate(sunTimer.getAlpha()), lightAttenuation, maxIntensityInterpolator.interpolate(sunTimer.getAlpha()));
lightData.lights[0] = new PerLight(worldToCamera.mult(getSunlightDirection()), sunlightInterpolator.interpolate(sunTimer.getAlpha()));
for(int light = 0; light < lightPos.size(); light++)
lightData.lights[light + 1] = new PerLight(worldToCamera.mult(new Vector4(getPointLightWorldPos(light), 1)), lightIntensity.get(light).copy());
return lightData;
}
示例5: getLightInformation
import com.ra4king.opengl.util.math.Matrix4; //导入方法依赖的package包/类
public LightBlock getLightInformation(Matrix4 worldToCameraMatrix) {
LightBlock lightData = new LightBlock(ambientInterpolator.interpolate(sunTimer.getAlpha()), lightAttenuation);
lightData.lights[0] = new PerLight(worldToCameraMatrix.mult(getSunlightDirection()), sunlightInterpolator.interpolate(sunTimer.getAlpha()));
for(int light = 0; light < NUMBER_OF_POINT_LIGHTS; light++) {
Vector4 worldLightPos = new Vector4(lightPos.get(light).interpolate(lightTimers.get(light).getAlpha()), 1);
Vector4 lightPosCameraSpace = worldToCameraMatrix.mult(worldLightPos);
lightData.lights[light + 1] = new PerLight(lightPosCameraSpace, lightIntensity.get(light));
}
return lightData;
}
示例6: getLightInformationHDR
import com.ra4king.opengl.util.math.Matrix4; //导入方法依赖的package包/类
public LightBlockHDR getLightInformationHDR(Matrix4 worldToCameraMatrix) {
LightBlockHDR lightData = new LightBlockHDR(ambientInterpolator.interpolate(sunTimer.getAlpha()), lightAttenuation, maxIntensityInterpolator.interpolate(sunTimer.getAlpha()));
lightData.lights[0] = new PerLight(worldToCameraMatrix.mult(getSunlightDirection()), sunlightInterpolator.interpolate(sunTimer.getAlpha()));
for(int light = 0; light < NUMBER_OF_POINT_LIGHTS; light++) {
Vector4 worldLightPos = new Vector4(lightPos.get(light).interpolate(lightTimers.get(light).getAlpha()), 1);
Vector4 lightPosCameraSpace = worldToCameraMatrix.mult(worldLightPos);
lightData.lights[light + 1] = new PerLight(lightPosCameraSpace, lightIntensity.get(light));
}
return lightData;
}
示例7: render
import com.ra4king.opengl.util.math.Matrix4; //导入方法依赖的package包/类
@Override
public void render() {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
MatrixStack modelMatrix = new MatrixStack();
modelMatrix.setTop(viewPole.calcMatrix());
buildLights(modelMatrix.getTop());
nodes.get(0).setOrient(Utils.angleAxisDeg(360 * timer.getAlpha(), new Vector3(0, 1, 0)));
nodes.get(3).setOrient(spinBarOrient.copy().mult(Utils.angleAxisDeg(360 * timer.getAlpha(), new Vector3(0, 0, 1))));
Vector2 displaySize = new Vector2(getWidth() / 2, getHeight());
{
glBindBuffer(GL_UNIFORM_BUFFER, projectionUniformBuffer);
glBufferData(GL_UNIFORM_BUFFER, new Matrix4().clearToPerspectiveDeg(60, displaySize.x(), displaySize.y(), 1, 1000).toBuffer(), GL_STREAM_DRAW);
glBindBuffer(GL_UNIFORM_BUFFER, 0);
}
glViewport(0, 0, (int)displaySize.x(), (int)displaySize.y());
scene.render(modelMatrix.getTop());
if(drawCameraPos) {
modelMatrix.pushMatrix();
modelMatrix.getTop().clearToIdentity();
modelMatrix.getTop().translate(new Vector3(0, 0, -viewPole.getView().radius));
modelMatrix.getTop().scale(0.5f);
glDisable(GL_DEPTH_TEST);
glDepthMask(false);
unlit.begin();
glUniformMatrix4(unlitModelToCameraMatrixUniform, false, modelMatrix.getTop().toBuffer());
glUniform4f(unlitObjectColorUniform, 0.25f, 0.25f, 0.25f, 1);
sphereMesh.render("flat");
glDepthMask(true);
glEnable(GL_DEPTH_TEST);
glUniform4f(unlitObjectColorUniform, 1, 1, 1, 1);
sphereMesh.render("flat");
unlit.end();
modelMatrix.popMatrix();
}
{
Matrix4 persMatrix = new Matrix4().clearToIdentity().set(new Matrix3(persViewPole.calcMatrix()));
persMatrix.mult(new Matrix4().clearToPerspectiveDeg(60, displaySize.x(), displaySize.y(), 1, 1000));
glBindBuffer(GL_UNIFORM_BUFFER, projectionUniformBuffer);
glBufferData(GL_UNIFORM_BUFFER, persMatrix.toBuffer(), GL_STREAM_DRAW);
glBindBuffer(GL_UNIFORM_BUFFER, 0);
}
if(!depthClampProj)
glDisable(GL_DEPTH_CLAMP);
glViewport((int)(displaySize.x() + (getWidth() % 2)), 0, (int)displaySize.x(), (int)displaySize.y());
scene.render(modelMatrix.getTop());
glEnable(GL_DEPTH_CLAMP);
}
示例8: render
import com.ra4king.opengl.util.math.Matrix4; //导入方法依赖的package包/类
@Override
public void render() {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
MatrixStack modelMatrix = new MatrixStack();
modelMatrix.setTop(viewPole.calcMatrix());
Matrix4 worldToCamMatrix = modelMatrix.getTop();
LightBlock lightData = new LightBlock(new Vector4(0.2f, 0.2f, 0.2f, 1), lightAttenuation);
lightData.lights[0] = new PerLight(worldToCamMatrix.mult(new Vector4(0.707f, 0.707f, 0, 0)), new Vector4(0.6f, 0.6f, 0.6f, 1));
lightData.lights[1] = new PerLight(worldToCamMatrix.mult(calcLightPosition()), new Vector4(0.4f, 0.4f, 0.4f, 1));
glBindBuffer(GL_UNIFORM_BUFFER, lightUniformBuffer);
glBufferSubData(GL_UNIFORM_BUFFER, 0, lightData.toBuffer());
glBindBuffer(GL_UNIFORM_BUFFER, 0);
{
glBindBufferRange(GL_UNIFORM_BUFFER, materialBlockIndex, materialUniformBuffer, MaterialNames.TERRAIN.ordinal() * materialBlockOffset, MaterialBlock.SIZE);
litMeshProgram.program.begin();
glUniformMatrix4(litMeshProgram.modelToCameraMatrixUniform, false, modelMatrix.getTop().toBuffer());
glUniformMatrix3(litMeshProgram.normalModelToCameraMatrixUniform, false, new Matrix3(modelMatrix.getTop()).inverse().transpose().toBuffer());
planeMesh.render();
litMeshProgram.program.end();
glBindBufferBase(GL_UNIFORM_BUFFER, materialBlockIndex, 0);
}
drawSphere(modelMatrix, new Vector3(0, 10, 0), 4, MaterialNames.BLUE_SHINY, drawImpostor[0]);
drawSphereOrbit(modelMatrix, new Vector3(0, 10, 0), new Vector3(0.6f, 0.8f, 0), 20, sphereTimer.getAlpha(), 2, MaterialNames.DULL_GREY, drawImpostor[1]);
drawSphereOrbit(modelMatrix, new Vector3(-10, 1, 0), new Vector3(0, 1, 0), 10, sphereTimer.getAlpha(), 1, MaterialNames.BLACK_SHINY, drawImpostor[2]);
drawSphereOrbit(modelMatrix, new Vector3(10, 1, 0), new Vector3(0, 1, 0), 10, sphereTimer.getAlpha() * 2, 1, MaterialNames.GOLD_METAL, drawImpostor[3]);
if(drawLights) {
modelMatrix.pushMatrix();
modelMatrix.getTop().translate(new Vector3(calcLightPosition()));
modelMatrix.getTop().scale(0.5f);
unlit.program.begin();
glUniformMatrix4(unlit.modelToCameraMatrixUniform, false, modelMatrix.getTop().toBuffer());
glUniform4(unlit.objectColorUniform, new Vector4(1).toBuffer());
cubeMesh.render("flat");
unlit.program.end();
modelMatrix.popMatrix();
}
if(drawCameraPos) {
modelMatrix.pushMatrix();
modelMatrix.getTop().clearToIdentity();
modelMatrix.getTop().translate(0, 0, -viewPole.getView().radius);
unlit.program.begin();
glDisable(GL_DEPTH_TEST);
glDepthMask(false);
glUniformMatrix4(unlit.modelToCameraMatrixUniform, false, modelMatrix.getTop().toBuffer());
glUniform4f(unlit.objectColorUniform, 0.25f, 0.25f, 0.25f, 1);
cubeMesh.render("flat");
glDepthMask(true);
glEnable(GL_DEPTH_TEST);
glUniform4f(unlit.objectColorUniform, 1, 1, 1, 1);
cubeMesh.render("flat");
unlit.program.end();
}
}
示例9: calcMatrix
import com.ra4king.opengl.util.math.Matrix4; //导入方法依赖的package包/类
public Matrix4 calcMatrix() {
Matrix4 translateMat = new Matrix4().clearToIdentity();
translateMat.putColumn(3, po.position, 1);
return translateMat.mult(po.orientation.toMatrix());
}