Start to standardize on doubles for positions
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good
This commit is contained in:
parent
4e6f9243b6
commit
af1daecdac
@ -1236,6 +1236,7 @@ Fix cache key collision bug
|
|||||||
Fix homogenous flagging on cell managers
|
Fix homogenous flagging on cell managers
|
||||||
Fix more cache key collision cases
|
Fix more cache key collision cases
|
||||||
Store terrain chunk files in dedicated folder
|
Store terrain chunk files in dedicated folder
|
||||||
|
Start to standardize on doubles for positional data
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -193,7 +193,7 @@ public class AudioEngine {
|
|||||||
private void updateListener(){
|
private void updateListener(){
|
||||||
if(Globals.playerCamera != null){
|
if(Globals.playerCamera != null){
|
||||||
//position
|
//position
|
||||||
Vector3f cameraPos = CameraEntityUtils.getCameraCenter(Globals.playerCamera);
|
Vector3d cameraPos = CameraEntityUtils.getCameraCenter(Globals.playerCamera);
|
||||||
listener.setPosition(cameraPos);
|
listener.setPosition(cameraPos);
|
||||||
|
|
||||||
//orientation
|
//orientation
|
||||||
|
|||||||
@ -61,8 +61,8 @@ public class AudioListener {
|
|||||||
* Sets the position of the listener
|
* Sets the position of the listener
|
||||||
* @param position the position
|
* @param position the position
|
||||||
*/
|
*/
|
||||||
protected void setPosition(Vector3f position) {
|
protected void setPosition(Vector3d position) {
|
||||||
alListener3f(AL_POSITION, position.x, position.y, position.z);
|
AL11.alListener3f(AL_POSITION, (float)position.x, (float)position.y, (float)position.z);
|
||||||
Globals.audioEngine.checkError();
|
Globals.audioEngine.checkError();
|
||||||
AL11.alGetListener3f(AL11.AL_POSITION, xB, yB, zB);
|
AL11.alGetListener3f(AL11.AL_POSITION, xB, yB, zB);
|
||||||
Globals.audioEngine.checkError();
|
Globals.audioEngine.checkError();
|
||||||
|
|||||||
@ -11,11 +11,9 @@ import electrosphere.game.data.common.CommonEntityType;
|
|||||||
import electrosphere.util.math.SpatialMathUtils;
|
import electrosphere.util.math.SpatialMathUtils;
|
||||||
|
|
||||||
import org.joml.Matrix4d;
|
import org.joml.Matrix4d;
|
||||||
import org.joml.Matrix4f;
|
|
||||||
import org.joml.Quaterniond;
|
import org.joml.Quaterniond;
|
||||||
import org.joml.Quaternionf;
|
import org.joml.Quaternionf;
|
||||||
import org.joml.Vector3d;
|
import org.joml.Vector3d;
|
||||||
import org.joml.Vector3f;
|
|
||||||
import org.joml.Vector4d;
|
import org.joml.Vector4d;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -24,25 +22,25 @@ import org.joml.Vector4d;
|
|||||||
public class CameraEntityUtils {
|
public class CameraEntityUtils {
|
||||||
|
|
||||||
|
|
||||||
public static Entity spawnBasicCameraEntity(Vector3f center, Vector3f eye){
|
public static Entity spawnBasicCameraEntity(Vector3d center, Vector3d eye){
|
||||||
Entity rVal = EntityCreationUtils.createClientSpatialEntity();
|
Entity rVal = EntityCreationUtils.createClientSpatialEntity();
|
||||||
rVal.putData(EntityDataStrings.DATA_STRING_CAMERA_TYPE, EntityDataStrings.DATA_STRING_CAMERA_TYPE_BASIC);
|
rVal.putData(EntityDataStrings.DATA_STRING_CAMERA_TYPE, EntityDataStrings.DATA_STRING_CAMERA_TYPE_BASIC);
|
||||||
rVal.putData(EntityDataStrings.DATA_STRING_CAMERA_CENTER, center);
|
rVal.putData(EntityDataStrings.DATA_STRING_CAMERA_CENTER, center);
|
||||||
rVal.putData(EntityDataStrings .DATA_STRING_CAMERA_EYE, eye);
|
rVal.putData(EntityDataStrings .DATA_STRING_CAMERA_EYE, eye);
|
||||||
rVal.putData(EntityDataStrings.DATA_STRING_CAMERA_ORBIT_DISTANCE, 2.0f);
|
rVal.putData(EntityDataStrings.DATA_STRING_CAMERA_ORBIT_DISTANCE, 2.0f);
|
||||||
rVal.putData(EntityDataStrings.CAMERA_ORBIT_RADIAL_OFFSET, new Vector3f(0,1,0));
|
rVal.putData(EntityDataStrings.CAMERA_ORBIT_RADIAL_OFFSET, new Vector3d(0,1,0));
|
||||||
rVal.putData(EntityDataStrings.CAMERA_PITCH, 0.0f);
|
rVal.putData(EntityDataStrings.CAMERA_PITCH, 0.0f);
|
||||||
rVal.putData(EntityDataStrings.CAMERA_YAW, 0.0f);
|
rVal.putData(EntityDataStrings.CAMERA_YAW, 0.0f);
|
||||||
return rVal;
|
return rVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Entity spawnEntityTrackingCameraEntity(Vector3f center, Vector3f eye, Entity toTrack){
|
public static Entity spawnEntityTrackingCameraEntity(Vector3d center, Vector3d eye, Entity toTrack){
|
||||||
Entity rVal = EntityCreationUtils.createClientSpatialEntity();
|
Entity rVal = EntityCreationUtils.createClientSpatialEntity();
|
||||||
rVal.putData(EntityDataStrings.DATA_STRING_CAMERA_TYPE, EntityDataStrings.DATA_STRING_CAMERA_TYPE_ORBIT);
|
rVal.putData(EntityDataStrings.DATA_STRING_CAMERA_TYPE, EntityDataStrings.DATA_STRING_CAMERA_TYPE_ORBIT);
|
||||||
rVal.putData(EntityDataStrings.DATA_STRING_CAMERA_CENTER, center);
|
rVal.putData(EntityDataStrings.DATA_STRING_CAMERA_CENTER, center);
|
||||||
rVal.putData(EntityDataStrings.DATA_STRING_CAMERA_EYE, eye);
|
rVal.putData(EntityDataStrings.DATA_STRING_CAMERA_EYE, eye);
|
||||||
rVal.putData(EntityDataStrings.DATA_STRING_CAMERA_ORBIT_DISTANCE, 2.0f);
|
rVal.putData(EntityDataStrings.DATA_STRING_CAMERA_ORBIT_DISTANCE, 2.0f);
|
||||||
rVal.putData(EntityDataStrings.CAMERA_ORBIT_RADIAL_OFFSET, new Vector3f(0,1,0));
|
rVal.putData(EntityDataStrings.CAMERA_ORBIT_RADIAL_OFFSET, new Vector3d(0,1,0));
|
||||||
rVal.putData(EntityDataStrings.CAMERA_PITCH, 0.0f);
|
rVal.putData(EntityDataStrings.CAMERA_PITCH, 0.0f);
|
||||||
rVal.putData(EntityDataStrings.CAMERA_YAW, 0.0f);
|
rVal.putData(EntityDataStrings.CAMERA_YAW, 0.0f);
|
||||||
BehaviorTree entityTrackingTree = new BehaviorTree() {
|
BehaviorTree entityTrackingTree = new BehaviorTree() {
|
||||||
@ -50,7 +48,7 @@ public class CameraEntityUtils {
|
|||||||
public void simulate(float deltaTime) {
|
public void simulate(float deltaTime) {
|
||||||
if(toTrack != null){
|
if(toTrack != null){
|
||||||
Vector3d entityPos = EntityUtils.getPosition(toTrack);
|
Vector3d entityPos = EntityUtils.getPosition(toTrack);
|
||||||
CameraEntityUtils.setCameraCenter(rVal, new Vector3f((float)entityPos.x,(float)entityPos.y,(float)entityPos.z).add(getOrbitalCameraRadialOffset(rVal)));
|
CameraEntityUtils.setCameraCenter(rVal, new Vector3d(entityPos).add(getOrbitalCameraRadialOffset(rVal)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -69,14 +67,14 @@ public class CameraEntityUtils {
|
|||||||
* @return The camera entity
|
* @return The camera entity
|
||||||
*/
|
*/
|
||||||
public static Entity spawnPlayerEntityTrackingCameraEntity(){
|
public static Entity spawnPlayerEntityTrackingCameraEntity(){
|
||||||
Vector3f center = new Vector3f(0,0,0);
|
Vector3d center = new Vector3d(0,0,0);
|
||||||
Vector3f eye = SpatialMathUtils.getOriginVectorf();
|
Vector3d eye = SpatialMathUtils.getOriginVector();
|
||||||
Entity rVal = EntityCreationUtils.createClientSpatialEntity();
|
Entity rVal = EntityCreationUtils.createClientSpatialEntity();
|
||||||
rVal.putData(EntityDataStrings.DATA_STRING_CAMERA_TYPE, EntityDataStrings.DATA_STRING_CAMERA_TYPE_ORBIT);
|
rVal.putData(EntityDataStrings.DATA_STRING_CAMERA_TYPE, EntityDataStrings.DATA_STRING_CAMERA_TYPE_ORBIT);
|
||||||
rVal.putData(EntityDataStrings.DATA_STRING_CAMERA_CENTER, center);
|
rVal.putData(EntityDataStrings.DATA_STRING_CAMERA_CENTER, center);
|
||||||
rVal.putData(EntityDataStrings.DATA_STRING_CAMERA_EYE, eye);
|
rVal.putData(EntityDataStrings.DATA_STRING_CAMERA_EYE, eye);
|
||||||
rVal.putData(EntityDataStrings.DATA_STRING_CAMERA_ORBIT_DISTANCE, 2.0f);
|
rVal.putData(EntityDataStrings.DATA_STRING_CAMERA_ORBIT_DISTANCE, 2.0f);
|
||||||
rVal.putData(EntityDataStrings.CAMERA_ORBIT_RADIAL_OFFSET, new Vector3f(0,1,0));
|
rVal.putData(EntityDataStrings.CAMERA_ORBIT_RADIAL_OFFSET, new Vector3d(0,1,0));
|
||||||
rVal.putData(EntityDataStrings.CAMERA_PITCH, 0.0f);
|
rVal.putData(EntityDataStrings.CAMERA_PITCH, 0.0f);
|
||||||
rVal.putData(EntityDataStrings.CAMERA_YAW, 0.0f);
|
rVal.putData(EntityDataStrings.CAMERA_YAW, 0.0f);
|
||||||
Globals.cameraHandler.setTrackPlayerEntity(true);
|
Globals.cameraHandler.setTrackPlayerEntity(true);
|
||||||
@ -84,7 +82,7 @@ public class CameraEntityUtils {
|
|||||||
if(Globals.playerEntity != null && CommonEntityUtils.getCommonData(Globals.playerEntity) != null){
|
if(Globals.playerEntity != null && CommonEntityUtils.getCommonData(Globals.playerEntity) != null){
|
||||||
CommonEntityType type = CommonEntityUtils.getCommonData(Globals.playerEntity);
|
CommonEntityType type = CommonEntityUtils.getCommonData(Globals.playerEntity);
|
||||||
if(type.getCameraData() != null && type.getCameraData().getThirdPersonCameraOffset() != null){
|
if(type.getCameraData() != null && type.getCameraData().getThirdPersonCameraOffset() != null){
|
||||||
rVal.putData(EntityDataStrings.CAMERA_ORBIT_RADIAL_OFFSET, new Vector3f(
|
rVal.putData(EntityDataStrings.CAMERA_ORBIT_RADIAL_OFFSET, new Vector3d(
|
||||||
(float)type.getCameraData().getThirdPersonCameraOffset().x,
|
(float)type.getCameraData().getThirdPersonCameraOffset().x,
|
||||||
(float)type.getCameraData().getThirdPersonCameraOffset().y,
|
(float)type.getCameraData().getThirdPersonCameraOffset().y,
|
||||||
(float)type.getCameraData().getThirdPersonCameraOffset().z
|
(float)type.getCameraData().getThirdPersonCameraOffset().z
|
||||||
@ -100,13 +98,13 @@ public class CameraEntityUtils {
|
|||||||
* @param eye the eye of the camera
|
* @param eye the eye of the camera
|
||||||
* @return the camera
|
* @return the camera
|
||||||
*/
|
*/
|
||||||
public static Entity spawnPlayerEntityTrackingCameraFirstPersonEntity(Vector3f center, Vector3f eye){
|
public static Entity spawnPlayerEntityTrackingCameraFirstPersonEntity(Vector3d center, Vector3d eye){
|
||||||
Entity rVal = EntityCreationUtils.createClientSpatialEntity();
|
Entity rVal = EntityCreationUtils.createClientSpatialEntity();
|
||||||
rVal.putData(EntityDataStrings.DATA_STRING_CAMERA_TYPE, EntityDataStrings.DATA_STRING_CAMERA_TYPE_ORBIT);
|
rVal.putData(EntityDataStrings.DATA_STRING_CAMERA_TYPE, EntityDataStrings.DATA_STRING_CAMERA_TYPE_ORBIT);
|
||||||
rVal.putData(EntityDataStrings.DATA_STRING_CAMERA_CENTER, center);
|
rVal.putData(EntityDataStrings.DATA_STRING_CAMERA_CENTER, center);
|
||||||
rVal.putData(EntityDataStrings.DATA_STRING_CAMERA_EYE, eye);
|
rVal.putData(EntityDataStrings.DATA_STRING_CAMERA_EYE, eye);
|
||||||
rVal.putData(EntityDataStrings.DATA_STRING_CAMERA_ORBIT_DISTANCE, 0.01f);
|
rVal.putData(EntityDataStrings.DATA_STRING_CAMERA_ORBIT_DISTANCE, 0.01f);
|
||||||
rVal.putData(EntityDataStrings.CAMERA_ORBIT_RADIAL_OFFSET, new Vector3f(0,1.3f,0));
|
rVal.putData(EntityDataStrings.CAMERA_ORBIT_RADIAL_OFFSET, new Vector3d(0,1.3f,0));
|
||||||
rVal.putData(EntityDataStrings.CAMERA_PITCH, 0.0f);
|
rVal.putData(EntityDataStrings.CAMERA_PITCH, 0.0f);
|
||||||
rVal.putData(EntityDataStrings.CAMERA_YAW, 0.0f);
|
rVal.putData(EntityDataStrings.CAMERA_YAW, 0.0f);
|
||||||
Globals.cameraHandler.setTrackPlayerEntity(true);
|
Globals.cameraHandler.setTrackPlayerEntity(true);
|
||||||
@ -125,7 +123,7 @@ public class CameraEntityUtils {
|
|||||||
if(Globals.controlHandler.cameraIsThirdPerson()){
|
if(Globals.controlHandler.cameraIsThirdPerson()){
|
||||||
Globals.playerCamera = CameraEntityUtils.spawnPlayerEntityTrackingCameraEntity();
|
Globals.playerCamera = CameraEntityUtils.spawnPlayerEntityTrackingCameraEntity();
|
||||||
} else {
|
} else {
|
||||||
Globals.playerCamera = CameraEntityUtils.spawnPlayerEntityTrackingCameraFirstPersonEntity(new Vector3f(0,0,0), SpatialMathUtils.getOriginVectorf());
|
Globals.playerCamera = CameraEntityUtils.spawnPlayerEntityTrackingCameraFirstPersonEntity(new Vector3d(0,0,0), SpatialMathUtils.getOriginVector());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,34 +139,34 @@ public class CameraEntityUtils {
|
|||||||
camera.putData(EntityDataStrings.DATA_STRING_CAMERA_ORBIT_DISTANCE, distance);
|
camera.putData(EntityDataStrings.DATA_STRING_CAMERA_ORBIT_DISTANCE, distance);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Vector3f getOrbitalCameraRadialOffset(Entity camera){
|
public static Vector3d getOrbitalCameraRadialOffset(Entity camera){
|
||||||
return (Vector3f)camera.getData(EntityDataStrings.CAMERA_ORBIT_RADIAL_OFFSET);
|
return (Vector3d)camera.getData(EntityDataStrings.CAMERA_ORBIT_RADIAL_OFFSET);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setOrbitalCameraRadialOffset(Entity camera, Vector3f offset){
|
public static void setOrbitalCameraRadialOffset(Entity camera, Vector3d offset){
|
||||||
camera.putData(EntityDataStrings.CAMERA_ORBIT_RADIAL_OFFSET, offset);
|
camera.putData(EntityDataStrings.CAMERA_ORBIT_RADIAL_OFFSET, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setCameraCenter(Entity camera, Vector3f center){
|
public static void setCameraCenter(Entity camera, Vector3d center){
|
||||||
camera.putData(EntityDataStrings.DATA_STRING_CAMERA_CENTER, center);
|
camera.putData(EntityDataStrings.DATA_STRING_CAMERA_CENTER, center);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Vector3f getCameraCenter(Entity camera){
|
public static Vector3d getCameraCenter(Entity camera){
|
||||||
if(camera == null){
|
if(camera == null){
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return (Vector3f)camera.getData(EntityDataStrings.DATA_STRING_CAMERA_CENTER);
|
return (Vector3d)camera.getData(EntityDataStrings.DATA_STRING_CAMERA_CENTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setCameraEye(Entity camera, Vector3f eye){
|
public static void setCameraEye(Entity camera, Vector3d eye){
|
||||||
camera.putData(EntityDataStrings.DATA_STRING_CAMERA_EYE, eye);
|
camera.putData(EntityDataStrings.DATA_STRING_CAMERA_EYE, eye);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Vector3f getCameraEye(Entity camera){
|
public static Vector3d getCameraEye(Entity camera){
|
||||||
if(camera == null){
|
if(camera == null){
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return (Vector3f)camera.getData(EntityDataStrings.DATA_STRING_CAMERA_EYE);
|
return (Vector3d)camera.getData(EntityDataStrings.DATA_STRING_CAMERA_EYE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setCameraPitch(Entity camera, float pitch){
|
public static void setCameraPitch(Entity camera, float pitch){
|
||||||
@ -221,18 +219,18 @@ public class CameraEntityUtils {
|
|||||||
* @param camera The camera
|
* @param camera The camera
|
||||||
* @return The view matrix for the camera
|
* @return The view matrix for the camera
|
||||||
*/
|
*/
|
||||||
public static Matrix4f getCameraViewMatrix(Entity camera){
|
public static Matrix4d getCameraViewMatrix(Entity camera){
|
||||||
Vector3f cameraCenter = new Vector3f(0,0,0);//getViewMatrixCenterOffset(camera);
|
Vector3d cameraCenter = new Vector3d(0,0,0);//getViewMatrixCenterOffset(camera);
|
||||||
Vector3f cameraEye = new Vector3f(cameraCenter).add(getCameraEye(camera));
|
Vector3d cameraEye = new Vector3d(cameraCenter).add(getCameraEye(camera));
|
||||||
Vector3f cameraUp = SpatialMathUtils.getUpVectorf();
|
Vector3d cameraUp = SpatialMathUtils.getUpVector();
|
||||||
//!!before you make the same mistake I made, cameraEye is NOT NECESSARILY normalized/unit vector
|
//!!before you make the same mistake I made, cameraEye is NOT NECESSARILY normalized/unit vector
|
||||||
//the orbital distance and offset are included in this vector
|
//the orbital distance and offset are included in this vector
|
||||||
//TODO: refactor this to some other matrix of transforms or something??
|
//TODO: refactor this to some other matrix of transforms or something??
|
||||||
cameraEye = new Vector3f(getCameraEye(camera));
|
cameraEye = new Vector3d(getCameraEye(camera));
|
||||||
// System.out.println("eye: " + cameraEye);
|
// System.out.println("eye: " + cameraEye);
|
||||||
// System.out.println("center: " + cameraCenter);
|
// System.out.println("center: " + cameraCenter);
|
||||||
// System.out.println("up: " + cameraUp);
|
// System.out.println("up: " + cameraUp);
|
||||||
Matrix4f rVal = new Matrix4f().setLookAt(
|
Matrix4d rVal = new Matrix4d().setLookAt(
|
||||||
cameraEye, //eye
|
cameraEye, //eye
|
||||||
cameraCenter, //center
|
cameraCenter, //center
|
||||||
cameraUp // up
|
cameraUp // up
|
||||||
|
|||||||
@ -14,7 +14,6 @@ import org.joml.Matrix4d;
|
|||||||
import org.joml.Quaterniond;
|
import org.joml.Quaterniond;
|
||||||
import org.joml.Sphered;
|
import org.joml.Sphered;
|
||||||
import org.joml.Vector3d;
|
import org.joml.Vector3d;
|
||||||
import org.joml.Vector3f;
|
|
||||||
import org.joml.Vector3i;
|
import org.joml.Vector3i;
|
||||||
import org.lwjgl.BufferUtils;
|
import org.lwjgl.BufferUtils;
|
||||||
|
|
||||||
@ -453,12 +452,12 @@ public class FoliageCell {
|
|||||||
protected void draw(){
|
protected void draw(){
|
||||||
if(this.containedEntities.size() > 0){
|
if(this.containedEntities.size() > 0){
|
||||||
Matrix4d modelMatrix = new Matrix4d();
|
Matrix4d modelMatrix = new Matrix4d();
|
||||||
Vector3f cameraCenter = CameraEntityUtils.getCameraCenter(Globals.playerCamera);
|
Vector3d cameraCenter = CameraEntityUtils.getCameraCenter(Globals.playerCamera);
|
||||||
|
|
||||||
RenderPipelineState renderPipelineState = Globals.renderingEngine.getRenderPipelineState();
|
RenderPipelineState renderPipelineState = Globals.renderingEngine.getRenderPipelineState();
|
||||||
OpenGLState openGLState = Globals.renderingEngine.getOpenGLState();
|
OpenGLState openGLState = Globals.renderingEngine.getOpenGLState();
|
||||||
|
|
||||||
Vector3f cameraModifiedPosition = new Vector3f((float)realPosition.x,(float)realPosition.y,(float)realPosition.z).sub(cameraCenter);
|
Vector3d cameraModifiedPosition = new Vector3d(realPosition).sub(cameraCenter);
|
||||||
//frustum check entire cell
|
//frustum check entire cell
|
||||||
boolean shouldRender = renderPipelineState.getFrustumIntersection().testSphere((float)(cameraModifiedPosition.x + boundingSphere.x), (float)(cameraModifiedPosition.y + boundingSphere.y), (float)(cameraModifiedPosition.z + boundingSphere.z), (float)(boundingSphere.r));
|
boolean shouldRender = renderPipelineState.getFrustumIntersection().testSphere((float)(cameraModifiedPosition.x + boundingSphere.x), (float)(cameraModifiedPosition.y + boundingSphere.y), (float)(cameraModifiedPosition.z + boundingSphere.z), (float)(boundingSphere.r));
|
||||||
if(shouldRender){
|
if(shouldRender){
|
||||||
|
|||||||
@ -11,7 +11,6 @@ import java.util.Random;
|
|||||||
import org.joml.Matrix4d;
|
import org.joml.Matrix4d;
|
||||||
import org.joml.Quaterniond;
|
import org.joml.Quaterniond;
|
||||||
import org.joml.Vector3d;
|
import org.joml.Vector3d;
|
||||||
import org.joml.Vector3f;
|
|
||||||
import org.joml.Vector3i;
|
import org.joml.Vector3i;
|
||||||
|
|
||||||
import electrosphere.client.entity.camera.CameraEntityUtils;
|
import electrosphere.client.entity.camera.CameraEntityUtils;
|
||||||
@ -475,13 +474,13 @@ public class FoliageCell {
|
|||||||
protected void draw(){
|
protected void draw(){
|
||||||
if(this.modelEntity != null){
|
if(this.modelEntity != null){
|
||||||
Matrix4d modelMatrix = new Matrix4d();
|
Matrix4d modelMatrix = new Matrix4d();
|
||||||
Vector3f cameraCenter = CameraEntityUtils.getCameraCenter(Globals.playerCamera);
|
Vector3d cameraCenter = CameraEntityUtils.getCameraCenter(Globals.playerCamera);
|
||||||
|
|
||||||
RenderPipelineState renderPipelineState = Globals.renderingEngine.getRenderPipelineState();
|
RenderPipelineState renderPipelineState = Globals.renderingEngine.getRenderPipelineState();
|
||||||
OpenGLState openGLState = Globals.renderingEngine.getOpenGLState();
|
OpenGLState openGLState = Globals.renderingEngine.getOpenGLState();
|
||||||
|
|
||||||
Vector3d realPosition = this.getRealPos();
|
Vector3d realPosition = this.getRealPos();
|
||||||
Vector3f cameraModifiedPosition = new Vector3f((float)realPosition.x,(float)realPosition.y,(float)realPosition.z).sub(cameraCenter);
|
Vector3d cameraModifiedPosition = new Vector3d(realPosition).sub(cameraCenter);
|
||||||
//frustum check entire cell
|
//frustum check entire cell
|
||||||
int size = (int)Math.pow(2,this.lod);
|
int size = (int)Math.pow(2,this.lod);
|
||||||
boolean shouldRender = renderPipelineState.getFrustumIntersection().testSphere(
|
boolean shouldRender = renderPipelineState.getFrustumIntersection().testSphere(
|
||||||
|
|||||||
@ -3,6 +3,7 @@ package electrosphere.client.ui.components;
|
|||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import org.joml.Vector3d;
|
||||||
import org.joml.Vector3f;
|
import org.joml.Vector3f;
|
||||||
import org.joml.Vector4d;
|
import org.joml.Vector4d;
|
||||||
|
|
||||||
@ -61,7 +62,7 @@ public class CharacterCustomizer {
|
|||||||
CreatureData selectedRaceType = Globals.gameConfigCurrent.getCreatureTypeLoader().getType(race);
|
CreatureData selectedRaceType = Globals.gameConfigCurrent.getCreatureTypeLoader().getType(race);
|
||||||
|
|
||||||
//spawn camera so renderer doesn't crash (once render pipeline is modularized this shouldn't be necessary)
|
//spawn camera so renderer doesn't crash (once render pipeline is modularized this shouldn't be necessary)
|
||||||
Globals.playerCamera = CameraEntityUtils.spawnBasicCameraEntity(new Vector3f(0,0,0), new Vector3f(0,0.3f,1).normalize());
|
Globals.playerCamera = CameraEntityUtils.spawnBasicCameraEntity(new Vector3d(0,0,0), new Vector3d(0,0.3f,1).normalize());
|
||||||
Globals.viewMatrix = CameraEntityUtils.getCameraViewMatrix(Globals.playerCamera);
|
Globals.viewMatrix = CameraEntityUtils.getCameraViewMatrix(Globals.playerCamera);
|
||||||
|
|
||||||
//create actor panel
|
//create actor panel
|
||||||
|
|||||||
@ -4,7 +4,7 @@ import java.util.Arrays;
|
|||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.joml.Vector3f;
|
import org.joml.Vector3d;
|
||||||
|
|
||||||
import electrosphere.client.entity.camera.CameraEntityUtils;
|
import electrosphere.client.entity.camera.CameraEntityUtils;
|
||||||
import electrosphere.client.ui.components.CharacterCustomizer;
|
import electrosphere.client.ui.components.CharacterCustomizer;
|
||||||
@ -99,7 +99,7 @@ public class MenuGeneratorsUITesting {
|
|||||||
//actor panel
|
//actor panel
|
||||||
ActorPanel actorPanel = ActorPanel.create(ActorUtils.createActorFromModelPath(AssetDataStrings.UNITCUBE));
|
ActorPanel actorPanel = ActorPanel.create(ActorUtils.createActorFromModelPath(AssetDataStrings.UNITCUBE));
|
||||||
if(Globals.playerCamera == null){
|
if(Globals.playerCamera == null){
|
||||||
Globals.playerCamera = CameraEntityUtils.spawnBasicCameraEntity(new Vector3f(0,0,0), new Vector3f(-1,0,0));
|
Globals.playerCamera = CameraEntityUtils.spawnBasicCameraEntity(new Vector3d(0,0,0), new Vector3d(-1,0,0));
|
||||||
}
|
}
|
||||||
formEl.addChild(actorPanel);
|
formEl.addChild(actorPanel);
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,7 @@
|
|||||||
package electrosphere.controls;
|
package electrosphere.controls;
|
||||||
|
|
||||||
import org.joml.Quaternionf;
|
import org.joml.Quaterniond;
|
||||||
import org.joml.Vector3d;
|
import org.joml.Vector3d;
|
||||||
import org.joml.Vector3f;
|
|
||||||
|
|
||||||
import electrosphere.client.entity.camera.CameraEntityUtils;
|
import electrosphere.client.entity.camera.CameraEntityUtils;
|
||||||
import electrosphere.client.entity.crosshair.Crosshair;
|
import electrosphere.client.entity.crosshair.Crosshair;
|
||||||
@ -35,9 +34,9 @@ public class CameraHandler {
|
|||||||
//the current pitch
|
//the current pitch
|
||||||
float pitch = 50;
|
float pitch = 50;
|
||||||
//the camera's rotation vector
|
//the camera's rotation vector
|
||||||
Vector3f cameraRotationVector = new Vector3f();
|
Vector3d cameraRotationVector = new Vector3d();
|
||||||
//the radial offset of the camera
|
//the radial offset of the camera
|
||||||
Vector3f radialOffset = new Vector3f(0,1,0);
|
Vector3d radialOffset = new Vector3d(0,1,0);
|
||||||
//if set to true, the camera will track the player's entity
|
//if set to true, the camera will track the player's entity
|
||||||
boolean trackPlayerEntity = true;
|
boolean trackPlayerEntity = true;
|
||||||
|
|
||||||
@ -69,7 +68,7 @@ public class CameraHandler {
|
|||||||
* Updates the radial offset
|
* Updates the radial offset
|
||||||
* @param offset the radial offset
|
* @param offset the radial offset
|
||||||
*/
|
*/
|
||||||
public void updateRadialOffset(Vector3f offset){
|
public void updateRadialOffset(Vector3d offset){
|
||||||
radialOffset = offset;
|
radialOffset = offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,11 +83,6 @@ public class CameraHandler {
|
|||||||
|
|
||||||
if(Crosshair.getCrosshairActive()){
|
if(Crosshair.getCrosshairActive()){
|
||||||
|
|
||||||
// if(Globals.playerCharacter != null){
|
|
||||||
// Vector3d charPos = EntityUtils.getPosition(Globals.playerCharacter);
|
|
||||||
// CameraEntityUtils.setCameraCenter(Globals.playerCamera, new Vector3f((float)charPos.x,(float)charPos.y,(float)charPos.z));
|
|
||||||
// }
|
|
||||||
|
|
||||||
Vector3d characterPos = EntityUtils.getPosition(Globals.playerEntity);
|
Vector3d characterPos = EntityUtils.getPosition(Globals.playerEntity);
|
||||||
Vector3d targetPos = Crosshair.getTargetPosition();
|
Vector3d targetPos = Crosshair.getTargetPosition();
|
||||||
Vector3d diffed = new Vector3d(targetPos).sub(characterPos).mul(-1).normalize();
|
Vector3d diffed = new Vector3d(targetPos).sub(characterPos).mul(-1).normalize();
|
||||||
@ -103,38 +97,22 @@ public class CameraHandler {
|
|||||||
CameraEntityUtils.setCameraPitch(Globals.playerCamera, pitch);
|
CameraEntityUtils.setCameraPitch(Globals.playerCamera, pitch);
|
||||||
CameraEntityUtils.setCameraYaw(Globals.playerCamera, yaw);
|
CameraEntityUtils.setCameraYaw(Globals.playerCamera, yaw);
|
||||||
|
|
||||||
// System.out.println(pitch);
|
Quaterniond pitchQuat = new Quaterniond().fromAxisAngleDeg(SpatialMathUtils.getLeftVector(), -pitch);
|
||||||
// if(Globals.playerCharacter != null){
|
Quaterniond yawQuat = new Quaterniond().fromAxisAngleDeg(SpatialMathUtils.getUpVector(), -yaw);
|
||||||
// Vector3d charPos = EntityUtils.getPosition(Globals.playerCharacter);
|
|
||||||
// CameraEntityUtils.setCameraCenter(Globals.playerCamera, new Vector3f((float)charPos.x,(float)charPos.y,(float)charPos.z));
|
|
||||||
// }
|
|
||||||
|
|
||||||
Quaternionf pitchQuat = new Quaternionf().fromAxisAngleDeg(SpatialMathUtils.getLeftVectorf(), -pitch);
|
cameraRotationVector = pitchQuat.transform(SpatialMathUtils.getOriginVector());
|
||||||
Quaternionf yawQuat = new Quaternionf().fromAxisAngleDeg(SpatialMathUtils.getUpVectorf(), -yaw);
|
|
||||||
// float yawRad = yaw / 180.0f * (float)Math.PI;
|
|
||||||
// float pitchRad = pitch / 180.0f * (float)Math.PI;
|
|
||||||
// float rollRad = 0.0f;
|
|
||||||
// pitchQuat.mul(yawQuat);
|
|
||||||
cameraRotationVector = pitchQuat.transform(SpatialMathUtils.getOriginVectorf());
|
|
||||||
cameraRotationVector = yawQuat.transform(cameraRotationVector);
|
cameraRotationVector = yawQuat.transform(cameraRotationVector);
|
||||||
cameraRotationVector.normalize();
|
cameraRotationVector.normalize();
|
||||||
|
|
||||||
|
|
||||||
// cameraRotationVector.x = 0 + (float) Math.cos(yaw / 180.0f * Math.PI) * 1;
|
|
||||||
// cameraRotationVector.y = 0 + (float) Math.sin(pitch / 180.0f * Math.PI) * 1;
|
|
||||||
// cameraRotationVector.z = 0 + (float) Math.sin(yaw / 180.0f * Math.PI) * 1;
|
|
||||||
// cameraRotationVector.normalize();
|
|
||||||
// System.out.println(yaw + " " + pitch);
|
|
||||||
}
|
}
|
||||||
if(trackPlayerEntity && Globals.playerEntity != null){
|
if(trackPlayerEntity && Globals.playerEntity != null){
|
||||||
Vector3d entityPos = EntityUtils.getPosition(Globals.playerEntity);
|
Vector3d entityPos = EntityUtils.getPosition(Globals.playerEntity);
|
||||||
CameraEntityUtils.setCameraCenter(Globals.playerCamera, new Vector3f((float)entityPos.x,(float)entityPos.y,(float)entityPos.z).add(CameraEntityUtils.getOrbitalCameraRadialOffset(Globals.playerCamera)));
|
CameraEntityUtils.setCameraCenter(Globals.playerCamera, new Vector3d(entityPos).add(CameraEntityUtils.getOrbitalCameraRadialOffset(Globals.playerCamera)));
|
||||||
}
|
}
|
||||||
//update view matrix offset
|
//update view matrix offset
|
||||||
float xFactor = (float)Math.cos(yaw / 180.0f * Math.PI);
|
float xFactor = (float)Math.cos(yaw / 180.0f * Math.PI);
|
||||||
float yFactor = (float)Math.sin(yaw / 180.0f * Math.PI);
|
float yFactor = (float)Math.sin(yaw / 180.0f * Math.PI);
|
||||||
Vector3f radialOffset = CameraEntityUtils.getOrbitalCameraRadialOffset(Globals.playerCamera);
|
Vector3d radialOffset = CameraEntityUtils.getOrbitalCameraRadialOffset(Globals.playerCamera);
|
||||||
Vector3f trueOffset = new Vector3f(radialOffset).mul(xFactor,1.0f,yFactor);
|
Vector3d trueOffset = new Vector3d(radialOffset).mul(xFactor,1.0f,yFactor);
|
||||||
CameraEntityUtils.setOrbitalCameraRadialOffset(Globals.playerCamera, trueOffset);
|
CameraEntityUtils.setOrbitalCameraRadialOffset(Globals.playerCamera, trueOffset);
|
||||||
cameraRotationVector.mul(CameraEntityUtils.getOrbitalCameraDistance(Globals.playerCamera));
|
cameraRotationVector.mul(CameraEntityUtils.getOrbitalCameraDistance(Globals.playerCamera));
|
||||||
CameraEntityUtils.setCameraEye(Globals.playerCamera, cameraRotationVector);
|
CameraEntityUtils.setCameraEye(Globals.playerCamera, cameraRotationVector);
|
||||||
|
|||||||
@ -3,7 +3,7 @@ package electrosphere.controls.categories;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.joml.Vector3f;
|
import org.joml.Vector3d;
|
||||||
import org.lwjgl.glfw.GLFW;
|
import org.lwjgl.glfw.GLFW;
|
||||||
|
|
||||||
import electrosphere.client.entity.camera.CameraEntityUtils;
|
import electrosphere.client.entity.camera.CameraEntityUtils;
|
||||||
@ -49,7 +49,7 @@ public class ControlCategoryFreecam {
|
|||||||
){
|
){
|
||||||
freeCameraControlList.add(controlMap.get(FREECAM_UP));
|
freeCameraControlList.add(controlMap.get(FREECAM_UP));
|
||||||
controlMap.get(FREECAM_UP).setOnRepeat(new ControlMethod(){public void execute(MouseState mouseState){
|
controlMap.get(FREECAM_UP).setOnRepeat(new ControlMethod(){public void execute(MouseState mouseState){
|
||||||
Vector3f playerCameraCenterPos = CameraEntityUtils.getCameraCenter(Globals.playerCamera);
|
Vector3d playerCameraCenterPos = CameraEntityUtils.getCameraCenter(Globals.playerCamera);
|
||||||
playerCameraCenterPos.add(0,0.1f,0);
|
playerCameraCenterPos.add(0,0.1f,0);
|
||||||
CameraEntityUtils.setCameraCenter(Globals.playerCamera,playerCameraCenterPos);
|
CameraEntityUtils.setCameraCenter(Globals.playerCamera,playerCameraCenterPos);
|
||||||
}});
|
}});
|
||||||
@ -57,7 +57,7 @@ public class ControlCategoryFreecam {
|
|||||||
|
|
||||||
freeCameraControlList.add(controlMap.get(FREECAM_DOWN));
|
freeCameraControlList.add(controlMap.get(FREECAM_DOWN));
|
||||||
controlMap.get(FREECAM_DOWN).setOnRepeat(new ControlMethod(){public void execute(MouseState mouseState){
|
controlMap.get(FREECAM_DOWN).setOnRepeat(new ControlMethod(){public void execute(MouseState mouseState){
|
||||||
Vector3f playerCameraCenterPos = CameraEntityUtils.getCameraCenter(Globals.playerCamera);
|
Vector3d playerCameraCenterPos = CameraEntityUtils.getCameraCenter(Globals.playerCamera);
|
||||||
playerCameraCenterPos.add(0,-0.1f,0);
|
playerCameraCenterPos.add(0,-0.1f,0);
|
||||||
CameraEntityUtils.setCameraCenter(Globals.playerCamera,playerCameraCenterPos);
|
CameraEntityUtils.setCameraCenter(Globals.playerCamera,playerCameraCenterPos);
|
||||||
}});
|
}});
|
||||||
@ -65,9 +65,9 @@ public class ControlCategoryFreecam {
|
|||||||
|
|
||||||
freeCameraControlList.add(controlMap.get(FREECAM_FORWARD));
|
freeCameraControlList.add(controlMap.get(FREECAM_FORWARD));
|
||||||
ControlMethod freeCamForwardCallback = new ControlMethod(){public void execute(MouseState mouseState){
|
ControlMethod freeCamForwardCallback = new ControlMethod(){public void execute(MouseState mouseState){
|
||||||
Vector3f playerCameraCenterPos = CameraEntityUtils.getCameraCenter(Globals.playerCamera);
|
Vector3d playerCameraCenterPos = CameraEntityUtils.getCameraCenter(Globals.playerCamera);
|
||||||
Vector3f playerCameraEyePos = CameraEntityUtils.getCameraEye(Globals.playerCamera);
|
Vector3d playerCameraEyePos = CameraEntityUtils.getCameraEye(Globals.playerCamera);
|
||||||
playerCameraCenterPos.add(new Vector3f(playerCameraEyePos).normalize().mul(-0.1f));
|
playerCameraCenterPos.add(new Vector3d(playerCameraEyePos).normalize().mul(-0.1f));
|
||||||
CameraEntityUtils.setCameraCenter(Globals.playerCamera,playerCameraCenterPos);
|
CameraEntityUtils.setCameraCenter(Globals.playerCamera,playerCameraCenterPos);
|
||||||
}};
|
}};
|
||||||
controlMap.get(FREECAM_FORWARD).setOnClick(freeCamForwardCallback);
|
controlMap.get(FREECAM_FORWARD).setOnClick(freeCamForwardCallback);
|
||||||
@ -75,9 +75,9 @@ public class ControlCategoryFreecam {
|
|||||||
|
|
||||||
freeCameraControlList.add(controlMap.get(FREECAM_BACKWARD));
|
freeCameraControlList.add(controlMap.get(FREECAM_BACKWARD));
|
||||||
ControlMethod freeCamBackwardCallback = new ControlMethod(){public void execute(MouseState mouseState){
|
ControlMethod freeCamBackwardCallback = new ControlMethod(){public void execute(MouseState mouseState){
|
||||||
Vector3f playerCameraCenterPos = CameraEntityUtils.getCameraCenter(Globals.playerCamera);
|
Vector3d playerCameraCenterPos = CameraEntityUtils.getCameraCenter(Globals.playerCamera);
|
||||||
Vector3f playerCameraEyePos = CameraEntityUtils.getCameraEye(Globals.playerCamera);
|
Vector3d playerCameraEyePos = CameraEntityUtils.getCameraEye(Globals.playerCamera);
|
||||||
playerCameraCenterPos.add(new Vector3f(playerCameraEyePos).normalize().mul(0.1f));
|
playerCameraCenterPos.add(new Vector3d(playerCameraEyePos).normalize().mul(0.1f));
|
||||||
CameraEntityUtils.setCameraCenter(Globals.playerCamera,playerCameraCenterPos);
|
CameraEntityUtils.setCameraCenter(Globals.playerCamera,playerCameraCenterPos);
|
||||||
}};
|
}};
|
||||||
controlMap.get(FREECAM_BACKWARD).setOnClick(freeCamBackwardCallback);
|
controlMap.get(FREECAM_BACKWARD).setOnClick(freeCamBackwardCallback);
|
||||||
@ -85,10 +85,10 @@ public class ControlCategoryFreecam {
|
|||||||
|
|
||||||
freeCameraControlList.add(controlMap.get(FREECAM_LEFT));
|
freeCameraControlList.add(controlMap.get(FREECAM_LEFT));
|
||||||
ControlMethod freeCamLeftCallback = new ControlMethod(){public void execute(MouseState mouseState){
|
ControlMethod freeCamLeftCallback = new ControlMethod(){public void execute(MouseState mouseState){
|
||||||
Vector3f playerCameraCenterPos = CameraEntityUtils.getCameraCenter(Globals.playerCamera);
|
Vector3d playerCameraCenterPos = CameraEntityUtils.getCameraCenter(Globals.playerCamera);
|
||||||
Vector3f playerCameraEyePos = CameraEntityUtils.getCameraEye(Globals.playerCamera);
|
Vector3d playerCameraEyePos = CameraEntityUtils.getCameraEye(Globals.playerCamera);
|
||||||
Vector3f modifiedVec = new Vector3f(playerCameraEyePos.x,0,playerCameraEyePos.z).rotateY((float)(-90 * Math.PI / 180)).normalize();
|
Vector3d modifiedVec = new Vector3d(playerCameraEyePos.x,0,playerCameraEyePos.z).rotateY((float)(-90 * Math.PI / 180)).normalize();
|
||||||
playerCameraCenterPos.add(new Vector3f(modifiedVec).mul(0.1f));
|
playerCameraCenterPos.add(new Vector3d(modifiedVec).mul(0.1f));
|
||||||
CameraEntityUtils.setCameraCenter(Globals.playerCamera,playerCameraCenterPos);
|
CameraEntityUtils.setCameraCenter(Globals.playerCamera,playerCameraCenterPos);
|
||||||
}};
|
}};
|
||||||
controlMap.get(FREECAM_LEFT).setOnClick(freeCamLeftCallback);
|
controlMap.get(FREECAM_LEFT).setOnClick(freeCamLeftCallback);
|
||||||
@ -96,10 +96,10 @@ public class ControlCategoryFreecam {
|
|||||||
|
|
||||||
freeCameraControlList.add(controlMap.get(FREECAM_RIGHT));
|
freeCameraControlList.add(controlMap.get(FREECAM_RIGHT));
|
||||||
ControlMethod freeCamRightCallback = new ControlMethod(){public void execute(MouseState mouseState){
|
ControlMethod freeCamRightCallback = new ControlMethod(){public void execute(MouseState mouseState){
|
||||||
Vector3f playerCameraCenterPos = CameraEntityUtils.getCameraCenter(Globals.playerCamera);
|
Vector3d playerCameraCenterPos = CameraEntityUtils.getCameraCenter(Globals.playerCamera);
|
||||||
Vector3f playerCameraEyePos = CameraEntityUtils.getCameraEye(Globals.playerCamera);
|
Vector3d playerCameraEyePos = CameraEntityUtils.getCameraEye(Globals.playerCamera);
|
||||||
Vector3f modifiedVec = new Vector3f(playerCameraEyePos.x,0,playerCameraEyePos.z).rotateY((float)(90 * Math.PI / 180)).normalize();
|
Vector3d modifiedVec = new Vector3d(playerCameraEyePos.x,0,playerCameraEyePos.z).rotateY((float)(90 * Math.PI / 180)).normalize();
|
||||||
playerCameraCenterPos.add(new Vector3f(modifiedVec).mul(0.1f));
|
playerCameraCenterPos.add(new Vector3d(modifiedVec).mul(0.1f));
|
||||||
CameraEntityUtils.setCameraCenter(Globals.playerCamera,playerCameraCenterPos);
|
CameraEntityUtils.setCameraCenter(Globals.playerCamera,playerCameraCenterPos);
|
||||||
}};
|
}};
|
||||||
controlMap.get(FREECAM_RIGHT).setOnClick(freeCamRightCallback);
|
controlMap.get(FREECAM_RIGHT).setOnClick(freeCamRightCallback);
|
||||||
|
|||||||
@ -4,7 +4,6 @@ import java.util.HashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.joml.Vector3d;
|
import org.joml.Vector3d;
|
||||||
import org.joml.Vector3f;
|
|
||||||
import org.lwjgl.glfw.GLFW;
|
import org.lwjgl.glfw.GLFW;
|
||||||
|
|
||||||
import electrosphere.audio.VirtualAudioSourceManager.VirtualAudioSourceType;
|
import electrosphere.audio.VirtualAudioSourceManager.VirtualAudioSourceType;
|
||||||
@ -189,7 +188,7 @@ public class ControlCategoryMainGame {
|
|||||||
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.playerEntity);
|
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.playerEntity);
|
||||||
if(movementTree instanceof ClientGroundMovementTree){
|
if(movementTree instanceof ClientGroundMovementTree){
|
||||||
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
|
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
|
||||||
Vector3f cameraEyeVector = CameraEntityUtils.getCameraEye(Globals.playerCamera);
|
Vector3d cameraEyeVector = CameraEntityUtils.getCameraEye(Globals.playerCamera);
|
||||||
if(controlMap.get(DATA_STRING_INPUT_CODE_STRAFE_LEFT).isState()){
|
if(controlMap.get(DATA_STRING_INPUT_CODE_STRAFE_LEFT).isState()){
|
||||||
CreatureUtils.setFacingVector(Globals.playerEntity, new Vector3d(-cameraEyeVector.x,0,-cameraEyeVector.z).rotateY(3.0/4.0*Math.PI).normalize());
|
CreatureUtils.setFacingVector(Globals.playerEntity, new Vector3d(-cameraEyeVector.x,0,-cameraEyeVector.z).rotateY(3.0/4.0*Math.PI).normalize());
|
||||||
groundTree.start(MovementRelativeFacing.BACKWARD_LEFT);
|
groundTree.start(MovementRelativeFacing.BACKWARD_LEFT);
|
||||||
@ -212,7 +211,7 @@ public class ControlCategoryMainGame {
|
|||||||
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.playerEntity);
|
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.playerEntity);
|
||||||
if(movementTree instanceof ClientGroundMovementTree){
|
if(movementTree instanceof ClientGroundMovementTree){
|
||||||
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
|
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
|
||||||
Vector3f cameraEyeVector = CameraEntityUtils.getCameraEye(Globals.playerCamera);
|
Vector3d cameraEyeVector = CameraEntityUtils.getCameraEye(Globals.playerCamera);
|
||||||
if(controlMap.get(DATA_STRING_INPUT_CODE_STRAFE_LEFT).isState()){
|
if(controlMap.get(DATA_STRING_INPUT_CODE_STRAFE_LEFT).isState()){
|
||||||
CreatureUtils.setFacingVector(Globals.playerEntity, new Vector3d(-cameraEyeVector.x,0,-cameraEyeVector.z).rotateY(3.0/4.0*Math.PI).normalize());
|
CreatureUtils.setFacingVector(Globals.playerEntity, new Vector3d(-cameraEyeVector.x,0,-cameraEyeVector.z).rotateY(3.0/4.0*Math.PI).normalize());
|
||||||
groundTree.start(MovementRelativeFacing.BACKWARD_LEFT);
|
groundTree.start(MovementRelativeFacing.BACKWARD_LEFT);
|
||||||
@ -251,7 +250,7 @@ public class ControlCategoryMainGame {
|
|||||||
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.playerEntity);
|
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.playerEntity);
|
||||||
if(movementTree instanceof ClientGroundMovementTree){
|
if(movementTree instanceof ClientGroundMovementTree){
|
||||||
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
|
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
|
||||||
Vector3f cameraEyeVector = CameraEntityUtils.getCameraEye(Globals.playerCamera);
|
Vector3d cameraEyeVector = CameraEntityUtils.getCameraEye(Globals.playerCamera);
|
||||||
if(
|
if(
|
||||||
(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD).isIsKey() && !Globals.controlCallback.getKey(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD).getKeyValue())) &&
|
(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD).isIsKey() && !Globals.controlCallback.getKey(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD).getKeyValue())) &&
|
||||||
(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_BACKWARD).isIsKey() && !Globals.controlCallback.getKey(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_BACKWARD).getKeyValue()))
|
(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_BACKWARD).isIsKey() && !Globals.controlCallback.getKey(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_BACKWARD).getKeyValue()))
|
||||||
@ -260,7 +259,7 @@ public class ControlCategoryMainGame {
|
|||||||
groundTree.start(MovementRelativeFacing.FORWARD);
|
groundTree.start(MovementRelativeFacing.FORWARD);
|
||||||
}
|
}
|
||||||
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity) != null){
|
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity) != null){
|
||||||
Vector3f cameraEyeVector = CameraEntityUtils.getCameraEye(Globals.playerCamera);
|
Vector3d cameraEyeVector = CameraEntityUtils.getCameraEye(Globals.playerCamera);
|
||||||
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity);
|
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity);
|
||||||
CreatureUtils.setFacingVector(Globals.playerEntity, new Vector3d(-cameraEyeVector.x,0,-cameraEyeVector.z).rotateY(Math.PI/2.0).normalize());
|
CreatureUtils.setFacingVector(Globals.playerEntity, new Vector3d(-cameraEyeVector.x,0,-cameraEyeVector.z).rotateY(Math.PI/2.0).normalize());
|
||||||
clientEditorMovementTree.start(electrosphere.entity.state.movement.editor.ClientEditorMovementTree.MovementRelativeFacing.FORWARD);
|
clientEditorMovementTree.start(electrosphere.entity.state.movement.editor.ClientEditorMovementTree.MovementRelativeFacing.FORWARD);
|
||||||
@ -272,7 +271,7 @@ public class ControlCategoryMainGame {
|
|||||||
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.playerEntity);
|
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.playerEntity);
|
||||||
if(movementTree instanceof ClientGroundMovementTree){
|
if(movementTree instanceof ClientGroundMovementTree){
|
||||||
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
|
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
|
||||||
Vector3f cameraEyeVector = CameraEntityUtils.getCameraEye(Globals.playerCamera);
|
Vector3d cameraEyeVector = CameraEntityUtils.getCameraEye(Globals.playerCamera);
|
||||||
if(
|
if(
|
||||||
(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD).isIsKey() && !Globals.controlCallback.getKey(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD).getKeyValue())) &&
|
(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD).isIsKey() && !Globals.controlCallback.getKey(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD).getKeyValue())) &&
|
||||||
(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_BACKWARD).isIsKey() && !Globals.controlCallback.getKey(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_BACKWARD).getKeyValue()))
|
(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_BACKWARD).isIsKey() && !Globals.controlCallback.getKey(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_BACKWARD).getKeyValue()))
|
||||||
@ -281,7 +280,7 @@ public class ControlCategoryMainGame {
|
|||||||
groundTree.start(MovementRelativeFacing.FORWARD);
|
groundTree.start(MovementRelativeFacing.FORWARD);
|
||||||
}
|
}
|
||||||
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity) != null){
|
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity) != null){
|
||||||
Vector3f cameraEyeVector = CameraEntityUtils.getCameraEye(Globals.playerCamera);
|
Vector3d cameraEyeVector = CameraEntityUtils.getCameraEye(Globals.playerCamera);
|
||||||
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity);
|
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity);
|
||||||
CreatureUtils.setFacingVector(Globals.playerEntity, new Vector3d(-cameraEyeVector.x,0,-cameraEyeVector.z).rotateY(Math.PI/2.0).normalize());
|
CreatureUtils.setFacingVector(Globals.playerEntity, new Vector3d(-cameraEyeVector.x,0,-cameraEyeVector.z).rotateY(Math.PI/2.0).normalize());
|
||||||
clientEditorMovementTree.start(electrosphere.entity.state.movement.editor.ClientEditorMovementTree.MovementRelativeFacing.FORWARD);
|
clientEditorMovementTree.start(electrosphere.entity.state.movement.editor.ClientEditorMovementTree.MovementRelativeFacing.FORWARD);
|
||||||
@ -309,7 +308,7 @@ public class ControlCategoryMainGame {
|
|||||||
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.playerEntity);
|
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.playerEntity);
|
||||||
if(movementTree instanceof ClientGroundMovementTree){
|
if(movementTree instanceof ClientGroundMovementTree){
|
||||||
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
|
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
|
||||||
Vector3f cameraEyeVector = CameraEntityUtils.getCameraEye(Globals.playerCamera);
|
Vector3d cameraEyeVector = CameraEntityUtils.getCameraEye(Globals.playerCamera);
|
||||||
if(
|
if(
|
||||||
(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD).isIsKey() && !Globals.controlCallback.getKey(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD).getKeyValue())) &&
|
(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD).isIsKey() && !Globals.controlCallback.getKey(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD).getKeyValue())) &&
|
||||||
(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_BACKWARD).isIsKey() && !Globals.controlCallback.getKey(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_BACKWARD).getKeyValue()))
|
(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_BACKWARD).isIsKey() && !Globals.controlCallback.getKey(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_BACKWARD).getKeyValue()))
|
||||||
@ -318,7 +317,7 @@ public class ControlCategoryMainGame {
|
|||||||
groundTree.start(MovementRelativeFacing.FORWARD);
|
groundTree.start(MovementRelativeFacing.FORWARD);
|
||||||
}
|
}
|
||||||
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity) != null){
|
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity) != null){
|
||||||
Vector3f cameraEyeVector = CameraEntityUtils.getCameraEye(Globals.playerCamera);
|
Vector3d cameraEyeVector = CameraEntityUtils.getCameraEye(Globals.playerCamera);
|
||||||
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity);
|
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity);
|
||||||
CreatureUtils.setFacingVector(Globals.playerEntity, new Vector3d(-cameraEyeVector.x,0,-cameraEyeVector.z).rotateY(-Math.PI/2.0).normalize());
|
CreatureUtils.setFacingVector(Globals.playerEntity, new Vector3d(-cameraEyeVector.x,0,-cameraEyeVector.z).rotateY(-Math.PI/2.0).normalize());
|
||||||
clientEditorMovementTree.start(electrosphere.entity.state.movement.editor.ClientEditorMovementTree.MovementRelativeFacing.FORWARD);
|
clientEditorMovementTree.start(electrosphere.entity.state.movement.editor.ClientEditorMovementTree.MovementRelativeFacing.FORWARD);
|
||||||
@ -330,7 +329,7 @@ public class ControlCategoryMainGame {
|
|||||||
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.playerEntity);
|
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.playerEntity);
|
||||||
if(movementTree instanceof ClientGroundMovementTree){
|
if(movementTree instanceof ClientGroundMovementTree){
|
||||||
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
|
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
|
||||||
Vector3f cameraEyeVector = CameraEntityUtils.getCameraEye(Globals.playerCamera);
|
Vector3d cameraEyeVector = CameraEntityUtils.getCameraEye(Globals.playerCamera);
|
||||||
if(
|
if(
|
||||||
(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD).isIsKey() && !Globals.controlCallback.getKey(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD).getKeyValue())) &&
|
(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD).isIsKey() && !Globals.controlCallback.getKey(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD).getKeyValue())) &&
|
||||||
(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_BACKWARD).isIsKey() && !Globals.controlCallback.getKey(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_BACKWARD).getKeyValue()))
|
(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_BACKWARD).isIsKey() && !Globals.controlCallback.getKey(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_BACKWARD).getKeyValue()))
|
||||||
@ -339,7 +338,7 @@ public class ControlCategoryMainGame {
|
|||||||
groundTree.start(MovementRelativeFacing.FORWARD);
|
groundTree.start(MovementRelativeFacing.FORWARD);
|
||||||
}
|
}
|
||||||
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity) != null){
|
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity) != null){
|
||||||
Vector3f cameraEyeVector = CameraEntityUtils.getCameraEye(Globals.playerCamera);
|
Vector3d cameraEyeVector = CameraEntityUtils.getCameraEye(Globals.playerCamera);
|
||||||
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity);
|
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity);
|
||||||
CreatureUtils.setFacingVector(Globals.playerEntity, new Vector3d(-cameraEyeVector.x,0,-cameraEyeVector.z).rotateY(-Math.PI/2.0).normalize());
|
CreatureUtils.setFacingVector(Globals.playerEntity, new Vector3d(-cameraEyeVector.x,0,-cameraEyeVector.z).rotateY(-Math.PI/2.0).normalize());
|
||||||
clientEditorMovementTree.start(electrosphere.entity.state.movement.editor.ClientEditorMovementTree.MovementRelativeFacing.FORWARD);
|
clientEditorMovementTree.start(electrosphere.entity.state.movement.editor.ClientEditorMovementTree.MovementRelativeFacing.FORWARD);
|
||||||
|
|||||||
@ -5,7 +5,6 @@ import java.lang.management.ManagementFactory;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import org.joml.Matrix4d;
|
import org.joml.Matrix4d;
|
||||||
import org.joml.Matrix4f;
|
|
||||||
import org.joml.Vector3f;
|
import org.joml.Vector3f;
|
||||||
|
|
||||||
import electrosphere.audio.AudioEngine;
|
import electrosphere.audio.AudioEngine;
|
||||||
@ -265,9 +264,9 @@ public class Globals {
|
|||||||
public static float nearClip = 0.01f;
|
public static float nearClip = 0.01f;
|
||||||
|
|
||||||
//matrices for drawing models
|
//matrices for drawing models
|
||||||
public static Matrix4f viewMatrix = new Matrix4f();
|
public static Matrix4d viewMatrix = new Matrix4d();
|
||||||
public static Matrix4d projectionMatrix;
|
public static Matrix4d projectionMatrix;
|
||||||
public static Matrix4f lightDepthMatrix = new Matrix4f();
|
public static Matrix4d lightDepthMatrix = new Matrix4d();
|
||||||
|
|
||||||
//locations for shadow map specific variables
|
//locations for shadow map specific variables
|
||||||
public static int depthMapShaderProgramLoc = 0;
|
public static int depthMapShaderProgramLoc = 0;
|
||||||
|
|||||||
@ -3,6 +3,7 @@ package electrosphere.engine.loadingthreads;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
import org.joml.Vector3d;
|
||||||
import org.joml.Vector3f;
|
import org.joml.Vector3f;
|
||||||
|
|
||||||
import electrosphere.client.block.cells.ClientBlockCellManager;
|
import electrosphere.client.block.cells.ClientBlockCellManager;
|
||||||
@ -146,7 +147,7 @@ public class ClientLoading {
|
|||||||
Globals.controlHandler.hintUpdateControlState(ControlHandler.ControlsState.NO_INPUT);
|
Globals.controlHandler.hintUpdateControlState(ControlHandler.ControlsState.NO_INPUT);
|
||||||
|
|
||||||
//init camera
|
//init camera
|
||||||
Globals.playerCamera = CameraEntityUtils.spawnBasicCameraEntity(new Vector3f(0,0,0), new Vector3f(-1,0,0));
|
Globals.playerCamera = CameraEntityUtils.spawnBasicCameraEntity(new Vector3d(0,0,0), new Vector3d(-1,0,0));
|
||||||
Globals.cameraHandler.setTrackPlayerEntity(false);
|
Globals.cameraHandler.setTrackPlayerEntity(false);
|
||||||
Globals.cameraHandler.setUpdate(false);
|
Globals.cameraHandler.setUpdate(false);
|
||||||
//initialize the "real" objects simulation
|
//initialize the "real" objects simulation
|
||||||
|
|||||||
@ -15,7 +15,6 @@ import java.util.LinkedList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.joml.Matrix4d;
|
import org.joml.Matrix4d;
|
||||||
import org.joml.Matrix4f;
|
|
||||||
import org.joml.Quaterniond;
|
import org.joml.Quaterniond;
|
||||||
import org.joml.Vector3d;
|
import org.joml.Vector3d;
|
||||||
import org.joml.Vector3f;
|
import org.joml.Vector3f;
|
||||||
@ -102,7 +101,7 @@ public class AttachUtils {
|
|||||||
Vector3d scaleRaw = new Vector3d();
|
Vector3d scaleRaw = new Vector3d();
|
||||||
Vector3f scale = new Vector3f();
|
Vector3f scale = new Vector3f();
|
||||||
Entity parent;
|
Entity parent;
|
||||||
Matrix4f transform;
|
Matrix4d transform;
|
||||||
//update entities attached to centerpoint + transform of other entities
|
//update entities attached to centerpoint + transform of other entities
|
||||||
for(Entity currentEntity : cell.getScene().getEntitiesWithTag(EntityTags.TRANSFORM_ATTACHED)){
|
for(Entity currentEntity : cell.getScene().getEntitiesWithTag(EntityTags.TRANSFORM_ATTACHED)){
|
||||||
if((parent = (Entity)currentEntity.getData(EntityDataStrings.ATTACH_PARENT))!=null){
|
if((parent = (Entity)currentEntity.getData(EntityDataStrings.ATTACH_PARENT))!=null){
|
||||||
@ -229,7 +228,7 @@ public class AttachUtils {
|
|||||||
Vector3d scaleRaw = new Vector3d();
|
Vector3d scaleRaw = new Vector3d();
|
||||||
Vector3f scale = new Vector3f();
|
Vector3f scale = new Vector3f();
|
||||||
Entity parent;
|
Entity parent;
|
||||||
Matrix4f transform;
|
Matrix4d transform;
|
||||||
//update entities attached to centerpoint + transform of other entities
|
//update entities attached to centerpoint + transform of other entities
|
||||||
for(Entity currentEntity : Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.TRANSFORM_ATTACHED)){
|
for(Entity currentEntity : Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.TRANSFORM_ATTACHED)){
|
||||||
if((parent = (Entity)currentEntity.getData(EntityDataStrings.ATTACH_PARENT))!=null){
|
if((parent = (Entity)currentEntity.getData(EntityDataStrings.ATTACH_PARENT))!=null){
|
||||||
@ -481,7 +480,7 @@ public class AttachUtils {
|
|||||||
* @param toAttach The child entity
|
* @param toAttach The child entity
|
||||||
* @param transform The transform
|
* @param transform The transform
|
||||||
*/
|
*/
|
||||||
public static void clientAttachEntityAtTransform(Entity parent, Entity toAttach, Matrix4f transform){
|
public static void clientAttachEntityAtTransform(Entity parent, Entity toAttach, Matrix4d transform){
|
||||||
Globals.clientSceneWrapper.getScene().registerEntityToTag(toAttach, EntityTags.TRANSFORM_ATTACHED);
|
Globals.clientSceneWrapper.getScene().registerEntityToTag(toAttach, EntityTags.TRANSFORM_ATTACHED);
|
||||||
toAttach.putData(EntityDataStrings.ATTACH_ENTITY_IS_ATTACHED, true);
|
toAttach.putData(EntityDataStrings.ATTACH_ENTITY_IS_ATTACHED, true);
|
||||||
toAttach.putData(EntityDataStrings.ATTACH_PARENT, parent);
|
toAttach.putData(EntityDataStrings.ATTACH_PARENT, parent);
|
||||||
@ -501,7 +500,7 @@ public class AttachUtils {
|
|||||||
* @param toAttach The entity that is attached
|
* @param toAttach The entity that is attached
|
||||||
* @param transform The transform
|
* @param transform The transform
|
||||||
*/
|
*/
|
||||||
public static void updateAttachTransform(Entity toAttach, Matrix4f transform){
|
public static void updateAttachTransform(Entity toAttach, Matrix4d transform){
|
||||||
toAttach.putData(EntityDataStrings.ATTACH_TRANSFORM, transform);
|
toAttach.putData(EntityDataStrings.ATTACH_TRANSFORM, transform);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -710,8 +709,8 @@ public class AttachUtils {
|
|||||||
* @param e The entity
|
* @param e The entity
|
||||||
* @return The transform if it exists, false otherwise
|
* @return The transform if it exists, false otherwise
|
||||||
*/
|
*/
|
||||||
protected static Matrix4f getTransformOffset(Entity e){
|
protected static Matrix4d getTransformOffset(Entity e){
|
||||||
return (Matrix4f)e.getData(EntityDataStrings.ATTACH_TRANSFORM);
|
return (Matrix4d)e.getData(EntityDataStrings.ATTACH_TRANSFORM);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1,7 +1,9 @@
|
|||||||
package electrosphere.entity.state.client.particle;
|
package electrosphere.entity.state.client.particle;
|
||||||
|
|
||||||
import org.joml.AxisAngle4f;
|
import org.joml.AxisAngle4f;
|
||||||
|
import org.joml.Matrix4d;
|
||||||
import org.joml.Matrix4f;
|
import org.joml.Matrix4f;
|
||||||
|
import org.joml.Quaterniond;
|
||||||
import org.joml.Quaternionf;
|
import org.joml.Quaternionf;
|
||||||
import org.joml.Vector3d;
|
import org.joml.Vector3d;
|
||||||
import org.joml.Vector3f;
|
import org.joml.Vector3f;
|
||||||
@ -98,7 +100,7 @@ public class ClientParticleTree implements BehaviorTree {
|
|||||||
public void simulate(float deltaTime){
|
public void simulate(float deltaTime){
|
||||||
InstancedActor instancedActor = InstancedActor.getInstancedActor(parent);
|
InstancedActor instancedActor = InstancedActor.getInstancedActor(parent);
|
||||||
Vector3d position = EntityUtils.getPosition(parent);
|
Vector3d position = EntityUtils.getPosition(parent);
|
||||||
Vector3f cameraPos = CameraEntityUtils.getCameraCenter(Globals.playerCamera);
|
Vector3d cameraPos = CameraEntityUtils.getCameraCenter(Globals.playerCamera);
|
||||||
|
|
||||||
//update position
|
//update position
|
||||||
position.add(velocity);
|
position.add(velocity);
|
||||||
@ -154,10 +156,10 @@ public class ClientParticleTree implements BehaviorTree {
|
|||||||
if(instancedActor != null){
|
if(instancedActor != null){
|
||||||
TextureAtlas particleTextureAtlas = Globals.particleService.getTextureAtlas();
|
TextureAtlas particleTextureAtlas = Globals.particleService.getTextureAtlas();
|
||||||
int textureIndex = particleTextureAtlas.getTextureIndex(this.particleData.getTexture());
|
int textureIndex = particleTextureAtlas.getTextureIndex(this.particleData.getTexture());
|
||||||
instancedActor.setAttribute(Globals.particleService.getModelAttrib(), new Matrix4f().translationRotateScale(
|
instancedActor.setAttribute(Globals.particleService.getModelAttrib(), new Matrix4d().translationRotateScale(
|
||||||
new Vector3f((float)position.x,(float)position.y,(float)position.z).sub(cameraPos.x, cameraPos.y, cameraPos.z),
|
new Vector3d((float)position.x,(float)position.y,(float)position.z).sub(cameraPos.x, cameraPos.y, cameraPos.z),
|
||||||
new Quaternionf(rotation),
|
new Quaterniond(rotation),
|
||||||
scale
|
new Vector3d(scale)
|
||||||
));
|
));
|
||||||
instancedActor.setAttribute(Globals.particleService.getColorAttrib(), currentColor);
|
instancedActor.setAttribute(Globals.particleService.getColorAttrib(), currentColor);
|
||||||
|
|
||||||
|
|||||||
@ -7,7 +7,6 @@ import java.util.Map;
|
|||||||
|
|
||||||
import org.joml.Quaterniond;
|
import org.joml.Quaterniond;
|
||||||
import org.joml.Vector3d;
|
import org.joml.Vector3d;
|
||||||
import org.joml.Vector3f;
|
|
||||||
import org.ode4j.ode.DBody;
|
import org.ode4j.ode.DBody;
|
||||||
import org.ode4j.ode.DGeom;
|
import org.ode4j.ode.DGeom;
|
||||||
|
|
||||||
@ -257,7 +256,7 @@ public class HitboxCollectionState {
|
|||||||
this.body.setPosition(PhysicsUtils.jomlVecToOdeVec(entityPosition));
|
this.body.setPosition(PhysicsUtils.jomlVecToOdeVec(entityPosition));
|
||||||
for(String boneName : this.boneHitboxMap.keySet()){
|
for(String boneName : this.boneHitboxMap.keySet()){
|
||||||
if(EntityUtils.getActor(parent).containsBone(boneName)){
|
if(EntityUtils.getActor(parent).containsBone(boneName)){
|
||||||
Vector3f bonePosition = EntityUtils.getActor(parent).getBonePosition(boneName);
|
Vector3d bonePosition = EntityUtils.getActor(parent).getBonePosition(boneName);
|
||||||
for(HitboxState state : this.boneHitboxMap.get(boneName)){
|
for(HitboxState state : this.boneHitboxMap.get(boneName)){
|
||||||
DGeom geom = this.stateGeomMap.get(state);
|
DGeom geom = this.stateGeomMap.get(state);
|
||||||
HitboxState shapeStatus = this.geomStateMap.get(geom);
|
HitboxState shapeStatus = this.geomStateMap.get(geom);
|
||||||
@ -298,7 +297,7 @@ public class HitboxCollectionState {
|
|||||||
//
|
//
|
||||||
for(String boneName : this.boneHitboxMap.keySet()){
|
for(String boneName : this.boneHitboxMap.keySet()){
|
||||||
if(EntityUtils.getPoseActor(parent).containsBone(boneName)){
|
if(EntityUtils.getPoseActor(parent).containsBone(boneName)){
|
||||||
Vector3f bonePosition = EntityUtils.getPoseActor(parent).getBonePosition(boneName);
|
Vector3d bonePosition = EntityUtils.getPoseActor(parent).getBonePosition(boneName);
|
||||||
//
|
//
|
||||||
for(HitboxState state : this.boneHitboxMap.get(boneName)){
|
for(HitboxState state : this.boneHitboxMap.get(boneName)){
|
||||||
if(state == null){
|
if(state == null){
|
||||||
@ -369,7 +368,7 @@ public class HitboxCollectionState {
|
|||||||
* @param boneName The name of the bone
|
* @param boneName The name of the bone
|
||||||
* @param bonePosition the position of the bone
|
* @param bonePosition the position of the bone
|
||||||
*/
|
*/
|
||||||
private void updateSphereShapePosition(CollisionEngine collisionEngine, String boneName, HitboxState hitboxState, Vector3f bonePosition){
|
private void updateSphereShapePosition(CollisionEngine collisionEngine, String boneName, HitboxState hitboxState, Vector3d bonePosition){
|
||||||
DGeom geom = this.stateGeomMap.get(hitboxState);
|
DGeom geom = this.stateGeomMap.get(hitboxState);
|
||||||
|
|
||||||
//get offset's transform
|
//get offset's transform
|
||||||
@ -401,7 +400,7 @@ public class HitboxCollectionState {
|
|||||||
* @param boneName
|
* @param boneName
|
||||||
* @param bonePosition
|
* @param bonePosition
|
||||||
*/
|
*/
|
||||||
private void updateCapsuleShapePosition(CollisionEngine collisionEngine, String boneName, HitboxState hitboxState, Vector3f bonePosition){
|
private void updateCapsuleShapePosition(CollisionEngine collisionEngine, String boneName, HitboxState hitboxState, Vector3d bonePosition){
|
||||||
|
|
||||||
//get data about the hitbox
|
//get data about the hitbox
|
||||||
DGeom geom = this.stateGeomMap.get(hitboxState);
|
DGeom geom = this.stateGeomMap.get(hitboxState);
|
||||||
|
|||||||
@ -7,13 +7,11 @@ import java.util.Map;
|
|||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import org.joml.Matrix4d;
|
import org.joml.Matrix4d;
|
||||||
import org.joml.Matrix4f;
|
|
||||||
import org.joml.Quaterniond;
|
import org.joml.Quaterniond;
|
||||||
import org.joml.Quaternionf;
|
import org.joml.Quaternionf;
|
||||||
import org.joml.Vector3d;
|
import org.joml.Vector3d;
|
||||||
import org.joml.Vector3f;
|
import org.joml.Vector3f;
|
||||||
import org.joml.Vector4d;
|
import org.joml.Vector4d;
|
||||||
import org.joml.Vector4f;
|
|
||||||
import org.ode4j.ode.DBody;
|
import org.ode4j.ode.DBody;
|
||||||
|
|
||||||
import electrosphere.client.entity.instance.InstanceTemplate;
|
import electrosphere.client.entity.instance.InstanceTemplate;
|
||||||
@ -121,8 +119,8 @@ public class ProceduralTree {
|
|||||||
*/
|
*/
|
||||||
public static void setProceduralActor(Entity trunkChild, TreeModel treeModel, Random treeRandom){
|
public static void setProceduralActor(Entity trunkChild, TreeModel treeModel, Random treeRandom){
|
||||||
InstancedActor instancedActor = InstancedEntityUtils.makeEntityInstancedWithModelTransform(trunkChild, branchInstanceTemplate, modelMatrixAttribute);
|
InstancedActor instancedActor = InstancedEntityUtils.makeEntityInstancedWithModelTransform(trunkChild, branchInstanceTemplate, modelMatrixAttribute);
|
||||||
instancedActor.setAttribute(boneMatrixAttribute, new Matrix4f().identity());
|
instancedActor.setAttribute(boneMatrixAttribute, new Matrix4d().identity());
|
||||||
instancedActor.setAttribute(modelMatrixAttribute, new Matrix4f().identity());
|
instancedActor.setAttribute(modelMatrixAttribute, new Matrix4d().identity());
|
||||||
instancedActor.setAttribute(baseSizeAttribute, 1.0f);
|
instancedActor.setAttribute(baseSizeAttribute, 1.0f);
|
||||||
|
|
||||||
//attach physics
|
//attach physics
|
||||||
@ -205,7 +203,7 @@ public class ProceduralTree {
|
|||||||
|
|
||||||
//calculate transform from parent entity
|
//calculate transform from parent entity
|
||||||
//this is the transform that will be applied every time the attachutils updates
|
//this is the transform that will be applied every time the attachutils updates
|
||||||
Matrix4f transformFromParent = new Matrix4f()
|
Matrix4d transformFromParent = new Matrix4d()
|
||||||
.translate(new Vector3f(
|
.translate(new Vector3f(
|
||||||
(float)segment.offsetFromParent.x,
|
(float)segment.offsetFromParent.x,
|
||||||
(float)segment.offsetFromParent.y,
|
(float)segment.offsetFromParent.y,
|
||||||
@ -219,7 +217,7 @@ public class ProceduralTree {
|
|||||||
));
|
));
|
||||||
|
|
||||||
//calculate combined transform
|
//calculate combined transform
|
||||||
Matrix4f combinedTransform = new Matrix4f().translate(new Vector3f(
|
Matrix4d combinedTransform = new Matrix4d().translate(new Vector3f(
|
||||||
(float)segment.parentPosition.x,
|
(float)segment.parentPosition.x,
|
||||||
(float)segment.parentPosition.y,
|
(float)segment.parentPosition.y,
|
||||||
(float)segment.parentPosition.z
|
(float)segment.parentPosition.z
|
||||||
@ -238,7 +236,7 @@ public class ProceduralTree {
|
|||||||
|
|
||||||
//calculate current branch's stuff
|
//calculate current branch's stuff
|
||||||
//get current position
|
//get current position
|
||||||
Vector4f currentPositionf = combinedTransform.transform(new Vector4f(
|
Vector4d currentPositionf = combinedTransform.transform(new Vector4d(
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
@ -253,12 +251,12 @@ public class ProceduralTree {
|
|||||||
Quaternionf boneRotation = new Quaternionf(0,0,0,1);
|
Quaternionf boneRotation = new Quaternionf(0,0,0,1);
|
||||||
|
|
||||||
//calculates the bone transform matrix
|
//calculates the bone transform matrix
|
||||||
Matrix4f boneTransform = new Matrix4f().identity().rotate(boneRotation);
|
Matrix4d boneTransform = new Matrix4d().identity().rotate(boneRotation);
|
||||||
|
|
||||||
//new position transform
|
//new position transform
|
||||||
Matrix4f newPositionTransform = new Matrix4f().rotate(boneRotation).translate(0,type.getBranchHeight(),0);
|
Matrix4d newPositionTransform = new Matrix4d().rotate(boneRotation).translate(0,type.getBranchHeight(),0);
|
||||||
|
|
||||||
Vector4f newPositionRaw = newPositionTransform.transform(new Vector4f(0,0,0,1));
|
Vector4d newPositionRaw = newPositionTransform.transform(new Vector4d(0,0,0,1));
|
||||||
Vector3d newPosition = new Vector3d(newPositionRaw.x,newPositionRaw.y,newPositionRaw.z);
|
Vector3d newPosition = new Vector3d(newPositionRaw.x,newPositionRaw.y,newPositionRaw.z);
|
||||||
|
|
||||||
//get new scalar
|
//get new scalar
|
||||||
@ -270,7 +268,7 @@ public class ProceduralTree {
|
|||||||
InstancedActor instancedActor = InstancedEntityUtils.makeEntityInstancedWithModelTransform(trunkSegment, branchInstanceTemplate, modelMatrixAttribute);
|
InstancedActor instancedActor = InstancedEntityUtils.makeEntityInstancedWithModelTransform(trunkSegment, branchInstanceTemplate, modelMatrixAttribute);
|
||||||
instancedActor.setAttribute(boneMatrixAttribute, boneTransform.scale(newScalar,1,newScalar));
|
instancedActor.setAttribute(boneMatrixAttribute, boneTransform.scale(newScalar,1,newScalar));
|
||||||
instancedActor.setAttribute(baseSizeAttribute, segment.scalar);
|
instancedActor.setAttribute(baseSizeAttribute, segment.scalar);
|
||||||
instancedActor.setAttribute(modelMatrixAttribute, new Matrix4f().identity());
|
instancedActor.setAttribute(modelMatrixAttribute, new Matrix4d().identity());
|
||||||
|
|
||||||
//set entity stuuff
|
//set entity stuuff
|
||||||
EntityUtils.getPosition(trunkSegment).set(currentPosition);
|
EntityUtils.getPosition(trunkSegment).set(currentPosition);
|
||||||
@ -350,7 +348,7 @@ public class ProceduralTree {
|
|||||||
|
|
||||||
//calculate transform from parent entity
|
//calculate transform from parent entity
|
||||||
//this is the transform that will be applied every time the attachutils updates
|
//this is the transform that will be applied every time the attachutils updates
|
||||||
Matrix4f transformFromParent = new Matrix4f()
|
Matrix4d transformFromParent = new Matrix4d()
|
||||||
.translate(new Vector3f(
|
.translate(new Vector3f(
|
||||||
(float)segment.offsetFromParent.x,
|
(float)segment.offsetFromParent.x,
|
||||||
(float)segment.offsetFromParent.y,
|
(float)segment.offsetFromParent.y,
|
||||||
@ -364,7 +362,7 @@ public class ProceduralTree {
|
|||||||
));
|
));
|
||||||
|
|
||||||
//calculate combined transform
|
//calculate combined transform
|
||||||
Matrix4f combinedTransform = new Matrix4f().translate(new Vector3f(
|
Matrix4d combinedTransform = new Matrix4d().translate(new Vector3f(
|
||||||
(float)segment.parentPosition.x,
|
(float)segment.parentPosition.x,
|
||||||
(float)segment.parentPosition.y,
|
(float)segment.parentPosition.y,
|
||||||
(float)segment.parentPosition.z
|
(float)segment.parentPosition.z
|
||||||
@ -383,7 +381,7 @@ public class ProceduralTree {
|
|||||||
|
|
||||||
//calculate current branch's stuff
|
//calculate current branch's stuff
|
||||||
//get current position
|
//get current position
|
||||||
Vector4f currentPositionf = combinedTransform.transform(new Vector4f(
|
Vector4d currentPositionf = combinedTransform.transform(new Vector4d(
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
@ -415,12 +413,12 @@ public class ProceduralTree {
|
|||||||
|
|
||||||
|
|
||||||
//calculates the bone transform matrix
|
//calculates the bone transform matrix
|
||||||
Matrix4f boneTransform = new Matrix4f().identity().rotate(boneRotation);
|
Matrix4d boneTransform = new Matrix4d().identity().rotate(boneRotation);
|
||||||
|
|
||||||
//new position transform
|
//new position transform
|
||||||
Matrix4f newPositionTransform = new Matrix4f().rotate(boneRotation).translate(0,treeSegmentHeight,0);
|
Matrix4d newPositionTransform = new Matrix4d().rotate(boneRotation).translate(0,treeSegmentHeight,0);
|
||||||
|
|
||||||
Vector4f newPositionRaw = newPositionTransform.transform(new Vector4f(0,0,0,1));
|
Vector4d newPositionRaw = newPositionTransform.transform(new Vector4d(0,0,0,1));
|
||||||
Vector3d newPosition = new Vector3d(newPositionRaw.x,newPositionRaw.y,newPositionRaw.z);
|
Vector3d newPosition = new Vector3d(newPositionRaw.x,newPositionRaw.y,newPositionRaw.z);
|
||||||
|
|
||||||
//get new scalar
|
//get new scalar
|
||||||
@ -437,7 +435,7 @@ public class ProceduralTree {
|
|||||||
InstancedActor instancedActor = InstancedEntityUtils.makeEntityInstancedWithModelTransform(branch, branchInstanceTemplate, modelMatrixAttribute);
|
InstancedActor instancedActor = InstancedEntityUtils.makeEntityInstancedWithModelTransform(branch, branchInstanceTemplate, modelMatrixAttribute);
|
||||||
instancedActor.setAttribute(boneMatrixAttribute, boneTransform.scale(newScalar,1,newScalar));
|
instancedActor.setAttribute(boneMatrixAttribute, boneTransform.scale(newScalar,1,newScalar));
|
||||||
instancedActor.setAttribute(baseSizeAttribute, segment.scalar);
|
instancedActor.setAttribute(baseSizeAttribute, segment.scalar);
|
||||||
instancedActor.setAttribute(modelMatrixAttribute, new Matrix4f().identity());
|
instancedActor.setAttribute(modelMatrixAttribute, new Matrix4d().identity());
|
||||||
|
|
||||||
//set entity stuuff
|
//set entity stuuff
|
||||||
EntityUtils.getPosition(branch).set(currentPosition);
|
EntityUtils.getPosition(branch).set(currentPosition);
|
||||||
@ -831,7 +829,7 @@ public class ProceduralTree {
|
|||||||
|
|
||||||
//calculate transform from parent entity
|
//calculate transform from parent entity
|
||||||
//this is the transform that will be applied every time the attachutils updates
|
//this is the transform that will be applied every time the attachutils updates
|
||||||
Matrix4f transformFromParent = new Matrix4f()
|
Matrix4d transformFromParent = new Matrix4d()
|
||||||
.translate(new Vector3f(
|
.translate(new Vector3f(
|
||||||
(float)transformedPos.x,
|
(float)transformedPos.x,
|
||||||
(float)transformedPos.y,
|
(float)transformedPos.y,
|
||||||
@ -848,7 +846,7 @@ public class ProceduralTree {
|
|||||||
//create entity
|
//create entity
|
||||||
Entity leaf = EntityCreationUtils.createClientSpatialEntity();
|
Entity leaf = EntityCreationUtils.createClientSpatialEntity();
|
||||||
InstancedActor leafInstancedActor = InstancedEntityUtils.makeEntityInstancedWithModelTransform(leaf, leafInstanceTemplate, modelMatrixAttribute);
|
InstancedActor leafInstancedActor = InstancedEntityUtils.makeEntityInstancedWithModelTransform(leaf, leafInstanceTemplate, modelMatrixAttribute);
|
||||||
leafInstancedActor.setAttribute(modelMatrixAttribute, new Matrix4f().identity());
|
leafInstancedActor.setAttribute(modelMatrixAttribute, new Matrix4d().identity());
|
||||||
leafInstancedActor.setAttribute(leafColorAttribute, new Vector3f(36/255.0f,173/255.0f,31/255.0f));
|
leafInstancedActor.setAttribute(leafColorAttribute, new Vector3f(36/255.0f,173/255.0f,31/255.0f));
|
||||||
|
|
||||||
//set entity stuuff
|
//set entity stuuff
|
||||||
@ -1129,13 +1127,13 @@ public class ProceduralTree {
|
|||||||
|
|
||||||
|
|
||||||
//calculates the bone transform matrix
|
//calculates the bone transform matrix
|
||||||
Matrix4f boneTransform = new Matrix4f().identity().rotate(boneRotation);
|
Matrix4d boneTransform = new Matrix4d().identity().rotate(boneRotation);
|
||||||
|
|
||||||
//new position transform
|
//new position transform
|
||||||
Matrix4f newPositionTransform = new Matrix4f().rotate(boneRotation).translate(0,type.getBranchHeight(),0);
|
Matrix4d newPositionTransform = new Matrix4d().rotate(boneRotation).translate(0,type.getBranchHeight(),0);
|
||||||
Vector4f newPositionRaw = newPositionTransform.transform(new Vector4f(0,0,0,1));
|
Vector4d newPositionRaw = newPositionTransform.transform(new Vector4d(0,0,0,1));
|
||||||
|
|
||||||
Matrix4f transformFromParent = new Matrix4f()
|
Matrix4d transformFromParent = new Matrix4d()
|
||||||
.translate(new Vector3f(
|
.translate(new Vector3f(
|
||||||
(float)newPositionRaw.x,
|
(float)newPositionRaw.x,
|
||||||
(float)newPositionRaw.y,
|
(float)newPositionRaw.y,
|
||||||
@ -1151,7 +1149,7 @@ public class ProceduralTree {
|
|||||||
|
|
||||||
//update branch actor branch matrix
|
//update branch actor branch matrix
|
||||||
InstancedActor branchActor = InstancedActor.getInstancedActor(branch);
|
InstancedActor branchActor = InstancedActor.getInstancedActor(branch);
|
||||||
branchActor.setAttribute(boneMatrixAttribute, new Matrix4f(transformFromParent).scale((float)currentScalar,1,(float)currentScalar));
|
branchActor.setAttribute(boneMatrixAttribute, new Matrix4d(transformFromParent).scale((float)currentScalar,1,(float)currentScalar));
|
||||||
|
|
||||||
//update children positions
|
//update children positions
|
||||||
for(Entity child : children){
|
for(Entity child : children){
|
||||||
|
|||||||
@ -167,10 +167,10 @@ public class RenderPipelineState {
|
|||||||
* @param projectionMatrix the projection matrix
|
* @param projectionMatrix the projection matrix
|
||||||
* @param viewMatrix the view matrix
|
* @param viewMatrix the view matrix
|
||||||
*/
|
*/
|
||||||
public void updateFrustumIntersection(Matrix4d projectionMatrix, Matrix4f viewMatrix){
|
public void updateFrustumIntersection(Matrix4d projectionMatrix, Matrix4d viewMatrix){
|
||||||
Matrix4f projectionViewMatrix = new Matrix4f();
|
Matrix4f projectionViewMatrix = new Matrix4f();
|
||||||
projectionViewMatrix.set(projectionMatrix);
|
projectionViewMatrix.set(projectionMatrix);
|
||||||
projectionViewMatrix.mul(viewMatrix);
|
projectionViewMatrix.mul(new Matrix4f(viewMatrix));
|
||||||
this.frustumInt.set(projectionViewMatrix);
|
this.frustumInt.set(projectionViewMatrix);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -11,8 +11,7 @@ import static org.lwjgl.system.MemoryUtil.NULL;
|
|||||||
import java.nio.IntBuffer;
|
import java.nio.IntBuffer;
|
||||||
|
|
||||||
import org.joml.Matrix4d;
|
import org.joml.Matrix4d;
|
||||||
import org.joml.Matrix4f;
|
import org.joml.Vector3d;
|
||||||
import org.joml.Vector3f;
|
|
||||||
import org.lwjgl.BufferUtils;
|
import org.lwjgl.BufferUtils;
|
||||||
import org.lwjgl.glfw.GLFW;
|
import org.lwjgl.glfw.GLFW;
|
||||||
import org.lwjgl.glfw.GLFWErrorCallback;
|
import org.lwjgl.glfw.GLFWErrorCallback;
|
||||||
@ -97,9 +96,9 @@ public class RenderingEngine {
|
|||||||
/*
|
/*
|
||||||
Perspective volumetrics
|
Perspective volumetrics
|
||||||
*/
|
*/
|
||||||
public static Matrix4f nearVolumeProjectionMatrix = new Matrix4f();
|
public static Matrix4d nearVolumeProjectionMatrix = new Matrix4d();
|
||||||
public static Matrix4f midVolumeProjectionMatrix = new Matrix4f();
|
public static Matrix4d midVolumeProjectionMatrix = new Matrix4d();
|
||||||
public static Matrix4f farVolumeProjectionMatrix = new Matrix4f();
|
public static Matrix4d farVolumeProjectionMatrix = new Matrix4d();
|
||||||
public static VisualShader volumeDepthShaderProgram;
|
public static VisualShader volumeDepthShaderProgram;
|
||||||
public static Framebuffer volumeDepthBackfaceFramebuffer;
|
public static Framebuffer volumeDepthBackfaceFramebuffer;
|
||||||
public static Texture volumeDepthBackfaceTexture;
|
public static Texture volumeDepthBackfaceTexture;
|
||||||
@ -454,12 +453,12 @@ public class RenderingEngine {
|
|||||||
// Projection and View matrix creation
|
// Projection and View matrix creation
|
||||||
//
|
//
|
||||||
Globals.projectionMatrix = new Matrix4d();
|
Globals.projectionMatrix = new Matrix4d();
|
||||||
Globals.viewMatrix = new Matrix4f();
|
Globals.viewMatrix = new Matrix4d();
|
||||||
verticalFOV = (float)(Globals.verticalFOV * Math.PI /180.0f);
|
verticalFOV = (float)(Globals.verticalFOV * Math.PI /180.0f);
|
||||||
//set local aspect ratio and global aspect ratio at the same time
|
//set local aspect ratio and global aspect ratio at the same time
|
||||||
aspectRatio = Globals.aspectRatio = Globals.WINDOW_WIDTH / (float)Globals.WINDOW_HEIGHT;
|
aspectRatio = Globals.aspectRatio = Globals.WINDOW_WIDTH / (float)Globals.WINDOW_HEIGHT;
|
||||||
Globals.projectionMatrix.setPerspective(verticalFOV, Globals.aspectRatio, Globals.nearClip, Globals.userSettings.getGraphicsViewDistance());
|
Globals.projectionMatrix.setPerspective(verticalFOV, Globals.aspectRatio, Globals.nearClip, Globals.userSettings.getGraphicsViewDistance());
|
||||||
Globals.viewMatrix.translation(new Vector3f(0.0f,0.0f,-3.0f));
|
Globals.viewMatrix.translation(new Vector3d(0.0f,0.0f,-3.0f));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Alert everyone that the rendering engine is ready
|
* Alert everyone that the rendering engine is ready
|
||||||
|
|||||||
@ -18,13 +18,10 @@ import java.util.Map;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
|
|
||||||
import org.joml.AxisAngle4f;
|
|
||||||
import org.joml.Matrix4d;
|
import org.joml.Matrix4d;
|
||||||
import org.joml.Matrix4f;
|
|
||||||
import org.joml.Quaterniond;
|
import org.joml.Quaterniond;
|
||||||
import org.joml.Sphered;
|
import org.joml.Sphered;
|
||||||
import org.joml.Vector3d;
|
import org.joml.Vector3d;
|
||||||
import org.joml.Vector3f;
|
|
||||||
import org.joml.Vector4d;
|
import org.joml.Vector4d;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -464,11 +461,11 @@ public class Actor {
|
|||||||
/**
|
/**
|
||||||
* Gets the position of a bone in local space
|
* Gets the position of a bone in local space
|
||||||
* @param boneName The name of the bone
|
* @param boneName The name of the bone
|
||||||
* @return The vector3f containing the position of the bone, or a vector of (0,0,0) if the model lookup fails
|
* @return The vector3d containing the position of the bone, or a vector of (0,0,0) if the model lookup fails
|
||||||
* //TODO: refactor to make failure more transparent (both for model not existing and bone not existing)
|
* //TODO: refactor to make failure more transparent (both for model not existing and bone not existing)
|
||||||
*/
|
*/
|
||||||
public Vector3f getBonePosition(String boneName){
|
public Vector3d getBonePosition(String boneName){
|
||||||
Vector3f rVal = new Vector3f();
|
Vector3d rVal = new Vector3d();
|
||||||
Model model = Globals.assetManager.fetchModel(modelPath);
|
Model model = Globals.assetManager.fetchModel(modelPath);
|
||||||
if(model != null){
|
if(model != null){
|
||||||
applyAnimationMasks(model);
|
applyAnimationMasks(model);
|
||||||
@ -504,9 +501,7 @@ public class Actor {
|
|||||||
calculateNodeTransforms(model);
|
calculateNodeTransforms(model);
|
||||||
Bone currentBone = model.getBoneMap().get(boneName);
|
Bone currentBone = model.getBoneMap().get(boneName);
|
||||||
if(currentBone != null){
|
if(currentBone != null){
|
||||||
AxisAngle4f axisAngle = new AxisAngle4f();
|
Quaterniond rotation = new Matrix4d(currentBone.getFinalTransform()).getNormalizedRotation(new Quaterniond());
|
||||||
new Matrix4f(currentBone.getFinalTransform()).getRotation(axisAngle);
|
|
||||||
Quaterniond rotation = new Quaterniond(axisAngle);
|
|
||||||
rVal.set(rotation);
|
rVal.set(rotation);
|
||||||
} else {
|
} else {
|
||||||
String message = "Trying to get rotation of bone that does not exist on model!\n" +
|
String message = "Trying to get rotation of bone that does not exist on model!\n" +
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import java.util.HashMap;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.joml.Matrix4d;
|
import org.joml.Matrix4d;
|
||||||
|
import org.joml.Vector3d;
|
||||||
import org.joml.Vector3f;
|
import org.joml.Vector3f;
|
||||||
import org.joml.Vector3i;
|
import org.joml.Vector3i;
|
||||||
|
|
||||||
@ -238,10 +239,10 @@ public class LightManager {
|
|||||||
}
|
}
|
||||||
//
|
//
|
||||||
//position
|
//position
|
||||||
Vector3f modifiedCameraPos = new Vector3f(light.getPosition()).sub(CameraEntityUtils.getCameraCenter(camera));
|
Vector3d modifiedCameraPos = new Vector3d(light.getPosition()).sub(CameraEntityUtils.getCameraCenter(camera));
|
||||||
pointLightBuffer.putFloat(modifiedCameraPos.x);
|
pointLightBuffer.putFloat((float)modifiedCameraPos.x);
|
||||||
pointLightBuffer.putFloat(modifiedCameraPos.y);
|
pointLightBuffer.putFloat((float)modifiedCameraPos.y);
|
||||||
pointLightBuffer.putFloat(modifiedCameraPos.z);
|
pointLightBuffer.putFloat((float)modifiedCameraPos.z);
|
||||||
pointLightBuffer.putFloat(1);
|
pointLightBuffer.putFloat(1);
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@ -41,7 +41,6 @@ import static org.lwjgl.opengl.GL20.glEnableVertexAttribArray;
|
|||||||
import static org.lwjgl.opengl.GL20.glGetUniformLocation;
|
import static org.lwjgl.opengl.GL20.glGetUniformLocation;
|
||||||
import static org.lwjgl.opengl.GL20.glUniform1i;
|
import static org.lwjgl.opengl.GL20.glUniform1i;
|
||||||
import static org.lwjgl.opengl.GL20.glUniform3fv;
|
import static org.lwjgl.opengl.GL20.glUniform3fv;
|
||||||
import static org.lwjgl.opengl.GL20.glUniformMatrix4fv;
|
|
||||||
import static org.lwjgl.opengl.GL20.glVertexAttribPointer;
|
import static org.lwjgl.opengl.GL20.glVertexAttribPointer;
|
||||||
import static org.lwjgl.opengl.GL30.glBindVertexArray;
|
import static org.lwjgl.opengl.GL30.glBindVertexArray;
|
||||||
import static org.lwjgl.opengl.GL30.glGenVertexArrays;
|
import static org.lwjgl.opengl.GL30.glGenVertexArrays;
|
||||||
@ -319,8 +318,11 @@ public class Mesh {
|
|||||||
for(String key : uniforms.keySet()){
|
for(String key : uniforms.keySet()){
|
||||||
Object currentUniformRaw = uniforms.get(key);
|
Object currentUniformRaw = uniforms.get(key);
|
||||||
if(currentUniformRaw instanceof Matrix4f){
|
if(currentUniformRaw instanceof Matrix4f){
|
||||||
Matrix4f currentUniform = (Matrix4f)currentUniformRaw;
|
throw new Error("Unsupported data type!");
|
||||||
glUniformMatrix4fv(glGetUniformLocation(openGLState.getActiveShader().getId(), key), false, currentUniform.get(new float[16]));
|
}
|
||||||
|
if(currentUniformRaw instanceof Matrix4d){
|
||||||
|
Matrix4d currentUniform = (Matrix4d)currentUniformRaw;
|
||||||
|
GL40.glUniformMatrix4dv(glGetUniformLocation(openGLState.getActiveShader().getId(), key), false, currentUniform.get(new double[16]));
|
||||||
Globals.renderingEngine.checkError();
|
Globals.renderingEngine.checkError();
|
||||||
}
|
}
|
||||||
if(currentUniformRaw instanceof Vector3f){
|
if(currentUniformRaw instanceof Vector3f){
|
||||||
@ -460,7 +462,7 @@ public class Mesh {
|
|||||||
Matrix4d currentMat = currentBone.getFinalTransform();
|
Matrix4d currentMat = currentBone.getFinalTransform();
|
||||||
openGLState.getActiveShader().setUniform(openGLState, currentUniform, currentMat);
|
openGLState.getActiveShader().setUniform(openGLState, currentUniform, currentMat);
|
||||||
} else {
|
} else {
|
||||||
openGLState.getActiveShader().setUniform(openGLState, currentUniform, new Matrix4f());
|
openGLState.getActiveShader().setUniform(openGLState, currentUniform, new Matrix4d());
|
||||||
}
|
}
|
||||||
incrementer++;
|
incrementer++;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,7 +3,6 @@ package electrosphere.renderer.pipelines;
|
|||||||
import org.joml.Matrix4d;
|
import org.joml.Matrix4d;
|
||||||
import org.joml.Quaterniond;
|
import org.joml.Quaterniond;
|
||||||
import org.joml.Vector3d;
|
import org.joml.Vector3d;
|
||||||
import org.joml.Vector3f;
|
|
||||||
import org.joml.Vector4d;
|
import org.joml.Vector4d;
|
||||||
import org.lwjgl.opengl.GL40;
|
import org.lwjgl.opengl.GL40;
|
||||||
|
|
||||||
@ -55,8 +54,8 @@ public class FirstPersonItemsPipeline implements RenderPipeline {
|
|||||||
{
|
{
|
||||||
Vector3d position = EntityUtils.getPosition(Globals.firstPersonEntity);
|
Vector3d position = EntityUtils.getPosition(Globals.firstPersonEntity);
|
||||||
Actor actor = EntityUtils.getActor(Globals.firstPersonEntity);
|
Actor actor = EntityUtils.getActor(Globals.firstPersonEntity);
|
||||||
//calculate camera-modified vector3f
|
//calculate camera-modified vector3d
|
||||||
Vector3f cameraModifiedPosition = new Vector3f((float)position.x,(float)position.y,(float)position.z).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
Vector3d cameraModifiedPosition = new Vector3d(position).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
||||||
//calculate and apply model transform
|
//calculate and apply model transform
|
||||||
modelTransformMatrix.identity();
|
modelTransformMatrix.identity();
|
||||||
modelTransformMatrix.translate(cameraModifiedPosition);
|
modelTransformMatrix.translate(cameraModifiedPosition);
|
||||||
@ -72,8 +71,8 @@ public class FirstPersonItemsPipeline implements RenderPipeline {
|
|||||||
for(Entity child : AttachUtils.getChildrenList(Globals.firstPersonEntity)){
|
for(Entity child : AttachUtils.getChildrenList(Globals.firstPersonEntity)){
|
||||||
Vector3d position = EntityUtils.getPosition(child);
|
Vector3d position = EntityUtils.getPosition(child);
|
||||||
Actor actor = EntityUtils.getActor(child);
|
Actor actor = EntityUtils.getActor(child);
|
||||||
//calculate camera-modified vector3f
|
//calculate camera-modified vector3d
|
||||||
Vector3f cameraModifiedPosition = new Vector3f((float)position.x,(float)position.y,(float)position.z).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
Vector3d cameraModifiedPosition = new Vector3d(position).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
||||||
//calculate and apply model transform
|
//calculate and apply model transform
|
||||||
modelTransformMatrix.identity();
|
modelTransformMatrix.identity();
|
||||||
modelTransformMatrix.translate(cameraModifiedPosition);
|
modelTransformMatrix.translate(cameraModifiedPosition);
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
package electrosphere.renderer.pipelines;
|
package electrosphere.renderer.pipelines;
|
||||||
|
|
||||||
import org.joml.Vector3d;
|
import org.joml.Vector3d;
|
||||||
import org.joml.Vector3f;
|
|
||||||
import org.lwjgl.opengl.GL40;
|
import org.lwjgl.opengl.GL40;
|
||||||
|
|
||||||
import electrosphere.client.entity.camera.CameraEntityUtils;
|
import electrosphere.client.entity.camera.CameraEntityUtils;
|
||||||
@ -65,8 +64,8 @@ public class MainContentNoOITPipeline implements RenderPipeline {
|
|||||||
){
|
){
|
||||||
//fetch actor
|
//fetch actor
|
||||||
Actor currentActor = EntityUtils.getActor(currentEntity);
|
Actor currentActor = EntityUtils.getActor(currentEntity);
|
||||||
//calculate camera-modified vector3f
|
//calculate camera-modified vector3d
|
||||||
Vector3f cameraModifiedPosition = new Vector3f((float)position.x,(float)position.y,(float)position.z).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
Vector3d cameraModifiedPosition = new Vector3d(position).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
||||||
//calculate and apply model transform
|
//calculate and apply model transform
|
||||||
RenderingEngine.modelTransformMatrix.identity();
|
RenderingEngine.modelTransformMatrix.identity();
|
||||||
RenderingEngine.modelTransformMatrix.translate(cameraModifiedPosition);
|
RenderingEngine.modelTransformMatrix.translate(cameraModifiedPosition);
|
||||||
|
|||||||
@ -1,11 +1,8 @@
|
|||||||
package electrosphere.renderer.pipelines;
|
package electrosphere.renderer.pipelines;
|
||||||
|
|
||||||
import org.joml.Matrix4d;
|
import org.joml.Matrix4d;
|
||||||
import org.joml.Matrix4f;
|
|
||||||
import org.joml.Quaterniond;
|
import org.joml.Quaterniond;
|
||||||
import org.joml.Quaternionf;
|
|
||||||
import org.joml.Vector3d;
|
import org.joml.Vector3d;
|
||||||
import org.joml.Vector3f;
|
|
||||||
import org.lwjgl.opengl.GL40;
|
import org.lwjgl.opengl.GL40;
|
||||||
|
|
||||||
import electrosphere.client.entity.camera.CameraEntityUtils;
|
import electrosphere.client.entity.camera.CameraEntityUtils;
|
||||||
@ -77,8 +74,8 @@ public class MainContentPipeline implements RenderPipeline {
|
|||||||
if(shouldDrawSolidPass(currentEntity)){
|
if(shouldDrawSolidPass(currentEntity)){
|
||||||
//fetch actor
|
//fetch actor
|
||||||
Actor currentActor = EntityUtils.getActor(currentEntity);
|
Actor currentActor = EntityUtils.getActor(currentEntity);
|
||||||
//calculate camera-modified vector3f
|
//calculate camera-modified vector3d
|
||||||
Vector3f cameraModifiedPosition = new Vector3f((float)position.x,(float)position.y,(float)position.z).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
Vector3d cameraModifiedPosition = new Vector3d(position).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
||||||
//calculate and apply model transform
|
//calculate and apply model transform
|
||||||
modelTransformMatrix.identity();
|
modelTransformMatrix.identity();
|
||||||
modelTransformMatrix.translate(cameraModifiedPosition);
|
modelTransformMatrix.translate(cameraModifiedPosition);
|
||||||
@ -99,16 +96,16 @@ public class MainContentPipeline implements RenderPipeline {
|
|||||||
if(InstancedActor.getInstanceModelAttribute(currentEntity) != null){
|
if(InstancedActor.getInstanceModelAttribute(currentEntity) != null){
|
||||||
ShaderAttribute modelAttribute = InstancedActor.getInstanceModelAttribute(currentEntity);
|
ShaderAttribute modelAttribute = InstancedActor.getInstanceModelAttribute(currentEntity);
|
||||||
//calculate model matrix
|
//calculate model matrix
|
||||||
Vector3f cameraModifiedPosition = new Vector3f((float)position.x,(float)position.y,(float)position.z).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
Vector3d cameraModifiedPosition = new Vector3d(position).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
||||||
Quaterniond rotation = EntityUtils.getRotation(currentEntity);
|
Quaterniond rotation = EntityUtils.getRotation(currentEntity);
|
||||||
// modelTransformMatrix.identity();
|
// modelTransformMatrix.identity();
|
||||||
modelTransformMatrix.identity().translationRotateScale(
|
modelTransformMatrix.identity().translationRotateScale(
|
||||||
cameraModifiedPosition,
|
cameraModifiedPosition,
|
||||||
new Quaternionf((float)rotation.x,(float)rotation.y,(float)rotation.z,(float)rotation.w),
|
new Quaterniond(rotation),
|
||||||
new Vector3f(EntityUtils.getScale(currentEntity))
|
new Vector3d(EntityUtils.getScale(currentEntity))
|
||||||
);
|
);
|
||||||
//set actor value
|
//set actor value
|
||||||
currentActor.setAttribute(modelAttribute, new Matrix4f(modelTransformMatrix));
|
currentActor.setAttribute(modelAttribute, new Matrix4d(modelTransformMatrix));
|
||||||
//draw
|
//draw
|
||||||
currentActor.draw(renderPipelineState, new Vector3d(cameraModifiedPosition));
|
currentActor.draw(renderPipelineState, new Vector3d(cameraModifiedPosition));
|
||||||
} else {
|
} else {
|
||||||
@ -158,8 +155,8 @@ public class MainContentPipeline implements RenderPipeline {
|
|||||||
if(shouldDrawTransparentPass(currentEntity)){
|
if(shouldDrawTransparentPass(currentEntity)){
|
||||||
//fetch actor
|
//fetch actor
|
||||||
Actor currentActor = EntityUtils.getActor(currentEntity);
|
Actor currentActor = EntityUtils.getActor(currentEntity);
|
||||||
//calculate camera-modified vector3f
|
//calculate camera-modified vector3d
|
||||||
Vector3f cameraModifiedPosition = new Vector3f((float)position.x,(float)position.y,(float)position.z).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
Vector3d cameraModifiedPosition = new Vector3d(position).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
||||||
//calculate and apply model transform
|
//calculate and apply model transform
|
||||||
modelTransformMatrix.identity();
|
modelTransformMatrix.identity();
|
||||||
modelTransformMatrix.translate(cameraModifiedPosition);
|
modelTransformMatrix.translate(cameraModifiedPosition);
|
||||||
@ -179,16 +176,16 @@ public class MainContentPipeline implements RenderPipeline {
|
|||||||
if(InstancedActor.getInstanceModelAttribute(currentEntity) != null){
|
if(InstancedActor.getInstanceModelAttribute(currentEntity) != null){
|
||||||
ShaderAttribute modelAttribute = InstancedActor.getInstanceModelAttribute(currentEntity);
|
ShaderAttribute modelAttribute = InstancedActor.getInstanceModelAttribute(currentEntity);
|
||||||
//calculate model matrix
|
//calculate model matrix
|
||||||
Vector3f cameraModifiedPosition = new Vector3f((float)position.x,(float)position.y,(float)position.z).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
Vector3d cameraModifiedPosition = new Vector3d(position).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
||||||
Quaterniond rotation = EntityUtils.getRotation(currentEntity);
|
Quaterniond rotation = EntityUtils.getRotation(currentEntity);
|
||||||
// modelTransformMatrix.identity();
|
// modelTransformMatrix.identity();
|
||||||
modelTransformMatrix.identity().translationRotateScale(
|
modelTransformMatrix.identity().translationRotateScale(
|
||||||
cameraModifiedPosition,
|
cameraModifiedPosition,
|
||||||
new Quaternionf((float)rotation.x,(float)rotation.y,(float)rotation.z,(float)rotation.w),
|
new Quaterniond(rotation),
|
||||||
new Vector3f(EntityUtils.getScale(currentEntity))
|
new Vector3d(EntityUtils.getScale(currentEntity))
|
||||||
);
|
);
|
||||||
//set actor value
|
//set actor value
|
||||||
currentActor.setAttribute(modelAttribute, new Matrix4f(modelTransformMatrix));
|
currentActor.setAttribute(modelAttribute, new Matrix4d(modelTransformMatrix));
|
||||||
//draw
|
//draw
|
||||||
currentActor.draw(renderPipelineState, new Vector3d(cameraModifiedPosition));
|
currentActor.draw(renderPipelineState, new Vector3d(cameraModifiedPosition));
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -2,7 +2,6 @@ package electrosphere.renderer.pipelines;
|
|||||||
|
|
||||||
import org.joml.Matrix4d;
|
import org.joml.Matrix4d;
|
||||||
import org.joml.Vector3d;
|
import org.joml.Vector3d;
|
||||||
import org.joml.Vector3f;
|
|
||||||
import org.lwjgl.opengl.GL40;
|
import org.lwjgl.opengl.GL40;
|
||||||
|
|
||||||
import electrosphere.client.entity.camera.CameraEntityUtils;
|
import electrosphere.client.entity.camera.CameraEntityUtils;
|
||||||
@ -68,8 +67,8 @@ public class NormalsForOutlinePipeline implements RenderPipeline {
|
|||||||
if(shouldDraw(currentEntity)){
|
if(shouldDraw(currentEntity)){
|
||||||
//fetch actor
|
//fetch actor
|
||||||
Actor currentActor = EntityUtils.getActor(currentEntity);
|
Actor currentActor = EntityUtils.getActor(currentEntity);
|
||||||
//calculate camera-modified vector3f
|
//calculate camera-modified vector3d
|
||||||
Vector3f cameraModifiedPosition = new Vector3f((float)position.x,(float)position.y,(float)position.z).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
Vector3d cameraModifiedPosition = new Vector3d(position).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
||||||
//calculate and apply model transform
|
//calculate and apply model transform
|
||||||
modelTransformMatrix.identity();
|
modelTransformMatrix.identity();
|
||||||
modelTransformMatrix.translate(cameraModifiedPosition);
|
modelTransformMatrix.translate(cameraModifiedPosition);
|
||||||
|
|||||||
@ -1,9 +1,7 @@
|
|||||||
package electrosphere.renderer.pipelines;
|
package electrosphere.renderer.pipelines;
|
||||||
|
|
||||||
import org.joml.Matrix4d;
|
import org.joml.Matrix4d;
|
||||||
import org.joml.Matrix4f;
|
|
||||||
import org.joml.Vector3d;
|
import org.joml.Vector3d;
|
||||||
import org.joml.Vector3f;
|
|
||||||
import org.lwjgl.opengl.GL40;
|
import org.lwjgl.opengl.GL40;
|
||||||
|
|
||||||
import electrosphere.client.entity.camera.CameraEntityUtils;
|
import electrosphere.client.entity.camera.CameraEntityUtils;
|
||||||
@ -78,11 +76,11 @@ public class ShadowMapPipeline implements RenderPipeline {
|
|||||||
// float sidesMagnitude = (float)Math.sqrt(eyeDist);
|
// float sidesMagnitude = (float)Math.sqrt(eyeDist);
|
||||||
float sidesMagnitude = sideLength;
|
float sidesMagnitude = sideLength;
|
||||||
//set matrices for light render
|
//set matrices for light render
|
||||||
Matrix4f lightProjection = new Matrix4f().setOrtho(-sidesMagnitude, sidesMagnitude, -sidesMagnitude, sidesMagnitude, nearPlane, farPlane);//glm::ortho(-10.0f, 10.0f, -10.0f, 10.0f, near_plane, far_plane);
|
Matrix4d lightProjection = new Matrix4d().setOrtho(-sidesMagnitude, sidesMagnitude, -sidesMagnitude, sidesMagnitude, nearPlane, farPlane);//glm::ortho(-10.0f, 10.0f, -10.0f, 10.0f, near_plane, far_plane);
|
||||||
Matrix4f lightView = new Matrix4f().setLookAt(
|
Matrix4d lightView = new Matrix4d().setLookAt(
|
||||||
new Vector3f(eyeX, eyeY, eyeZ),
|
new Vector3d(eyeX, eyeY, eyeZ),
|
||||||
new Vector3f( 0.0f, 0.0f, 0.0f),
|
new Vector3d( 0.0f, 0.0f, 0.0f),
|
||||||
SpatialMathUtils.getUpVectorf()
|
SpatialMathUtils.getUpVector()
|
||||||
);
|
);
|
||||||
Globals.lightDepthMatrix = lightProjection.mul(lightView);
|
Globals.lightDepthMatrix = lightProjection.mul(lightView);
|
||||||
|
|
||||||
@ -112,9 +110,9 @@ public class ShadowMapPipeline implements RenderPipeline {
|
|||||||
){
|
){
|
||||||
//fetch actor
|
//fetch actor
|
||||||
Actor currentActor = EntityUtils.getActor(currentEntity);
|
Actor currentActor = EntityUtils.getActor(currentEntity);
|
||||||
//calculate camera-modified vector3f
|
//calculate camera-modified vector3d
|
||||||
Vector3f cameraCenter = CameraEntityUtils.getCameraCenter(Globals.playerCamera);
|
Vector3d cameraCenter = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
||||||
Vector3f cameraModifiedPosition = new Vector3f((float)position.x,(float)position.y,(float)position.z).sub(cameraCenter);
|
Vector3d cameraModifiedPosition = new Vector3d(position).sub(cameraCenter);
|
||||||
//calculate and apply model transform
|
//calculate and apply model transform
|
||||||
modelTransformMatrix = modelTransformMatrix.identity();
|
modelTransformMatrix = modelTransformMatrix.identity();
|
||||||
modelTransformMatrix.translate(cameraModifiedPosition);
|
modelTransformMatrix.translate(cameraModifiedPosition);
|
||||||
|
|||||||
@ -2,7 +2,6 @@ package electrosphere.renderer.pipelines;
|
|||||||
|
|
||||||
import org.joml.Matrix4d;
|
import org.joml.Matrix4d;
|
||||||
import org.joml.Vector3d;
|
import org.joml.Vector3d;
|
||||||
import org.joml.Vector3f;
|
|
||||||
import org.lwjgl.opengl.GL40;
|
import org.lwjgl.opengl.GL40;
|
||||||
|
|
||||||
import electrosphere.client.entity.camera.CameraEntityUtils;
|
import electrosphere.client.entity.camera.CameraEntityUtils;
|
||||||
@ -71,8 +70,8 @@ public class VolumeBufferPipeline implements RenderPipeline {
|
|||||||
){
|
){
|
||||||
//fetch actor
|
//fetch actor
|
||||||
Actor currentActor = EntityUtils.getActor(currentEntity);
|
Actor currentActor = EntityUtils.getActor(currentEntity);
|
||||||
//calculate camera-modified vector3f
|
//calculate camera-modified vector3d
|
||||||
Vector3f cameraModifiedPosition = new Vector3f((float)position.x,(float)position.y,(float)position.z).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
Vector3d cameraModifiedPosition = new Vector3d(position).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
||||||
modelTransformMatrix = modelTransformMatrix.identity();
|
modelTransformMatrix = modelTransformMatrix.identity();
|
||||||
modelTransformMatrix.translate(cameraModifiedPosition);
|
modelTransformMatrix.translate(cameraModifiedPosition);
|
||||||
modelTransformMatrix.rotate(EntityUtils.getRotation(currentEntity));
|
modelTransformMatrix.rotate(EntityUtils.getRotation(currentEntity));
|
||||||
@ -92,8 +91,8 @@ public class VolumeBufferPipeline implements RenderPipeline {
|
|||||||
){
|
){
|
||||||
//fetch actor
|
//fetch actor
|
||||||
Actor currentActor = EntityUtils.getActor(currentEntity);
|
Actor currentActor = EntityUtils.getActor(currentEntity);
|
||||||
//calculate camera-modified vector3f
|
//calculate camera-modified vector3d
|
||||||
Vector3f cameraModifiedPosition = new Vector3f((float)position.x,(float)position.y,(float)position.z).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
Vector3d cameraModifiedPosition = new Vector3d(position).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
||||||
//set projection matrix
|
//set projection matrix
|
||||||
modelTransformMatrix = modelTransformMatrix.identity();
|
modelTransformMatrix = modelTransformMatrix.identity();
|
||||||
modelTransformMatrix.translate(cameraModifiedPosition);
|
modelTransformMatrix.translate(cameraModifiedPosition);
|
||||||
@ -128,8 +127,8 @@ public class VolumeBufferPipeline implements RenderPipeline {
|
|||||||
){
|
){
|
||||||
//fetch actor
|
//fetch actor
|
||||||
Actor currentActor = EntityUtils.getActor(currentEntity);
|
Actor currentActor = EntityUtils.getActor(currentEntity);
|
||||||
//calculate camera-modified vector3f
|
//calculate camera-modified vector3d
|
||||||
Vector3f cameraModifiedPosition = new Vector3f((float)position.x,(float)position.y,(float)position.z).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
Vector3d cameraModifiedPosition = new Vector3d(position).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
||||||
//calculate and apply model transform
|
//calculate and apply model transform
|
||||||
modelTransformMatrix = modelTransformMatrix.identity();
|
modelTransformMatrix = modelTransformMatrix.identity();
|
||||||
modelTransformMatrix.translate(cameraModifiedPosition);
|
modelTransformMatrix.translate(cameraModifiedPosition);
|
||||||
|
|||||||
@ -3,7 +3,6 @@ package electrosphere.renderer.pipelines.debug;
|
|||||||
import org.joml.Matrix4d;
|
import org.joml.Matrix4d;
|
||||||
import org.joml.Quaterniond;
|
import org.joml.Quaterniond;
|
||||||
import org.joml.Vector3d;
|
import org.joml.Vector3d;
|
||||||
import org.joml.Vector3f;
|
|
||||||
import org.lwjgl.opengl.GL40;
|
import org.lwjgl.opengl.GL40;
|
||||||
|
|
||||||
import electrosphere.client.entity.camera.CameraEntityUtils;
|
import electrosphere.client.entity.camera.CameraEntityUtils;
|
||||||
@ -76,7 +75,7 @@ public class DebugBonesPipeline implements RenderPipeline {
|
|||||||
Quaterniond boneRot = MathBones.getBoneWorldRotation(targetEntity, bone.boneID);
|
Quaterniond boneRot = MathBones.getBoneWorldRotation(targetEntity, bone.boneID);
|
||||||
|
|
||||||
//put pos + rot into model
|
//put pos + rot into model
|
||||||
Vector3f cameraModifiedPosition = new Vector3f((float)bonePos.x,(float)bonePos.y,(float)bonePos.z).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
Vector3d cameraModifiedPosition = new Vector3d(bonePos).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
||||||
modelTransformMatrix.identity();
|
modelTransformMatrix.identity();
|
||||||
modelTransformMatrix.translate(cameraModifiedPosition);
|
modelTransformMatrix.translate(cameraModifiedPosition);
|
||||||
modelTransformMatrix.rotate(boneRot);
|
modelTransformMatrix.rotate(boneRot);
|
||||||
|
|||||||
@ -4,7 +4,6 @@ import org.joml.Matrix4d;
|
|||||||
import org.joml.Quaterniond;
|
import org.joml.Quaterniond;
|
||||||
import org.joml.Quaternionf;
|
import org.joml.Quaternionf;
|
||||||
import org.joml.Vector3d;
|
import org.joml.Vector3d;
|
||||||
import org.joml.Vector3f;
|
|
||||||
import org.lwjgl.opengl.GL40;
|
import org.lwjgl.opengl.GL40;
|
||||||
import org.ode4j.ode.DCapsule;
|
import org.ode4j.ode.DCapsule;
|
||||||
import org.ode4j.ode.DGeom;
|
import org.ode4j.ode.DGeom;
|
||||||
@ -86,8 +85,8 @@ public class DebugContentPipeline implements RenderPipeline {
|
|||||||
texture.bind(openGLState);
|
texture.bind(openGLState);
|
||||||
}
|
}
|
||||||
Vector3d position = PhysicsUtils.odeVecToJomlVec(sphereView.getPosition());
|
Vector3d position = PhysicsUtils.odeVecToJomlVec(sphereView.getPosition());
|
||||||
//calculate camera-modified vector3f
|
//calculate camera-modified vector3d
|
||||||
Vector3f cameraModifiedPosition = new Vector3f((float)position.x,(float)position.y,(float)position.z).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
Vector3d cameraModifiedPosition = new Vector3d(position).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
||||||
modelTransformMatrix.identity();
|
modelTransformMatrix.identity();
|
||||||
modelTransformMatrix.translate(cameraModifiedPosition);
|
modelTransformMatrix.translate(cameraModifiedPosition);
|
||||||
modelTransformMatrix.scale(sphereView.getRadius() * 2);
|
modelTransformMatrix.scale(sphereView.getRadius() * 2);
|
||||||
@ -105,8 +104,8 @@ public class DebugContentPipeline implements RenderPipeline {
|
|||||||
texture.bind(openGLState);
|
texture.bind(openGLState);
|
||||||
}
|
}
|
||||||
Vector3d position = PhysicsUtils.odeVecToJomlVec(capsuleView.getPosition());
|
Vector3d position = PhysicsUtils.odeVecToJomlVec(capsuleView.getPosition());
|
||||||
//calculate camera-modified vector3f
|
//calculate camera-modified vector3d
|
||||||
Vector3f cameraModifiedPosition = new Vector3f((float)position.x,(float)position.y,(float)position.z).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
Vector3d cameraModifiedPosition = new Vector3d(position).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
||||||
modelTransformMatrix.identity();
|
modelTransformMatrix.identity();
|
||||||
modelTransformMatrix.translate(cameraModifiedPosition);
|
modelTransformMatrix.translate(cameraModifiedPosition);
|
||||||
//since you're directly accessing the quat from the body, need to adjust it to be in the correct orientation
|
//since you're directly accessing the quat from the body, need to adjust it to be in the correct orientation
|
||||||
@ -141,8 +140,8 @@ public class DebugContentPipeline implements RenderPipeline {
|
|||||||
texture.bind(openGLState);
|
texture.bind(openGLState);
|
||||||
}
|
}
|
||||||
Vector3d position = PhysicsUtils.odeVecToJomlVec(sphereView.getPosition());
|
Vector3d position = PhysicsUtils.odeVecToJomlVec(sphereView.getPosition());
|
||||||
//calculate camera-modified vector3f
|
//calculate camera-modified vector3d
|
||||||
Vector3f cameraModifiedPosition = new Vector3f((float)position.x,(float)position.y,(float)position.z).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
Vector3d cameraModifiedPosition = new Vector3d(position).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
||||||
modelTransformMatrix.identity();
|
modelTransformMatrix.identity();
|
||||||
modelTransformMatrix.translate(cameraModifiedPosition);
|
modelTransformMatrix.translate(cameraModifiedPosition);
|
||||||
modelTransformMatrix.scale(sphereView.getRadius() * 2);
|
modelTransformMatrix.scale(sphereView.getRadius() * 2);
|
||||||
@ -160,8 +159,8 @@ public class DebugContentPipeline implements RenderPipeline {
|
|||||||
texture.bind(openGLState);
|
texture.bind(openGLState);
|
||||||
}
|
}
|
||||||
Vector3d position = PhysicsUtils.odeVecToJomlVec(capsuleView.getPosition());
|
Vector3d position = PhysicsUtils.odeVecToJomlVec(capsuleView.getPosition());
|
||||||
//calculate camera-modified vector3f
|
//calculate camera-modified vector3d
|
||||||
Vector3f cameraModifiedPosition = new Vector3f((float)position.x,(float)position.y,(float)position.z).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
Vector3d cameraModifiedPosition = new Vector3d(position).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
||||||
modelTransformMatrix.identity();
|
modelTransformMatrix.identity();
|
||||||
modelTransformMatrix.translate(cameraModifiedPosition);
|
modelTransformMatrix.translate(cameraModifiedPosition);
|
||||||
//since you're directly accessing the quat from the body, need to adjust it to be in the correct orientation
|
//since you're directly accessing the quat from the body, need to adjust it to be in the correct orientation
|
||||||
@ -195,8 +194,8 @@ public class DebugContentPipeline implements RenderPipeline {
|
|||||||
texture.bind(openGLState);
|
texture.bind(openGLState);
|
||||||
}
|
}
|
||||||
Vector3d position = EntityUtils.getPosition(physicsEntity);
|
Vector3d position = EntityUtils.getPosition(physicsEntity);
|
||||||
//calculate camera-modified vector3f
|
//calculate camera-modified vector3d
|
||||||
Vector3f cameraModifiedPosition = new Vector3f((float)position.x,(float)position.y,(float)position.z).add(template.getOffsetX(),template.getOffsetY(),template.getOffsetZ()).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
Vector3d cameraModifiedPosition = new Vector3d(position).add(template.getOffsetX(),template.getOffsetY(),template.getOffsetZ()).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
||||||
modelTransformMatrix.identity();
|
modelTransformMatrix.identity();
|
||||||
modelTransformMatrix.translate(cameraModifiedPosition);
|
modelTransformMatrix.translate(cameraModifiedPosition);
|
||||||
modelTransformMatrix.rotate(EntityUtils.getRotation(physicsEntity));
|
modelTransformMatrix.rotate(EntityUtils.getRotation(physicsEntity));
|
||||||
@ -213,10 +212,9 @@ public class DebugContentPipeline implements RenderPipeline {
|
|||||||
texture.bind(openGLState);
|
texture.bind(openGLState);
|
||||||
}
|
}
|
||||||
Vector3d position = EntityUtils.getPosition(physicsEntity);
|
Vector3d position = EntityUtils.getPosition(physicsEntity);
|
||||||
// Vector3f scale = EntityUtils.getScale(physicsEntity);
|
|
||||||
Quaterniond rotation = EntityUtils.getRotation(physicsEntity);
|
Quaterniond rotation = EntityUtils.getRotation(physicsEntity);
|
||||||
//calculate camera-modified vector3f
|
//calculate camera-modified vector3d
|
||||||
Vector3f cameraModifiedPosition = new Vector3f((float)position.x,(float)position.y,(float)position.z).add(template.getOffsetX(),template.getOffsetY(),template.getOffsetZ()).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
Vector3d cameraModifiedPosition = new Vector3d(position).add(template.getOffsetX(),template.getOffsetY(),template.getOffsetZ()).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
||||||
modelTransformMatrix.identity();
|
modelTransformMatrix.identity();
|
||||||
modelTransformMatrix.translate(cameraModifiedPosition);
|
modelTransformMatrix.translate(cameraModifiedPosition);
|
||||||
modelTransformMatrix.rotate(rotation);
|
modelTransformMatrix.rotate(rotation);
|
||||||
@ -241,10 +239,10 @@ public class DebugContentPipeline implements RenderPipeline {
|
|||||||
if((shapeGraphicsModel = Globals.assetManager.fetchModel(AssetDataStrings.UNITCUBE)) != null){
|
if((shapeGraphicsModel = Globals.assetManager.fetchModel(AssetDataStrings.UNITCUBE)) != null){
|
||||||
NavCube cube = (NavCube)shape;
|
NavCube cube = (NavCube)shape;
|
||||||
Vector3d position = new Vector3d(cube.getMinPoint()).add(cube.getMaxPoint()).mul(0.5);
|
Vector3d position = new Vector3d(cube.getMinPoint()).add(cube.getMaxPoint()).mul(0.5);
|
||||||
Vector3f scale = new Vector3f((float)(cube.getMaxPoint().x-cube.getMinPoint().x)/2,(float)(cube.getMaxPoint().y-cube.getMinPoint().y)/2,(float)(cube.getMaxPoint().z-cube.getMinPoint().z)/2);
|
Vector3d scale = new Vector3d((float)(cube.getMaxPoint().x-cube.getMinPoint().x)/2,(float)(cube.getMaxPoint().y-cube.getMinPoint().y)/2,(float)(cube.getMaxPoint().z-cube.getMinPoint().z)/2);
|
||||||
Quaternionf rotation = new Quaternionf();
|
Quaternionf rotation = new Quaternionf();
|
||||||
//calculate camera-modified vector3f
|
//calculate camera-modified vector3d
|
||||||
Vector3f cameraModifiedPosition = new Vector3f((float)position.x,(float)position.y,(float)position.z).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
Vector3d cameraModifiedPosition = new Vector3d(position).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
||||||
modelTransformMatrix.identity();
|
modelTransformMatrix.identity();
|
||||||
modelTransformMatrix.translate(cameraModifiedPosition);
|
modelTransformMatrix.translate(cameraModifiedPosition);
|
||||||
modelTransformMatrix.rotate(rotation);
|
modelTransformMatrix.rotate(rotation);
|
||||||
|
|||||||
@ -232,11 +232,11 @@ public class ActorPanel extends BufferedStandardDrawableContainerElement impleme
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!hasOffsetFromBoundingSphere && actorModel != null){
|
if(!hasOffsetFromBoundingSphere && actorModel != null){
|
||||||
Globals.cameraHandler.updateRadialOffset(actorPosition);
|
Globals.cameraHandler.updateRadialOffset(new Vector3d(actorPosition));
|
||||||
double radius = actorModel.getBoundingSphere().r;
|
double radius = actorModel.getBoundingSphere().r;
|
||||||
this.cameraRadius = radius + DEFAULT_STANDOFF_DIST;
|
this.cameraRadius = radius + DEFAULT_STANDOFF_DIST;
|
||||||
CameraEntityUtils.setOrbitalCameraDistance(Globals.playerCamera, (float)(this.cameraRadius));
|
CameraEntityUtils.setOrbitalCameraDistance(Globals.playerCamera, (float)(this.cameraRadius));
|
||||||
CameraEntityUtils.setCameraCenter(Globals.playerCamera, new Vector3f(0,(float)(this.cameraRadius - DEFAULT_STANDOFF_DIST),0));
|
CameraEntityUtils.setCameraCenter(Globals.playerCamera, new Vector3d(0,(float)(this.cameraRadius - DEFAULT_STANDOFF_DIST),0));
|
||||||
hasOffsetFromBoundingSphere = true;
|
hasOffsetFromBoundingSphere = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -7,11 +7,9 @@ import java.util.Map;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
|
|
||||||
import org.joml.AxisAngle4f;
|
|
||||||
import org.joml.Matrix4d;
|
import org.joml.Matrix4d;
|
||||||
import org.joml.Matrix4f;
|
|
||||||
import org.joml.Quaterniond;
|
import org.joml.Quaterniond;
|
||||||
import org.joml.Vector3f;
|
import org.joml.Vector3d;
|
||||||
import org.joml.Vector4d;
|
import org.joml.Vector4d;
|
||||||
|
|
||||||
import electrosphere.engine.Globals;
|
import electrosphere.engine.Globals;
|
||||||
@ -418,9 +416,7 @@ public class PoseActor {
|
|||||||
calculateNodeTransforms(model);
|
calculateNodeTransforms(model);
|
||||||
Bone currentBone = model.boneMap.get(boneName);
|
Bone currentBone = model.boneMap.get(boneName);
|
||||||
if(currentBone != null){
|
if(currentBone != null){
|
||||||
AxisAngle4f axisAngle = new AxisAngle4f();
|
Quaterniond rotation = new Matrix4d(currentBone.getFinalTransform()).getNormalizedRotation(new Quaterniond());
|
||||||
new Matrix4f(currentBone.getFinalTransform()).getRotation(axisAngle);
|
|
||||||
Quaterniond rotation = new Quaterniond(axisAngle);
|
|
||||||
rVal.set(rotation);
|
rVal.set(rotation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -453,8 +449,8 @@ public class PoseActor {
|
|||||||
* @param boneName
|
* @param boneName
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Vector3f getBonePosition(String boneName){
|
public Vector3d getBonePosition(String boneName){
|
||||||
Vector3f rVal = new Vector3f();
|
Vector3d rVal = new Vector3d();
|
||||||
PoseModel model = Globals.assetManager.fetchPoseModel(modelPath);
|
PoseModel model = Globals.assetManager.fetchPoseModel(modelPath);
|
||||||
if(model != null){
|
if(model != null){
|
||||||
applyAnimationMasks(model);
|
applyAnimationMasks(model);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user