Exemple #1
0
	void IMeshRenderer.UpdateMesh(UIVertexBuffer buffer)
	{
		int bufferIndex = buffer.index;
		int vertexCount = m_vertices.Length;
		buffer.index += vertexCount / 4;

		for (int i = bufferIndex; i < buffer.index; ++i) {
			int cIndex = i * 4;
			var bc = buffer.vertices[cIndex].color;
			if (bc.r != m_color.r ||
					bc.g != m_color.g ||
					bc.b != m_color.b ||
					bc.a != m_color.a) {
				buffer.modified = true;
				for (int j = 0; j < 4; ++j)
					buffer.vertices[cIndex + j].color = m_color;
			}
		}

		if (m_updated || m_buffer != buffer ||
				m_bufferIndex != bufferIndex || buffer.initialized) {
			m_buffer = buffer;
			m_bufferIndex = bufferIndex;
			buffer.modified = true;
			int index = bufferIndex * 4;
			for (int i = 0; i < vertexCount; ++i) {
				buffer.vertices[index + i].uv0 = m_uv[i];
				buffer.vertices[index + i].position =
					m_matrixForRender.MultiplyPoint3x4(m_vertices[i]);
			}
		}
	}
Exemple #2
0
 public TextMeshRenderer(LWF lwf, UnityRenderer.TextContext context)
     : base(lwf, context)
 {
     m_matrix          = new Matrix(0, 0, 0, 0, 0, 0);
     m_matrixForRender = new Matrix4x4();
     m_colorMult       = new UnityEngine.Color();
     m_colorAdd        = new UnityEngine.Color();
     m_color           = new Color32();
     m_z           = -1;
     m_updated     = false;
     m_buffer      = null;
     m_bufferIndex = -1;
 }
Exemple #3
0
 public BitmapRenderer(LWF lwf, BitmapContext context) : base(lwf)
 {
     m_context         = context;
     m_matrix          = new Matrix(0, 0, 0, 0, 0, 0);
     m_matrixForRender = new Matrix4x4();
     m_colorMult       = new UnityEngine.Color();
     m_colorAdd        = new UnityEngine.Color();
     m_blendMode       = (int)Format.Constant.BLEND_MODE_NORMAL;
     m_z           = -1;
     m_updated     = false;
     m_buffer      = null;
     m_bufferIndex = -1;
 }
Exemple #4
0
	public TextMeshRenderer(LWF lwf, UnityRenderer.TextContext context)
		: base(lwf, context)
	{
		m_matrix = new Matrix(0, 0, 0, 0, 0, 0);
		m_matrixForRender = new Matrix4x4();
		m_colorMult = new UnityEngine.Color();
		m_colorAdd = new UnityEngine.Color();
		m_color = new Color32();
		m_z = -1;
		m_updated = false;
		m_buffer = null;
		m_bufferIndex = -1;
	}
	public void Init(Factory factory)
	{
		useLegacyMeshGeneration = false;

		renderers = new List<IMeshRenderer>();

		UpdateSortingLayerAndOrder(factory);
		UpdateLayer(factory);

		if (factory.useAdditionalColor) {
			additionalColor = UnityEngine.Color.clear;
			property = new MaterialPropertyBlock();
			additionalColorId = Shader.PropertyToID("_AdditionalColor");
		}

		buffer = new UIVertexBuffer();
	}
            public void Init(Factory factory)
            {
                renderers = new List <IMeshRenderer>();

                canvasRenderer = gameObject.AddComponent <UnityEngine.CanvasRenderer>();
                UpdateSortingLayerAndOrder(factory);
                UpdateLayer(factory);

                if (factory.useAdditionalColor)
                {
                    additionalColor   = UnityEngine.Color.clear;
                    property          = new MaterialPropertyBlock();
                    additionalColorId = Shader.PropertyToID("_AdditionalColor");
                }

                buffer = new UIVertexBuffer();
            }
            public void Init(Factory factory)
            {
                useLegacyMeshGeneration = false;

                renderers = new List <IMeshRenderer>();

                UpdateSortingLayerAndOrder(factory);
                UpdateLayer(factory);

                if (factory.useAdditionalColor)
                {
                    additionalColor   = UnityEngine.Color.clear;
                    property          = new MaterialPropertyBlock();
                    additionalColorId = Shader.PropertyToID("_AdditionalColor");
                }

                buffer = new UIVertexBuffer();
            }
Exemple #8
0
            void IMeshRenderer.UpdateMesh(UIVertexBuffer buffer)
            {
                int bufferIndex = buffer.index;
                int vertexCount = m_vertices.Length;

                buffer.index += vertexCount / 4;

                for (int i = bufferIndex; i < buffer.index; ++i)
                {
                    int cIndex = i * 4;
                    var bc     = buffer.vertices[cIndex].color;
                    if (bc.r != m_color.r ||
                        bc.g != m_color.g ||
                        bc.b != m_color.b ||
                        bc.a != m_color.a)
                    {
                        buffer.modified = true;
                        for (int j = 0; j < 4; ++j)
                        {
                            buffer.vertices[cIndex + j].color = m_color;
                        }
                    }
                }

                if (m_updated || m_buffer != buffer ||
                    m_bufferIndex != bufferIndex || buffer.initialized)
                {
                    m_buffer        = buffer;
                    m_bufferIndex   = bufferIndex;
                    buffer.modified = true;
                    int index = bufferIndex * 4;
                    for (int i = 0; i < vertexCount; ++i)
                    {
                        buffer.vertices[index + i].uv0      = m_uv[i];
                        buffer.vertices[index + i].position =
                            m_matrixForRender.MultiplyPoint3x4(m_vertices[i]);
                    }
                }
            }
Exemple #9
0
            void IMeshRenderer.UpdateMesh(UIVertexBuffer buffer)
            {
                int bufferIndex = buffer.index++;

                Color32 color32 = m_colorMult;

                int     index = bufferIndex * 4;
                Color32 bc    = buffer.vertices[index].color;

                if (buffer.initialized ||
                    bc.r != color32.r ||
                    bc.g != color32.g ||
                    bc.b != color32.b ||
                    bc.a != color32.a)
                {
                    buffer.modified = true;
                    for (int i = 0; i < 4; ++i)
                    {
                        buffer.vertices[index + i].color = color32;
                    }
                }

                if (m_updated || m_buffer != buffer ||
                    m_bufferIndex != bufferIndex || buffer.initialized)
                {
                    m_buffer        = buffer;
                    m_bufferIndex   = bufferIndex;
                    buffer.modified = true;
                    for (int i = 0; i < 4; ++i)
                    {
                        buffer.vertices[index + i].uv0      = m_context.uv[i];
                        buffer.vertices[index + i].position =
                            m_matrixForRender.MultiplyPoint3x4(m_context.vertices[i]);
                    }
                }
            }
            public void Init(Factory factory)
            {
                renderers = new List<IMeshRenderer>();

                canvasRenderer = gameObject.AddComponent<UnityEngine.CanvasRenderer>();
                UpdateSortingLayerAndOrder(factory);
                UpdateLayer(factory);

                if (factory.useAdditionalColor) {
                additionalColor = UnityEngine.Color.clear;
                property = new MaterialPropertyBlock();
                additionalColorId = Shader.PropertyToID("_AdditionalColor");
                }

                buffer = new UIVertexBuffer();
            }
	void IMeshRenderer.UpdateMesh(UIVertexBuffer buffer)
	{
		int bufferIndex = buffer.index++;

		Color32 color32 = m_colorMult;

		int index = bufferIndex * 4;
		Color32 bc = buffer.vertices[index].color;
		if (buffer.initialized ||
				bc.r != color32.r ||
				bc.g != color32.g ||
				bc.b != color32.b ||
				bc.a != color32.a) {
			buffer.modified = true;
			for (int i = 0; i < 4; ++i)
				buffer.vertices[index + i].color = color32;
		}

		if (m_updated || m_buffer != buffer ||
				m_bufferIndex != bufferIndex || buffer.initialized) {
			m_buffer = buffer;
			m_bufferIndex = bufferIndex;
			buffer.modified = true;
			for (int i = 0; i < 4; ++i) {
				buffer.vertices[index + i].uv0 = m_context.uv[i];
				buffer.vertices[index + i].position =
					m_matrixForRender.MultiplyPoint3x4(m_context.vertices[i]);
			}
		}
	}
	public BitmapRenderer(LWF lwf, BitmapContext context) : base(lwf)
	{
		m_context = context;
		m_matrix = new Matrix(0, 0, 0, 0, 0, 0);
		m_matrixForRender = new Matrix4x4();
		m_colorMult = new UnityEngine.Color();
		m_colorAdd = new UnityEngine.Color();
		m_blendMode = (int)Format.Constant.BLEND_MODE_NORMAL;
		m_z = -1;
		m_updated = false;
		m_buffer = null;
		m_bufferIndex = -1;
	}