private void SetupMaterial(ref TextureMergeRect textureMergeRect, UMAData.MaterialFragment source, int i2, ref Rect overlayRect, int textureType) { textureMergeRect.rect = overlayRect; textureMergeRect.tex = source.overlays[i2].textureList[textureType]; if (source.overlays[i2].overlayType == OverlayDataAsset.OverlayType.Normal) { switch (source.slotData.asset.material.channels[textureType].channelType) { case UMAMaterial.ChannelType.NormalMap: textureMergeRect.mat.shader = normalShader; break; case UMAMaterial.ChannelType.Texture: textureMergeRect.mat.shader = dataShader; break; case UMAMaterial.ChannelType.DiffuseTexture: textureMergeRect.mat.shader = diffuseShader; break; } textureMergeRect.mat.SetTexture("_MainTex", source.overlays[i2].textureList[textureType]); textureMergeRect.mat.SetTexture("_ExtraTex", source.overlays[i2].alphaTexture); textureMergeRect.mat.SetColor("_Color", source.GetMultiplier(i2 + 1, textureType)); textureMergeRect.mat.SetColor("_AdditiveColor", source.GetAdditive(i2 + 1, textureType)); } else { textureMergeRect.mat.shader = cutoutShader; } }
private void SetupMaterial(ref TextureMergeRect textureMergeRect, UMAData.MaterialFragment source, int textureType) { camBackgroundColor = source.GetMultiplier(0, textureType); camBackgroundColor.a = 0.0f; textureMergeRect.tex = source.baseOverlay.textureList[textureType]; switch (source.slotData.asset.material.channels[textureType].channelType) { case UMAMaterial.ChannelType.NormalMap: textureMergeRect.mat.shader = normalShader; break; case UMAMaterial.ChannelType.Texture: textureMergeRect.mat.shader = dataShader; break; case UMAMaterial.ChannelType.DiffuseTexture: textureMergeRect.mat.shader = diffuseShader; break; case UMAMaterial.ChannelType.DetailNormalMap: textureMergeRect.mat.shader = detailNormalShader; break; } textureMergeRect.mat.SetTexture("_MainTex", source.baseOverlay.textureList[textureType]); textureMergeRect.mat.SetTexture("_ExtraTex", source.baseOverlay.alphaTexture); textureMergeRect.mat.SetColor("_Color", source.GetMultiplier(0, textureType)); textureMergeRect.mat.SetColor("_AdditiveColor", source.GetAdditive(0, textureType)); }
private void SetupMaterial(ref TextureMergeRect textureMergeRect, UMAData.MaterialFragment source, int textureType) { textureMergeRect.tex = source.baseOverlay.textureList[textureType]; switch (source.slotData.asset.material.channels[textureType].channelType) { case UMAMaterial.ChannelType.NormalMap: textureMergeRect.mat.shader = normalShader; foreach (UMAPostProcess process in normalPostProcesses) { process.enabled = true; } break; case UMAMaterial.ChannelType.Texture: textureMergeRect.mat.shader = dataShader; foreach (UMAPostProcess process in dataPostProcesses) { process.enabled = true; } break; case UMAMaterial.ChannelType.DiffuseTexture: textureMergeRect.mat.shader = diffuseShader; foreach (UMAPostProcess process in diffusePostProcesses) { process.enabled = true; } break; } textureMergeRect.mat.SetTexture("_MainTex", source.baseOverlay.textureList[textureType]); textureMergeRect.mat.SetTexture("_ExtraTex", source.baseOverlay.alphaTexture); textureMergeRect.mat.SetColor("_Color", source.GetMultiplier(0, textureType)); textureMergeRect.mat.SetColor("_AdditiveColor", source.GetAdditive(0, textureType)); }
private void DrawRect(ref TextureMergeRect tr, bool sharperFitTextures) { if (tr.tex == null) { return; } if (tr.transform) { // rotate texture here? GL.PushMatrix(); // rotate around the pivot pivotPoint.Set(tr.rect.x + (tr.rect.width / 2.0f), tr.rect.y + (tr.rect.height / 2.0f)); Matrix4x4 newMat = Matrix4x4.TRS(pivotPoint, Quaternion.Euler(0, 0, tr.rotation), tr.scale) * Matrix4x4.TRS(-pivotPoint, Quaternion.identity, Vector3.one); GL.MultMatrix(newMat); } if (sharperFitTextures) { tr.tex.mipMapBias = -1.0f; } else { tr.tex.mipMapBias = 0f; } Graphics.DrawTexture(tr.rect, tr.tex, tr.mat); if (tr.transform) { GL.PopMatrix(); } }
private void SetupMaterial(ref TextureMergeRect textureMergeRect, UMAData.MaterialFragment source, int textureType) { textureMergeRect.tex = source.baseTexture[textureType]; textureMergeRect.mat.shader = (textureType == 1)? normalShader : diffuseShader; textureMergeRect.mat.SetTexture("_MainTex", source.baseTexture[textureType]); textureMergeRect.mat.SetTexture("_ExtraTex", source.baseTexture[0]); textureMergeRect.mat.SetColor("_Color", source.GetMultiplier(0, textureType)); textureMergeRect.mat.SetColor("_AdditiveColor", source.GetAdditive(0, textureType)); }
private void SetupMaterial(ref TextureMergeRect textureMergeRect, UMAData.MaterialFragment source, int i2, ref Rect overlayRect, int textureType) { textureMergeRect.rect = overlayRect; textureMergeRect.tex = source.overlays[i2].textureList[textureType]; textureMergeRect.mat.shader = (source.slotData.asset.material.channels[textureType].channelType == UMAMaterial.ChannelType.NormalMap) ? normalShader : diffuseShader; textureMergeRect.mat.SetTexture("_MainTex", source.overlays[i2].textureList[textureType]); textureMergeRect.mat.SetTexture("_ExtraTex", source.overlays[i2].textureList[0]); textureMergeRect.mat.SetColor("_Color", source.GetMultiplier(i2 + 1, textureType)); textureMergeRect.mat.SetColor("_AdditiveColor", source.GetAdditive(i2 + 1, textureType)); }
private void DrawRect(ref TextureMergeRect textureMergeRect) { Graphics.DrawTexture(textureMergeRect.rect, textureMergeRect.tex, textureMergeRect.mat); }
private void DrawRect(ref TextureMergeRect textureMergeRect) { //TODO JRRM: add an event here and let the end user modify the textureMertRect.tex if needed. Graphics.DrawTexture(textureMergeRect.rect, textureMergeRect.tex, textureMergeRect.mat); }