Skip to content

Commit

Permalink
SoftBodyCreator: handle more default arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
stephengold committed Feb 7, 2025
1 parent a4a2703 commit bdd2c64
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/test/java/testjoltjni/app/samples/SoftBodyCreator.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) 2024 Stephen Gold
Copyright (c) 2024-2025 Stephen Gold
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -34,8 +34,12 @@ of this software and associated documentation files (the "Software"), to deal
* https://github.com/jrouwe/JoltPhysics/blob/master/Samples/Utils/SoftBodyCreator.cpp
*/
public class SoftBodyCreator {
static SoftBodySharedSettingsRef CreateCloth(int inGridSizeX,int inGridSizeZ,float inGridSpacing,BiFunction<Integer,Integer,Float>inVertexGetInvMass) {
return CreateCloth(inGridSizeX,inGridSizeZ,inGridSpacing,inVertexGetInvMass,(Integer a,Integer b)->new Vec3(),EBendType.None,new VertexAttributes(1e-5f, 1e-5f, 1e-5f));}
public static SoftBodySharedSettingsRef CreateCloth(int inGridSizeX,int inGridSizeZ,float inGridSpacing,BiFunction<Integer,Integer,Float>inVertexGetInvMass) {
return CreateCloth(inGridSizeX,inGridSizeZ,inGridSpacing,inVertexGetInvMass,(Integer a,Integer b)->new Vec3());}
public static SoftBodySharedSettingsRef CreateCloth(int inGridSizeX,int inGridSizeZ,float inGridSpacing,BiFunction<Integer,Integer,Float>inVertexGetInvMass,BiFunction<Integer,Integer,Vec3> inVertexPerturbation) {
return CreateCloth(inGridSizeX,inGridSizeZ,inGridSpacing,inVertexGetInvMass,inVertexPerturbation,EBendType.None);}
public static SoftBodySharedSettingsRef CreateCloth(int inGridSizeX,int inGridSizeZ,float inGridSpacing,BiFunction<Integer,Integer,Float>inVertexGetInvMass,BiFunction<Integer,Integer,Vec3> inVertexPerturbation, EBendType inBendType) {
return CreateCloth(inGridSizeX,inGridSizeZ,inGridSpacing,inVertexGetInvMass,inVertexPerturbation,inBendType,new VertexAttributes(1e-5f,1e-5f,1e-5f));}

static SoftBodySharedSettingsRef CreateCloth(int inGridSizeX, int inGridSizeZ, float inGridSpacing, BiFunction<Integer, Integer,Float> inVertexGetInvMass, BiFunction<Integer, Integer,Vec3> inVertexPerturbation, EBendType inBendType, ConstVertexAttributes inVertexAttributes)
{
Expand Down Expand Up @@ -239,7 +243,11 @@ public static SoftBodySharedSettingsRef CreateCube(int inGridSize, float inGridS
return settings.toRef();
}

public static SoftBodySharedSettingsRef CreateSphere(float inRadius){return CreateSphere(inRadius,10,20,EBendType.None,new VertexAttributes(1e-4f,1e-4f,1e-3f));}
public static SoftBodySharedSettingsRef CreateSphere(){return CreateSphere(1);}
public static SoftBodySharedSettingsRef CreateSphere(float inRadius){return CreateSphere(inRadius,10);}
public static SoftBodySharedSettingsRef CreateSphere(float inRadius,int inNumTheta){return CreateSphere(inRadius,inNumTheta,20);}
public static SoftBodySharedSettingsRef CreateSphere(float inRadius,int inNumTheta,int inNumPhi){return CreateSphere(inRadius,inNumTheta,inNumPhi,EBendType.None);}
public static SoftBodySharedSettingsRef CreateSphere(float inRadius,int inNumTheta,int inNumPhi,EBendType inBendType){return CreateSphere(inRadius,inNumTheta,inNumPhi,inBendType,new VertexAttributes(1e-4f,1e-4f,1e-3f));}
static SoftBodySharedSettingsRef CreateSphere(float inRadius, int inNumTheta, int inNumPhi, EBendType inBendType, ConstVertexAttributes inVertexAttributes)
{
// Create settings
Expand Down

0 comments on commit bdd2c64

Please sign in to comment.