use of gaiasky.scenegraph.camera.FovCamera in project gaiasky by langurmonkey.
the class SGRFov method render.
@Override
public void render(SceneGraphRenderer sgr, ICamera camera, double t, int rw, int rh, int tw, int th, FrameBuffer fb, PostProcessBean ppb) {
boolean postProcess = postProcessCapture(ppb, fb, tw, th);
// Viewport
extendViewport.setCamera(camera.getCamera());
extendViewport.setWorldSize(rw, rh);
extendViewport.setScreenSize(rw * rw / tw, rh * rh / th);
extendViewport.apply();
/* FIELD OF VIEW CAMERA - we only render the star group process */
FovCamera cam = ((CameraManager) camera).fovCamera;
int fovMode = camera.getMode().getGaiaFovMode();
if (fovMode == 1 || fovMode == 3) {
cam.dirIndex = 0;
sgr.renderScene(camera, t, rc);
}
if (fovMode == 2 || fovMode == 3) {
cam.dirIndex = 1;
sgr.renderScene(camera, t, rc);
}
// GLFW reports a window size of 0x0 with AMD Graphics on Windows when minimizing
if (rw > 0 && rh > 0) {
sendOrientationUpdate(camera.getCamera(), rw, rh);
postProcessRender(ppb, fb, postProcess, camera, rw, rh);
}
}
use of gaiasky.scenegraph.camera.FovCamera in project gaiasky by langurmonkey.
the class CelestialBody method render.
/**
* Label rendering.
*/
@Override
public void render(ExtSpriteBatch batch, ExtShaderProgram shader, FontRenderSystem sys, RenderingContext rc, ICamera camera) {
if (camera.getCurrent() instanceof FovCamera) {
render2DLabel(batch, shader, rc, sys.font2d, camera, text(), pos.put(D31.get()));
} else {
// 3D distance font
Vector3d pos = D31.get();
textPosition(camera, pos);
shader.setUniformf("u_viewAngle", forceLabel ? 2f : (float) viewAngleApparent);
shader.setUniformf("u_viewAnglePow", forceLabel ? 1f : getViewAnglePow());
shader.setUniformf("u_thOverFactor", forceLabel ? 1f : getThOverFactor(camera));
shader.setUniformf("u_thOverFactorScl", forceLabel ? 1f : getThOverFactorScl());
render3DLabel(batch, shader, sys.fontDistanceField, camera, rc, text(), pos, distToCamera, textScale() * camera.getFovFactor(), textSize() * camera.getFovFactor(), this.forceLabel);
}
}
use of gaiasky.scenegraph.camera.FovCamera in project gaiasky by langurmonkey.
the class StarGroup method render.
/**
* Label rendering
*/
@Override
public void render(ExtSpriteBatch batch, ExtShaderProgram shader, FontRenderSystem sys, RenderingContext rc, ICamera camera) {
float thOverFactor = (float) (Settings.settings.scene.star.threshold.point / Settings.settings.scene.label.number / camera.getFovFactor());
Vector3d starPosition = D31.get();
int n = Math.min(pointData.size(), Settings.settings.scene.star.group.numLabel);
if (camera.getCurrent() instanceof FovCamera) {
for (int i = 0; i < n; i++) {
IParticleRecord star = pointData.get(active[i]);
starPosition = fetchPosition(star, cPosD, starPosition, currDeltaYears);
double distToCamera = starPosition.len();
float radius = (float) getRadius(active[i]);
float viewAngle = (float) (((radius / distToCamera) / camera.getFovFactor()) * Settings.settings.scene.star.brightness * 6f);
if (camera.isVisible(viewAngle, starPosition, distToCamera)) {
render2DLabel(batch, shader, rc, sys.font2d, camera, star.names()[0], starPosition);
}
}
} else {
for (int i = 0; i < n; i++) {
int idx = active[i];
renderStarLabel(idx, starPosition, thOverFactor, batch, shader, sys, rc, camera);
}
for (Integer i : forceLabelStars) {
renderStarLabel(i, starPosition, thOverFactor, batch, shader, sys, rc, camera);
}
}
}
Aggregations