MeshBaker
DigitalOpus.MB.Core.MB3_TextureCombiner Class Reference

Classes

class  CombineTexturesIntoAtlasesCoroutineResult
 Same as CombineTexturesIntoAtlases except this version runs as a coroutine to spread the load of baking textures at runtime across several frames. More...
 
class  MatAndTransformToMerged
 
class  MB_TexSet
 
class  MeshBakerMaterialTexture
 
class  SamplingRectEnclosesComparer
 

Public Member Functions

bool CombineTexturesIntoAtlases (ProgressUpdateDelegate progressInfo, MB_AtlasesAndRects resultAtlasesAndRects, Material resultMaterial, List< GameObject > objsToMesh, List< Material > allowedMaterialsFilter, MB2_EditorMethodsInterface textureEditorMethods=null)
 
IEnumerator CombineTexturesIntoAtlasesCoroutine (ProgressUpdateDelegate progressInfo, MB_AtlasesAndRects resultAtlasesAndRects, Material resultMaterial, List< GameObject > objsToMesh, List< Material > allowedMaterialsFilter, MB2_EditorMethodsInterface textureEditorMethods=null, CombineTexturesIntoAtlasesCoroutineResult coroutineResult=null, float maxTimePerFrame=.01f)
 
Texture2D GetAdjustedForScaleAndOffset2 (MeshBakerMaterialTexture source, Vector2 obUVoffset, Vector2 obUVscale)
 
IEnumerator CopyScaledAndTiledToAtlas (MeshBakerMaterialTexture source, MB_TexSet sourceMaterial, ShaderTextureProperty shaderPropertyName, DRect srcSamplingRect, int targX, int targY, int targW, int targH, bool _fixOutOfBoundsUVs, int maxSize, Color[][] atlasPixels, int atlasWidth, bool isNormalMap, ProgressUpdateDelegate progressInfo=null)
 
Texture2D _createTemporaryTexture (int w, int h, TextureFormat texFormat, bool mipMaps)
 
void SuggestTreatment (List< GameObject > objsToMesh, Material[] resultMaterials, List< ShaderTextureProperty > _customShaderPropNames)
 

Static Public Member Functions

static void RunCorutineWithoutPause (IEnumerator cor, int recursionDepth)
 summary>Combines meshes and generates texture atlases. More...
 
static Color GetColorIfNoTexture (ShaderTextureProperty texProperty)
 

Public Attributes

MB2_LogLevel LOG_LEVEL = MB2_LogLevel.info
 

Static Public Attributes

static bool DO_INTEGRITY_CHECKS = false
 
static ShaderTextureProperty [] shaderTexPropertyNames
 

Protected Attributes

MB2_TextureBakeResults _textureBakeResults
 
int _atlasPadding = 1
 
int _maxAtlasSize = 1
 
bool _resizePowerOfTwoTextures = false
 
bool _fixOutOfBoundsUVs = false
 
int _maxTilingBakeSize = 1024
 
bool _saveAtlasesAsAssets = false
 
MB2_PackingAlgorithmEnum _packingAlgorithm = MB2_PackingAlgorithmEnum.UnitysPackTextures
 
bool _meshBakerTexturePackerForcePowerOfTwo = true
 
List< ShaderTextureProperty_customShaderPropNames = new List<ShaderTextureProperty>()
 
bool _normalizeTexelDensity = false
 
bool _considerNonTextureProperties = false
 
TextureBlender resultMaterialTextureBlender
 
TextureBlender [] textureBlenders = new TextureBlender[0]
 
List< Texture2D > _temporaryTextures = new List<Texture2D>()
 

Properties

MB2_TextureBakeResults textureBakeResults [get, set]
 
int atlasPadding [get, set]
 
int maxAtlasSize [get, set]
 
bool resizePowerOfTwoTextures [get, set]
 
bool fixOutOfBoundsUVs [get, set]
 
int maxTilingBakeSize [get, set]
 
bool saveAtlasesAsAssets [get, set]
 
MB2_PackingAlgorithmEnum packingAlgorithm [get, set]
 
bool meshBakerTexturePackerForcePowerOfTwo [get, set]
 
List< ShaderTexturePropertycustomShaderPropNames [get, set]
 
bool considerNonTextureProperties [get, set]
 

Member Function Documentation

§ _createTemporaryTexture()

Texture2D DigitalOpus.MB.Core.MB3_TextureCombiner._createTemporaryTexture ( int  w,
int  h,
TextureFormat  texFormat,
bool  mipMaps 
)

§ CombineTexturesIntoAtlases()

bool DigitalOpus.MB.Core.MB3_TextureCombiner.CombineTexturesIntoAtlases ( ProgressUpdateDelegate  progressInfo,
MB_AtlasesAndRects  resultAtlasesAndRects,
Material  resultMaterial,
List< GameObject >  objsToMesh,
List< Material >  allowedMaterialsFilter,
MB2_EditorMethodsInterface  textureEditorMethods = null 
)

§ CombineTexturesIntoAtlasesCoroutine()

IEnumerator DigitalOpus.MB.Core.MB3_TextureCombiner.CombineTexturesIntoAtlasesCoroutine ( ProgressUpdateDelegate  progressInfo,
MB_AtlasesAndRects  resultAtlasesAndRects,
Material  resultMaterial,
List< GameObject >  objsToMesh,
List< Material >  allowedMaterialsFilter,
MB2_EditorMethodsInterface  textureEditorMethods = null,
CombineTexturesIntoAtlasesCoroutineResult  coroutineResult = null,
float  maxTimePerFrame = .01f 
)

§ CopyScaledAndTiledToAtlas()

IEnumerator DigitalOpus.MB.Core.MB3_TextureCombiner.CopyScaledAndTiledToAtlas ( MeshBakerMaterialTexture  source,
MB_TexSet  sourceMaterial,
ShaderTextureProperty  shaderPropertyName,
DRect  srcSamplingRect,
int  targX,
int  targY,
int  targW,
int  targH,
bool  _fixOutOfBoundsUVs,
int  maxSize,
Color  atlasPixels[][],
int  atlasWidth,
bool  isNormalMap,
ProgressUpdateDelegate  progressInfo = null 
)

§ GetAdjustedForScaleAndOffset2()

Texture2D DigitalOpus.MB.Core.MB3_TextureCombiner.GetAdjustedForScaleAndOffset2 ( MeshBakerMaterialTexture  source,
Vector2  obUVoffset,
Vector2  obUVscale 
)

§ GetColorIfNoTexture()

static Color DigitalOpus.MB.Core.MB3_TextureCombiner.GetColorIfNoTexture ( ShaderTextureProperty  texProperty)
static

§ RunCorutineWithoutPause()

static void DigitalOpus.MB.Core.MB3_TextureCombiner.RunCorutineWithoutPause ( IEnumerator  cor,
int  recursionDepth 
)
static

summary>Combines meshes and generates texture atlases.

NOTE running coroutines at runtime does not work in Unity 4

Parameters
progressInfoA delegate function that will be called to report progress.
textureEditorMethodsIf called from the editor should be an instance of MB2_EditorMethods. If called at runtime should be null.

Combines meshes and generates texture atlases

§ SuggestTreatment()

void DigitalOpus.MB.Core.MB3_TextureCombiner.SuggestTreatment ( List< GameObject >  objsToMesh,
Material []  resultMaterials,
List< ShaderTextureProperty _customShaderPropNames 
)

Member Data Documentation

§ _atlasPadding

int DigitalOpus.MB.Core.MB3_TextureCombiner._atlasPadding = 1
protected

§ _considerNonTextureProperties

bool DigitalOpus.MB.Core.MB3_TextureCombiner._considerNonTextureProperties = false
protected

§ _customShaderPropNames

List<ShaderTextureProperty> DigitalOpus.MB.Core.MB3_TextureCombiner._customShaderPropNames = new List<ShaderTextureProperty>()
protected

§ _fixOutOfBoundsUVs

bool DigitalOpus.MB.Core.MB3_TextureCombiner._fixOutOfBoundsUVs = false
protected

§ _maxAtlasSize

int DigitalOpus.MB.Core.MB3_TextureCombiner._maxAtlasSize = 1
protected

§ _maxTilingBakeSize

int DigitalOpus.MB.Core.MB3_TextureCombiner._maxTilingBakeSize = 1024
protected

§ _meshBakerTexturePackerForcePowerOfTwo

bool DigitalOpus.MB.Core.MB3_TextureCombiner._meshBakerTexturePackerForcePowerOfTwo = true
protected

§ _normalizeTexelDensity

bool DigitalOpus.MB.Core.MB3_TextureCombiner._normalizeTexelDensity = false
protected

§ _packingAlgorithm

MB2_PackingAlgorithmEnum DigitalOpus.MB.Core.MB3_TextureCombiner._packingAlgorithm = MB2_PackingAlgorithmEnum.UnitysPackTextures
protected

§ _resizePowerOfTwoTextures

bool DigitalOpus.MB.Core.MB3_TextureCombiner._resizePowerOfTwoTextures = false
protected

§ _saveAtlasesAsAssets

bool DigitalOpus.MB.Core.MB3_TextureCombiner._saveAtlasesAsAssets = false
protected

§ _temporaryTextures

List<Texture2D> DigitalOpus.MB.Core.MB3_TextureCombiner._temporaryTextures = new List<Texture2D>()
protected

§ _textureBakeResults

MB2_TextureBakeResults DigitalOpus.MB.Core.MB3_TextureCombiner._textureBakeResults
protected

§ DO_INTEGRITY_CHECKS

bool DigitalOpus.MB.Core.MB3_TextureCombiner.DO_INTEGRITY_CHECKS = false
static

§ LOG_LEVEL

MB2_LogLevel DigitalOpus.MB.Core.MB3_TextureCombiner.LOG_LEVEL = MB2_LogLevel.info

§ resultMaterialTextureBlender

TextureBlender DigitalOpus.MB.Core.MB3_TextureCombiner.resultMaterialTextureBlender
protected

§ shaderTexPropertyNames

ShaderTextureProperty [] DigitalOpus.MB.Core.MB3_TextureCombiner.shaderTexPropertyNames
static
Initial value:
= new ShaderTextureProperty[] {
new ShaderTextureProperty("_MainTex",false),
new ShaderTextureProperty("_BumpMap",true),
new ShaderTextureProperty("_Normal",true),
new ShaderTextureProperty("_BumpSpecMap",false),
new ShaderTextureProperty("_DecalTex",false),
new ShaderTextureProperty("_Detail",false),
new ShaderTextureProperty("_GlossMap",false),
new ShaderTextureProperty("_Illum",false),
new ShaderTextureProperty("_LightTextureB0",false),
new ShaderTextureProperty("_ParallaxMap",false),
new ShaderTextureProperty("_ShadowOffset",false),
new ShaderTextureProperty("_TranslucencyMap",false),
new ShaderTextureProperty("_SpecMap",false),
new ShaderTextureProperty("_SpecGlossMap",false),
new ShaderTextureProperty("_TranspMap",false),
new ShaderTextureProperty("_MetallicGlossMap",false),
new ShaderTextureProperty("_OcclusionMap",false),
new ShaderTextureProperty("_EmissionMap",false),
new ShaderTextureProperty("_DetailMask",false),
}

§ textureBlenders

TextureBlender [] DigitalOpus.MB.Core.MB3_TextureCombiner.textureBlenders = new TextureBlender[0]
protected

Property Documentation

§ atlasPadding

int DigitalOpus.MB.Core.MB3_TextureCombiner.atlasPadding
getset

§ considerNonTextureProperties

bool DigitalOpus.MB.Core.MB3_TextureCombiner.considerNonTextureProperties
getset

§ customShaderPropNames

List<ShaderTextureProperty> DigitalOpus.MB.Core.MB3_TextureCombiner.customShaderPropNames
getset

§ fixOutOfBoundsUVs

bool DigitalOpus.MB.Core.MB3_TextureCombiner.fixOutOfBoundsUVs
getset

§ maxAtlasSize

int DigitalOpus.MB.Core.MB3_TextureCombiner.maxAtlasSize
getset

§ maxTilingBakeSize

int DigitalOpus.MB.Core.MB3_TextureCombiner.maxTilingBakeSize
getset

§ meshBakerTexturePackerForcePowerOfTwo

bool DigitalOpus.MB.Core.MB3_TextureCombiner.meshBakerTexturePackerForcePowerOfTwo
getset

§ packingAlgorithm

MB2_PackingAlgorithmEnum DigitalOpus.MB.Core.MB3_TextureCombiner.packingAlgorithm
getset

§ resizePowerOfTwoTextures

bool DigitalOpus.MB.Core.MB3_TextureCombiner.resizePowerOfTwoTextures
getset

§ saveAtlasesAsAssets

bool DigitalOpus.MB.Core.MB3_TextureCombiner.saveAtlasesAsAssets
getset

§ textureBakeResults

MB2_TextureBakeResults DigitalOpus.MB.Core.MB3_TextureCombiner.textureBakeResults
getset

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