Beispiel #1
0
        protected virtual void ClientRefreshVegetationRendering(
            IStaticWorldObject worldObject,
            VegetationClientState clientState,
            VegetationPublicState publicState)
        {
            clientState.LastGrowthStage          = publicState.GrowthStage;
            clientState.Renderer.TextureResource = this.ClientGetTexture(worldObject, publicState);

            if (clientState.RendererShadow is not null)
            {
                clientState.RendererShadow.Scale = this.CalculateShadowScale(clientState);
            }
        }
Beispiel #2
0
        public static void ClientRefreshVegetationRendering(
            IProtoObjectVegetation protoObjectVegetation,
            IStaticWorldObject worldObject,
            VegetationClientState clientState,
            VegetationPublicState publicState)
        {
            clientState.LastGrowthStage          = publicState.GrowthStage;
            clientState.Renderer.TextureResource = ClientGetTexture(protoObjectVegetation, worldObject, publicState);

            if (clientState.RendererShadow != null)
            {
                clientState.RendererShadow.Scale = protoObjectVegetation.CalculateShadowScale(clientState);
            }
        }
Beispiel #3
0
        protected ITextureResource ClientGetTexture(
            IStaticWorldObject worldObject,
            VegetationPublicState publicState)
        {
            var textureResource = this.DefaultTexture;
            var textureAtlas    = textureResource as TextureAtlasResource;

            if (textureAtlas is null)
            {
                // not a texture atlas - always use whole texture
                return(textureResource);
            }

            var columnIndex = this.ClientGetTextureAtlasColumn(worldObject, publicState);

            return(textureAtlas.Chunk(column: columnIndex, row: 0));
        }
Beispiel #4
0
 public virtual byte ClientGetTextureAtlasColumn(
     IStaticWorldObject worldObject,
     VegetationPublicState statePublic)
 {
     return(statePublic.GrowthStage);
 }