grass curvature from file + ui
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
cb1f2ec1be
commit
732c9700c4
@ -12,8 +12,9 @@
|
|||||||
"growthRate" : 0.001
|
"growthRate" : 0.001
|
||||||
},
|
},
|
||||||
"grassData": {
|
"grassData": {
|
||||||
"baseColor": {"x": 0.05, "y": 0.2, "z": 0.01},
|
"baseColor": {"x": 0.25, "y": 0.6, "z": 0.43},
|
||||||
"tipColor": {"x": 0.25, "y": 0.45, "z": 0}
|
"tipColor": {"x": 0.17, "y": 0.71, "z": 0.12},
|
||||||
|
"maxTipCurve" : 0.27
|
||||||
},
|
},
|
||||||
"graphicsTemplate": {
|
"graphicsTemplate": {
|
||||||
"model": {
|
"model": {
|
||||||
|
|||||||
@ -218,6 +218,7 @@ public class FoliageModel {
|
|||||||
scale, placementRandomizer,
|
scale, placementRandomizer,
|
||||||
x, y, z,
|
x, y, z,
|
||||||
data.getType(currVoxelPos.x,currVoxelPos.y,currVoxelPos.z),
|
data.getType(currVoxelPos.x,currVoxelPos.y,currVoxelPos.z),
|
||||||
|
foliageType,
|
||||||
floatBufferView, data
|
floatBufferView, data
|
||||||
);
|
);
|
||||||
drawCount = drawCount + numGenerated;
|
drawCount = drawCount + numGenerated;
|
||||||
@ -285,10 +286,13 @@ public class FoliageModel {
|
|||||||
int scale, Random placementRandomizer,
|
int scale, Random placementRandomizer,
|
||||||
int vX, int vY, int vZ,
|
int vX, int vY, int vZ,
|
||||||
int targetVoxelType,
|
int targetVoxelType,
|
||||||
|
FoliageType foliageType,
|
||||||
FloatBuffer floatBufferView, ChunkData chunkData
|
FloatBuffer floatBufferView, ChunkData chunkData
|
||||||
){
|
){
|
||||||
int rVal = 0;
|
int rVal = 0;
|
||||||
|
|
||||||
|
float maxTipCurve = foliageType.getGrassData().getMaxTipCurve();
|
||||||
|
|
||||||
//construct simple grid to place foliage on
|
//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_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);
|
// 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
|
//convert y to relative to chunk
|
||||||
offsetY = offsetY - realPos.y;
|
offsetY = offsetY - realPos.y;
|
||||||
double rotVar = placementRandomizer.nextDouble() * Math.PI * 2;
|
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){
|
if(floatBufferView.limit() >= floatBufferView.position() + SINGLE_FOLIAGE_DATA_SIZE_BYTES / 4){
|
||||||
floatBufferView.put((float)relativePositionOnGridX + vX);
|
floatBufferView.put((float)relativePositionOnGridX + vX);
|
||||||
floatBufferView.put((float)offsetY + vY);
|
floatBufferView.put((float)offsetY + vY);
|
||||||
|
|||||||
@ -25,6 +25,11 @@ public class ImGuiEntityFoliageTab {
|
|||||||
*/
|
*/
|
||||||
static float[] grassColorBase = new float[3];
|
static float[] grassColorBase = new float[3];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Grass Max Tip Curve
|
||||||
|
*/
|
||||||
|
static float[] grassMaxTipCurve = new float[1];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Client scene entity view
|
* 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")){
|
if(ImGui.button("Regenerate All Grass")){
|
||||||
Globals.foliageCellManager.evictAll();
|
Globals.foliageCellManager.evictAll();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17,6 +17,11 @@ public class GrassData {
|
|||||||
*/
|
*/
|
||||||
Vector3f tipColor;
|
Vector3f tipColor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The maximum curve allowed on the tip
|
||||||
|
*/
|
||||||
|
float maxTipCurve;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the base color of the grass
|
* Gets the base color of the grass
|
||||||
* @return The base color
|
* @return The base color
|
||||||
@ -33,6 +38,21 @@ public class GrassData {
|
|||||||
return tipColor;
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user