-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implement hillshading, not visual yet ...
fix ARGBCalculator blend cache.
- Loading branch information
Showing
12 changed files
with
201 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
libs/commons/src/main/java/com/recom/commons/calculator/VectorCalculator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.recom.commons.calculator; | ||
|
||
import com.recom.commons.model.Vector3D; | ||
|
||
public class VectorCalculator { | ||
|
||
public static double dotProduct( | ||
final Vector3D sunLightVector, | ||
final Vector3D terrainNormal | ||
) { | ||
return sunLightVector.getX() * terrainNormal.getX() + | ||
sunLightVector.getY() * terrainNormal.getY() + | ||
sunLightVector.getZ() * terrainNormal.getZ(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
libs/commons/src/main/java/com/recom/commons/model/Vector3D.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.recom.commons.model; | ||
|
||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
@Getter | ||
@Builder | ||
@RequiredArgsConstructor | ||
public class Vector3D { | ||
|
||
private final double x; | ||
private final double y; | ||
private final double z; | ||
|
||
} |
6 changes: 0 additions & 6 deletions
6
libs/commons/src/main/java/com/recom/commons/rasterizer/mapcolorscheme/MapColorScheme.java
This file was deleted.
Oops, something went wrong.
55 changes: 55 additions & 0 deletions
55
...commons/src/main/java/com/recom/commons/rasterizer/mapcolorscheme/MapShadowingScheme.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package com.recom.commons.rasterizer.mapcolorscheme; | ||
|
||
import com.recom.commons.model.Vector3D; | ||
|
||
public abstract class MapShadowingScheme { | ||
|
||
private Double cachedSunAzimutRad = null; | ||
private Double cachedSunElevationRad = null; | ||
private Vector3D cachedSunLightVectorX = null; | ||
|
||
|
||
public abstract int getBaseColorTerrain(); | ||
|
||
public abstract int getBaseColorWater(); | ||
|
||
public abstract int getBaseColorForest(); | ||
|
||
|
||
public abstract int getSunAzimutDeg(); | ||
|
||
public abstract int getSunElevationDeg(); | ||
|
||
public double getSunAzimutRad() { | ||
if (cachedSunAzimutRad == null) { | ||
cachedSunAzimutRad = Math.toRadians(getSunAzimutDeg()); | ||
} | ||
|
||
return cachedSunAzimutRad; | ||
} | ||
|
||
public double getSunElevationRad() { | ||
if (cachedSunElevationRad == null) { | ||
cachedSunElevationRad = Math.toRadians(getSunElevationDeg()); | ||
} | ||
|
||
return cachedSunElevationRad; | ||
} | ||
|
||
public Vector3D getSunLightVector() { | ||
if (cachedSunLightVectorX == null) { | ||
final double lx = Math.cos(getSunAzimutRad()) * Math.cos(getSunElevationRad()); | ||
final double ly = Math.sin(getSunAzimutRad()) * Math.cos(getSunElevationRad()); | ||
final double lz = Math.sin(getSunElevationRad()); | ||
|
||
cachedSunLightVectorX = Vector3D.builder() | ||
.x(lx) | ||
.y(ly) | ||
.z(lz) | ||
.build(); | ||
} | ||
|
||
return cachedSunLightVectorX; | ||
} | ||
|
||
} |
10 changes: 0 additions & 10 deletions
10
...ommons/src/main/java/com/recom/commons/rasterizer/mapcolorscheme/ReforgerColorScheme.java
This file was deleted.
Oops, something went wrong.
15 changes: 15 additions & 0 deletions
15
.../commons/src/main/java/com/recom/commons/rasterizer/mapcolorscheme/ReforgerMapScheme.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.recom.commons.rasterizer.mapcolorscheme; | ||
|
||
import lombok.Getter; | ||
|
||
@Getter | ||
public class ReforgerMapScheme extends MapShadowingScheme { | ||
|
||
private final int baseColorTerrain = 0xFFF1F1F3; | ||
private final int baseColorWater = 0xFFA1D2E8; | ||
private final int baseColorForest = 0xFFA1D2E8; | ||
|
||
private final int sunAzimutDeg = 315; // usually 315 | ||
private final int sunElevationDeg = 45; // usually 30-45 | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters