Skip to content

Instantly share code, notes, and snippets.

@kjlape
Last active December 15, 2015 10:59
Show Gist options
  • Select an option

  • Save kjlape/5249719 to your computer and use it in GitHub Desktop.

Select an option

Save kjlape/5249719 to your computer and use it in GitHub Desktop.
//Goes into OnContentLoaded()
MaterialGroup material = (MaterialGroup)_boardGroup.Find<Surface>().Material;
DiffuseMaterialPart materialPart = (DiffuseMaterialPart)((MaterialPaintGroup)material.MaterialParts
.First(x => x.Name == "ground").MaterialGroup.MaterialParts
.First()).MaterialParts.First();
_boardTexture = materialPart.Texture;
<!--Goes into Surface
Remember to delete the BasicMaterial!
-->
<MaterialGroup>
<MaterialPaintGroup.MaskTextures>
<Splatter>
<ExternalReference />
</Splatter>
</MaterialPaintGroup.MaskTextures>
<MaterialPaintGroup Name="ground">
<DiffuseMaterialPart Texture="{ContentReference Assets/MainBoard}"/>
</MaterialPaintGroup>
<!--Fixes mysterious null reference bug. Should investigate later.-->
<DeferredLightsMaterialPart />
</MaterialGroup>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment