Empeld
Empeld plugin documentation.
essentials.blocks.vegetation.Brush.GrassBase Class Reference
Inheritance diagram for essentials.blocks.vegetation.Brush.GrassBase:
essentials.blocks.vegetation.VegetationBase pluginbase.Objects.World.Blocks.BlockBase pluginbase.Objects.World.Blocks.IBlock essentials.blocks.vegetation.Brush.DeadGrassBlades essentials.blocks.vegetation.Brush.GrassBlades essentials.blocks.vegetation.Brush.GrassBladesFirefly

Public Member Functions

override Vector3 GetVertWavePower (Vector3 vert)
 For each vertex in the mesh/block, compute how affected it is by VertWave animation Only important if AnimationMode == VertWave More...
 
sealed override void GetDynamicMeshClones (IWorldReadonly world, Vector3i pos, Action< Matrix4 > render)
 Gets the dynamic mesh clone matricies More...
 
override bool PhysicsSimulate (IWorld world, IWorldBlock block)
 Simulates the physics. More...
 
- Public Member Functions inherited from pluginbase.Objects.World.Blocks.BlockBase
 BlockBase ()
 Initializes an instance of the block More...
 
bool Equals (IBlock block)
 Determines whether the specified pluginbase.Objects.World.Blocks.IBlock is equal to the current pluginbase.Objects.World.Blocks.BlockBase. More...
 
sealed override bool Equals (object obj)
 Determines whether the specified System.Object is equal to the current pluginbase.Objects.World.Blocks.BlockBase. More...
 
sealed override int GetHashCode ()
 The quick hash code for the block More...
 
sealed override string ToString ()
 Returns a string representing the block More...
 
virtual Matrix4 GetDynamicMeshTransform (IWorldReadonly world, Vector3i pos)
 Gets the dynamic mesh transform. More...
 
Get< T > ()
 Get this instance extension type More...
 
void Set< T > (T extension)
 Set the specified extension. More...
 

Public Attributes

sealed override bool MeshReverseNormals => true
 
override Vector3 MeshOverrideNormal => Vector3.UnitZ
 
override BlockAnimationMode AnimationMode => BlockAnimationMode.VertWave
 
override BlockMeshLodMode MeshLodMode => BlockMeshLodMode.Skip
 
- Public Attributes inherited from pluginbase.Objects.World.Blocks.BlockBase
virtual Vector3 MeshOverrideNormal => null
 
virtual bool MeshReverseNormals => false
 

Protected Attributes

float MinHeight = 0.3f
 
float HeightDiff = 6f
 
int MinCount = 1
 
int MaxCount = 5
 
- Protected Attributes inherited from essentials.blocks.vegetation.VegetationBase
readonly IResourceResolver ResourceResolver
 

Properties

sealed override string MeshResource [get]
 
override MaterialType MaterialType [get]
 
sealed override bool Solid [get]
 
sealed override BlockTextureMode TextureMode [get]
 
sealed override BlockRenderMode RenderMode [get]
 
sealed override BlockVertexMode VertexMode [get]
 
sealed override BlockMeshTransform MeshTransformMode [get]
 
override int MeshLodDistance [get]
 
override int MeshLodSkipMultiplier [get]
 
override bool HasPhysics [get]
 
- Properties inherited from pluginbase.Objects.World.Blocks.BlockBase
virtual ushort Id [get]
 Rotating hash algorithm for max permutation From: http://eternallyconfuzzled.com/tuts/algorithms/jsw_tut_hashing.aspx More...
 
string InternalName [get]
 Internal name from the attribute More...
 
bool Renderable [get]
 Determines whether or not the block is visible More...
 
virtual BlockTextureMode TextureMode [get]
 
virtual BlockRenderMode RenderMode [get]
 
virtual BlockVertexMode VertexMode [get]
 
virtual BlockAnimationMode AnimationMode [get]
 
virtual float Transparency [get]
 
virtual int TextureStretch [get]
 
virtual string MeshResource [get]
 
virtual Matrix4 MeshTransform [get]
 
virtual BlockMeshTransform MeshTransformMode [get]
 
virtual BlockMeshLodMode MeshLodMode [get]
 
virtual int MeshLodDistance [get]
 
virtual int MeshLodSkipMultiplier [get]
 
virtual string IconResource [get]
 
virtual BlockIconMode IconMode [get]
 
virtual bool HasFog [get]
 
virtual Rgba FogColor [get]
 
virtual float FogDensity [get]
 
virtual bool EmitsLight [get]
 
virtual Rgba EmitColor [get]
 
virtual float EmitRadius [get]
 
virtual bool EmitIsDirectional [get]
 
virtual Vector3 EmitDirection [get]
 
virtual float EmitDirectionFocus [get]
 
virtual bool HasParticleSystem [get]
 
virtual int ParticleSystemViewDistance [get]
 
virtual string ParticleSystemScript [get]
 
virtual bool Destructable [get]
 
virtual bool Solid [get]
 
virtual double FrictionRatio [get]
 
virtual double FallDamageRatio [get]
 
virtual double SpeedLimit [get]
 
virtual double SpeedMultiplier [get]
 
virtual int DamageInfliction [get]
 
virtual double BounceRatio [get]
 
virtual bool Climbable [get]
 
virtual bool Sloped [get]
 
virtual bool IsLiquid [get]
 
virtual float FluidDensity [get]
 
virtual BlockPermeableMode FluidPermeableMode [get]
 
virtual Vector3d GravityMultiplier [get]
 
virtual Vector3d GravityConstant [get]
 
virtual bool HasPhysics [get]
 
virtual bool PhysicsAutoStart [get]
 
virtual TimeSpan PhysicsFrequency [get]
 
virtual SoundDescriptor SoundAmbient [get]
 
virtual SoundDescriptor SoundWalk [get]
 
virtual SoundDescriptor SoundFall [get]
 
virtual SoundDescriptor SoundBreak [get]
 
virtual SoundDescriptor SoundPlace [get]
 
virtual SoundDescriptor SoundInteract [get]
 
virtual float MaterialDensity [get]
 
abstract MaterialType MaterialType [get]
 
abstract string Name [get]
 
abstract string TextureResource [get]
 
- Properties inherited from pluginbase.Objects.World.Blocks.IBlock
string Name [get]
 Display name More...
 
string InternalName [get]
 Name of the block internally (Usually defined by the attribute) More...
 
ushort Id [get]
 Id that represent the block type (usually hash of InternalName) More...
 
bool Renderable [get]
 Renderable, aka visible More...
 
BlockTextureMode TextureMode [get]
 Render mode for the block (mostly relates to texturing) More...
 
BlockRenderMode RenderMode [get]
 Defines how the faces of the block get rendered, and by what rules More...
 
BlockVertexMode VertexMode [get]
 Vertex mode of the rendered block More...
 
BlockAnimationMode AnimationMode [get]
 Gets the animation mode. More...
 
float Transparency [get]
 Amount of transparency More...
 
string TextureResource [get]
 Texture file that represents the image starting at the "content/textures/" root More...
 
int TextureStretch [get]
 Number of blocks the texture stretches (default 1). Needs rendermode stretch More...
 
BlockMeshTransform MeshTransformMode [get]
 Gets the mesh render mode More...
 
BlockMeshLodMode MeshLodMode [get]
 Gets the LOD mode for the mesh More...
 
bool MeshReverseNormals [get]
 If true, will reverse the ordering of the mesh vertices to change how normals are computed More...
 
int MeshLodDistance [get]
 Distance, in lod-levels, until the lod mode is applied More...
 
int MeshLodSkipMultiplier [get]
 Multiplying factor for how many tris to skip per lod level More...
 
string MeshResource [get]
 Gets the mesh resource. More...
 
Matrix4 MeshTransform [get]
 Gets the mesh transform matrix More...
 
Vector3 MeshOverrideNormal [get]
 If provided, overrides the normal of the mesh geometry with this normal More...
 
string IconResource [get]
 Resolved resource path to an icon representing the block More...
 
BlockIconMode IconMode [get]
 Gets the icon mode for how the resoruce is rendered More...
 
bool Destructable [get]
 Am I destructable More...
 
bool Solid [get]
 Is the block solid, that is, does it have collision More...
 
double FrictionRatio [get]
 The friction applied to walking on/through the block when slowing/stopping Normal is 1f More...
 
double FallDamageRatio [get]
 The amount of fall damage taken by falling on (normal is 1f) More...
 
double SpeedLimit [get]
 Speed limit going through the block. Normal is no limit More...
 
double SpeedMultiplier [get]
 Gets the speed multiplier. More...
 
int DamageInfliction [get]
 Amount of damage points inflicted by touching. A person is 100 damage Default 0 More...
 
double BounceRatio [get]
 When falling on this block, bounce this much. 1f is equal height as fallen Default 0 More...
 
bool Climbable [get]
 Can the block be climbed More...
 
bool Sloped [get]
 Should the block be considered to be sloped More...
 
bool IsLiquid [get]
 Gets a value indicating whether this instance is liquid. More...
 
float FluidDensity [get]
 Affects several aspects with fluids/gasses 1) Lighter density liquids will float to the top 2) Higher densities will retrict movement (i.e. sink into, or be solid) Default 0.0; More...
 
BlockPermeableMode FluidPermeableMode [get]
 Gets how this block reacts to fluids More...
 
Vector3d GravityMultiplier [get]
 Gets the gravity multiplier to affect existing gravity More...
 
Vector3d GravityConstant [get]
 Gets the gravity constant, to supply its own gravity More...
 
bool HasPhysics [get]
 Does the block have any physics (mostly for optimization) This is weather the block will actually fall/move, not whether physics is applied to entities More...
 
bool PhysicsAutoStart [get]
 Gets a value indicating whether this pluginbase.Objects.World.Blocks.IBlock physics auto starts, triggering on world-gen rather than interaction More...
 
TimeSpan PhysicsFrequency [get]
 Gets the physics delay, which is how often physics will be applied More...
 
bool HasFog [get]
 When viewport is inside block, do we alter fog (i.e. underwater) Default false More...
 
Rgba FogColor [get]
 Return a 4-tuple of fog color (RGBA) More...
 
float FogDensity [get]
 Density of the fog More...
 
bool EmitsLight [get]
 Does the block emit light More...
 
Rgba EmitColor [get]
 Emittance color More...
 
float EmitRadius [get]
 Gets the light radius of the light More...
 
bool EmitIsDirectional [get]
 Gets a value indicating whether this pluginbase.Objects.World.Blocks.IBlock emit is directional. More...
 
Vector3 EmitDirection [get]
 Gets the emit direction. More...
 
float EmitDirectionFocus [get]
 Gets the emit direction focus. More...
 
string ParticleSystemScript [get]
 Resolved path to a particle script More...
 
bool HasParticleSystem [get]
 Gets a value indicating whether this instance has particle system. More...
 
int ParticleSystemViewDistance [get]
 Gets the max distance we can view the particle system from More...
 
SoundDescriptor SoundAmbient [get]
 Ambient sound the block makes by existing More...
 
SoundDescriptor SoundWalk [get]
 Sound of walking on the block (or moving through, in case of water) More...
 
SoundDescriptor SoundFall [get]
 Sound for falling on block More...
 
SoundDescriptor SoundPlace [get]
 Sound when placing block More...
 
SoundDescriptor SoundBreak [get]
 Sound when breaking block More...
 
SoundDescriptor SoundInteract [get]
 Sound when interacting with block More...
 
float MaterialDensity [get]
 Gets the material density; aka its weight per cubic block More...
 
MaterialType MaterialType [get]
 Gets the type of the material. More...
 

Additional Inherited Members

- Protected Member Functions inherited from essentials.blocks.vegetation.VegetationBase
 VegetationBase ()
 

Member Function Documentation

◆ GetDynamicMeshClones()

sealed override void essentials.blocks.vegetation.Brush.GrassBase.GetDynamicMeshClones ( IWorldReadonly  world,
Vector3i  pos,
Action< Matrix4 >  render 
)
virtual

Gets the dynamic mesh clone matricies

Returns
The dynamic mesh clones.
Parameters
worldWorld.
posPosition.
renderThe callback used to render the mesh

Reimplemented from pluginbase.Objects.World.Blocks.BlockBase.

108  {
109  int cnt = _rand.GetValue(pos.X, pos.Y, pos.Z, MinCount, MaxCount);
110  Matrix4 scale = Matrix4.CreateScale(1f, 1f, _height.GetValue(pos.X, pos.Y) * HeightDiff + MinHeight);
111  for (int i=0; i<cnt; ++i)
112  {
113  Matrix4 offset = Matrix4.CreateTranslation(
114  _rand.Rand(pos.X + i*3, pos.Y, pos.Z + 100, -1f, 1f),
115  _rand.Rand(pos.X, pos.Y + i, pos.Z + 200, -1f, 1f),
116  0f);
117  Matrix4 rot = Matrix4.CreateRotationZ(_rand.GetValue(pos.X - i * 2, pos.Y + i * 10, pos.Z + 300) * MathHelper.TwoPi);
118  Matrix4 ret = rot * scale * offset;
119  render(ret);
120  }
121  }
float HeightDiff
Definition: GrassBase.cs:101
override float GetValue(int x, int y, int z)
Get a value between 0-1
Definition: Perlin.cs:73
float MinHeight
Definition: GrassBase.cs:100
override float GetValue(int x, int y, int z)
Get the value at a coordinate x,y,z
Definition: Random3D.cs:189
int MinCount
Definition: GrassBase.cs:102
int Y
The Y coordinate
Definition: Vector3i.cs:23
float Rand(int x)
Returns 0-1 float
Definition: Random3D.cs:41
int MaxCount
Definition: GrassBase.cs:103
int X
The X coordinate
Definition: Vector3i.cs:18
int Z
The Z coordinate
Definition: Vector3i.cs:28

◆ GetVertWavePower()

override Vector3 essentials.blocks.vegetation.Brush.GrassBase.GetVertWavePower ( Vector3  pt)
virtual

For each vertex in the mesh/block, compute how affected it is by VertWave animation Only important if AnimationMode == VertWave

Returns
The vert wave power.
Parameters
ptLocal vertex in block/mesh-space

Reimplemented from pluginbase.Objects.World.Blocks.BlockBase.

94  {
95  return new Vector3(0.8f, 0.8f, 0f) * MExt.ClampUnit(vert.Z);
96  }
static float ClampUnit(float v)
Clamp a float between 0 and 1, inclusive
Definition: MathExtensions.cs:374
Math extensions
Definition: MathExtensions.cs:7

◆ PhysicsSimulate()

override bool essentials.blocks.vegetation.Brush.GrassBase.PhysicsSimulate ( IWorld  world,
IWorldBlock  block 
)
virtual

Simulates the physics.

Returns
True if simulation complete on this coord
Parameters
worldIf set to true world.
blockIf set to true block.

Attribute: block.Coordinate - Vector3i.UnitZ

.Block.Solid)

Reimplemented from pluginbase.Objects.World.Blocks.BlockBase.

132  {
133  if (!world[block.Coordinate - Vector3i.UnitZ].Block.Solid)
134  {
135  block.Block = world.BlockLookup.EmptyBlock;
136  }
137  return true;
138  }
new IBlock Block
Block setter for this position
Definition: IWorldBlock.cs:14
static readonly Vector3i UnitZ
Vector (0,0,1)
Definition: Vector3i.cs:79
A class representing a 3D coordinate of integers
Definition: Vector3i.cs:13
Vector3i Coordinate
Coordinate
Definition: IWorldReadonlyBlock.cs:24

Member Data Documentation

◆ AnimationMode

override BlockAnimationMode essentials.blocks.vegetation.Brush.GrassBase.AnimationMode => BlockAnimationMode.VertWave

◆ HeightDiff

float essentials.blocks.vegetation.Brush.GrassBase.HeightDiff = 6f
protected

◆ MaxCount

int essentials.blocks.vegetation.Brush.GrassBase.MaxCount = 5
protected

◆ MeshLodMode

override BlockMeshLodMode essentials.blocks.vegetation.Brush.GrassBase.MeshLodMode => BlockMeshLodMode.Skip

◆ MeshOverrideNormal

override Vector3 essentials.blocks.vegetation.Brush.GrassBase.MeshOverrideNormal => Vector3.UnitZ

◆ MeshReverseNormals

sealed override bool essentials.blocks.vegetation.Brush.GrassBase.MeshReverseNormals => true

◆ MinCount

int essentials.blocks.vegetation.Brush.GrassBase.MinCount = 1
protected

◆ MinHeight

float essentials.blocks.vegetation.Brush.GrassBase.MinHeight = 0.3f
protected

Property Documentation

◆ HasPhysics

override bool essentials.blocks.vegetation.Brush.GrassBase.HasPhysics
get

◆ MaterialType

override MaterialType essentials.blocks.vegetation.Brush.GrassBase.MaterialType
get

◆ MeshLodDistance

override int essentials.blocks.vegetation.Brush.GrassBase.MeshLodDistance
get

◆ MeshLodSkipMultiplier

override int essentials.blocks.vegetation.Brush.GrassBase.MeshLodSkipMultiplier
get

◆ MeshResource

sealed override string essentials.blocks.vegetation.Brush.GrassBase.MeshResource
get

◆ MeshTransformMode

sealed override BlockMeshTransform essentials.blocks.vegetation.Brush.GrassBase.MeshTransformMode
get

◆ RenderMode

sealed override BlockRenderMode essentials.blocks.vegetation.Brush.GrassBase.RenderMode
get

◆ Solid

sealed override bool essentials.blocks.vegetation.Brush.GrassBase.Solid
get

◆ TextureMode

sealed override BlockTextureMode essentials.blocks.vegetation.Brush.GrassBase.TextureMode
get

◆ VertexMode

sealed override BlockVertexMode essentials.blocks.vegetation.Brush.GrassBase.VertexMode
get

The documentation for this class was generated from the following file: