grass curvature from file + ui
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good

This commit is contained in:
austin 2025-03-27 21:02:21 -04:00
parent cb1f2ec1be
commit 732c9700c4
4 changed files with 37 additions and 3 deletions

View File

@ -12,8 +12,9 @@
"growthRate" : 0.001
},
"grassData": {
"baseColor": {"x": 0.05, "y": 0.2, "z": 0.01},
"tipColor": {"x": 0.25, "y": 0.45, "z": 0}
"baseColor": {"x": 0.25, "y": 0.6, "z": 0.43},
"tipColor": {"x": 0.17, "y": 0.71, "z": 0.12},
"maxTipCurve" : 0.27
},
"graphicsTemplate": {
"model": {

View File

@ -218,6 +218,7 @@ public class FoliageModel {
scale, placementRandomizer,
x, y, z,
data.getType(currVoxelPos.x,currVoxelPos.y,currVoxelPos.z),
foliageType,
floatBufferView, data
);
drawCount = drawCount + numGenerated;
@ -285,10 +286,13 @@ public class FoliageModel {
int scale, Random placementRandomizer,
int vX, int vY, int vZ,
int targetVoxelType,
FoliageType foliageType,
FloatBuffer floatBufferView, ChunkData chunkData
){
int rVal = 0;
float maxTipCurve = foliageType.getGrassData().getMaxTipCurve();
//construct simple grid to place foliage on
// Vector3d sample_00 = Globals.clientSceneWrapper.getCollisionEngine().rayCastPosition(new Vector3d(realPos).add(-SAMPLE_OFFSET,SAMPLE_START_HEIGHT,-SAMPLE_OFFSET), new Vector3d(0,-1,0), RAY_LENGTH);
// Vector3d sample_01 = Globals.clientSceneWrapper.getCollisionEngine().rayCastPosition(new Vector3d(realPos).add(-SAMPLE_OFFSET,SAMPLE_START_HEIGHT, 0), new Vector3d(0,-1,0), RAY_LENGTH);
@ -410,7 +414,7 @@ public class FoliageModel {
//convert y to relative to chunk
offsetY = offsetY - realPos.y;
double rotVar = placementRandomizer.nextDouble() * Math.PI * 2;
double rotVar2 = placementRandomizer.nextDouble();
double rotVar2 = placementRandomizer.nextDouble() * maxTipCurve;
if(floatBufferView.limit() >= floatBufferView.position() + SINGLE_FOLIAGE_DATA_SIZE_BYTES / 4){
floatBufferView.put((float)relativePositionOnGridX + vX);
floatBufferView.put((float)offsetY + vY);

View File

@ -25,6 +25,11 @@ public class ImGuiEntityFoliageTab {
*/
static float[] grassColorBase = new float[3];
/**
* Grass Max Tip Curve
*/
static float[] grassMaxTipCurve = new float[1];
/**
* Client scene entity view
*/
@ -57,6 +62,10 @@ public class ImGuiEntityFoliageTab {
}
}
if(ImGui.sliderFloat("Max Tip Curve", grassMaxTipCurve, 0, 1)){
grassData.setMaxTipCurve(grassMaxTipCurve[0]);
}
if(ImGui.button("Regenerate All Grass")){
Globals.foliageCellManager.evictAll();
}

View File

@ -17,6 +17,11 @@ public class GrassData {
*/
Vector3f tipColor;
/**
* The maximum curve allowed on the tip
*/
float maxTipCurve;
/**
* Gets the base color of the grass
* @return The base color
@ -33,6 +38,21 @@ public class GrassData {
return tipColor;
}
/**
* Gets the maximum curve allowed on the tip
* @return The maximum curve allowed on the tip
*/
public float getMaxTipCurve() {
return maxTipCurve;
}
/**
* Sets the maximum curve allowed on the tip
* @param maxTipCurve The maximum curve allowed on the tip
*/
public void setMaxTipCurve(float maxTipCurve) {
this.maxTipCurve = maxTipCurve;
}
}