Пример #1
0
 public Property(LWF lwf)
 {
     m_lwf            = lwf;
     m_matrix         = new Matrix();
     m_colorTransform = new ColorTransform();
     ClearRenderingOffset();
 }
Пример #2
0
            public override void BeginRender(LWF lwf)
            {
                base.BeginRender(lwf);

                parent = null;
                var lwfParent = lwf.GetParent();

                if (lwfParent != null)
                {
                    parent = lwfParent.rendererFactory as Factory;
                }
                if (parent != null)
                {
                    return;
                }

                needsUpdate = false;
                if (updateCount != lwf.updateCount)
                {
                    needsUpdate          = true;
                    updateCount          = lwf.updateCount;
                    meshComponentNo      = -1;
                    currentMeshComponent = null;
                }
            }
Пример #3
0
        public BitmapClip(LWF lwf, Movie parent, int objId)
            : base(lwf, parent, objId)
        {
            var data     = lwf.data.bitmaps[objId];
            var fragment = lwf.data.textureFragments[data.textureFragmentId];
            var texdata  = lwf.data.textures[fragment.textureId];

            width  = fragment.w / texdata.scale;
            height = fragment.h / texdata.scale;

            depth   = -1;
            visible = true;

            regX     = 0;
            regY     = 0;
            x        = 0;
            y        = 0;
            scaleX   = 0;
            scaleY   = 0;
            rotation = 0;
            alpha    = 1;

            _scaleX   = scaleX;
            _scaleY   = scaleY;
            _rotation = rotation;
            _cos      = 1;
            _sin      = 0;

            _matrix = new Matrix();
        }
Пример #4
0
            public override void EndRender(LWF lwf)
            {
                base.EndRender(lwf);

                if (parent != null)
                {
                    return;
                }

                if (currentMeshComponent == null)
                {
                    for (int i = 0; i <= usedMeshComponentNo; ++i)
                    {
                        meshComponents[i].Disable();
                    }
                    usedMeshComponentNo = -1;
                    return;
                }

                for (int i = 0; i <= meshComponentNo; ++i)
                {
                    meshComponents[i].UpdateMesh();
                }

                for (int i = meshComponentNo + 1; i <= usedMeshComponentNo; ++i)
                {
                    meshComponents[i].Disable();
                }
                usedMeshComponentNo = meshComponentNo;
            }
Пример #5
0
	public BitmapClip(LWF lwf, Movie parent, int objId)
		: base(lwf, parent, objId)
	{
		var data = lwf.data.bitmaps[objId];
		var fragment = lwf.data.textureFragments[data.textureFragmentId];
		var texdata = lwf.data.textures[fragment.textureId];
		width = fragment.w / texdata.scale;
		height = fragment.h / texdata.scale;
		offsetX = fragment.x;
		offsetY = fragment.y;
		originalWidth = fragment.ow;
		originalHeight = fragment.oh;

		depth = -1;
		visible = true;

		regX = 0;
		regY = 0;
		x = 0;
		y = 0;
		scaleX = 0;
		scaleY = 0;
		rotation = 0;
		alpha = 1;

		_scaleX = scaleX;
		_scaleY = scaleY;
		_rotation = rotation;
		_cos = 1;
		_sin = 0;

		_matrix = new Matrix();
	}
Пример #6
0
            public override void BeginRender(LWF lwf)
            {
                base.BeginRender(lwf);

                if (buffer.objects == null || buffer.objects.Length != bitmapCount)
                {
                    updated     = true;
                    updateCount = lwf.updateCount;
                    buffer.Alloc(bitmapCount);
                }
                else
                {
                    buffer.clean   = false;
                    buffer.changed = false;
                    if (updateCount != lwf.updateCount)
                    {
                        updated     = true;
                        updateCount = lwf.updateCount;
                    }
                    else
                    {
                        updated = false;
                    }
                }

                buffer.index = 0;
            }
Пример #7
0
            public TextRenderer(LWF lwf, TextContext context) : base(lwf)
            {
                m_context      = context;
                m_matrix       = new Matrix4x4();
                m_renderMatrix = new Matrix4x4();
                m_colorMult    = new UnityEngine.Color();
#if LWF_USE_ADDITIONALCOLOR
                m_colorAdd = new UnityEngine.Color();
#endif
                if (m_context != null && m_context.systemFontRenderer != null)
                {
                    ISystemFontRenderer.Parameter p =
                        context.systemFontRendererParameter;
                    float scale = lwf.scaleByStage;
                    m_context.systemFontRenderer.Init(
                        p.mSize * scale,
                        p.mWidth * scale,
                        p.mHeight * scale,
                        p.mStyle,
                        p.mAlign,
                        p.mVerticalAlign,
                        p.mLineSpacing * scale,
                        p.mLetterSpacing * scale,
                        p.mLeftMargin * scale,
                        p.mRightMargin * scale);
                }

                CombinedMeshRenderer.Factory factory =
                    lwf.rendererFactory as CombinedMeshRenderer.Factory;
                if (factory != null)
                {
                    m_shouldBeOnTop = true;
                    m_zOffset       = Mathf.Abs(factory.zRate);
                }
            }
Пример #8
0
	public Property(LWF lwf)
	{
		m_lwf = lwf;
		m_matrix = new Matrix();
		m_colorTransform = new ColorTransform();
		ClearRenderingOffset();
	}
Пример #9
0
            public override void EndRender(LWF lwf)
            {
                base.EndRender(lwf);

                if (!updated)
                {
                    return;
                }

                if (buffer.index == 0)
                {
                    if (mesh.vertices != null && mesh.vertices.Length > 0)
                    {
                        mesh.Clear(true);
                    }
                    return;
                }

                if (buffer.changed)
                {
                    mesh.Clear(true);
                    mesh.vertices  = buffer.vertices;
                    mesh.uv        = buffer.uv;
                    mesh.triangles = buffer.triangles;
                }
                else
                {
                    mesh.vertices = buffer.vertices;
                }
                mesh.colors32 = buffer.colors32;
                mesh.RecalculateBounds();
                //mesh.Optimize();
            }
Пример #10
0
        public BitmapClip(LWF lwf, Movie parent, int objId)
            : base(lwf, parent, objId)
        {
            m_dataMatrixId = lwf.data.bitmaps[objId].matrixId;
            var data = lwf.data.bitmaps[objId];
            var fragment = lwf.data.textureFragments[data.textureFragmentId];
            var texdata = lwf.data.textures[fragment.textureId];
            width = fragment.w / texdata.scale;
            height = fragment.h / texdata.scale;
            m_renderer = lwf.rendererFactory.ConstructBitmap(lwf, objId, this);

            depth = -1;
            visible = true;

            regX = 0;
            regY = 0;
            x = 0;
            y = 0;
            scaleX = 0;
            scaleY = 0;
            rotation = 0;
            alpha = 1;

            _scaleX = scaleX;
            _scaleY = scaleY;
            _rotation = rotation;
            _cos = 1;
            _sin = 0;

            _matrix = new Matrix();
        }
Пример #11
0
        public Text(LWF lwf, Movie p, int objId, int instId = -1)
            : base(lwf, p, Format.Object.Type.TEXT, objId)
        {
            Format.Text text = lwf.data.texts[objId];
            m_dataMatrixId = text.matrixId;

            if (text.nameStringId != -1) {
            m_name = lwf.data.strings[text.nameStringId];
            } else {
            if (instId >= 0 && instId < lwf.data.instanceNames.Length) {
                int stringId = lwf.GetInstanceNameStringId(instId);
                if (stringId != -1)
                    m_name = lwf.data.strings[stringId];
            }
            }

            TextRenderer textRenderer =
            lwf.rendererFactory.ConstructText(lwf, objId, this);

            string t = null;
            if (text.stringId != -1)
            t = lwf.data.strings[text.stringId];

            if (text.nameStringId == -1 && string.IsNullOrEmpty(name)) {
            if (text.stringId != -1)
                textRenderer.SetText(t);
            } else {
            lwf.SetTextRenderer(p.GetFullName(), name, t, textRenderer);
            }

            m_renderer = textRenderer;
        }
Пример #12
0
            public TextRenderer(LWF lwf, TextContext context) : base(lwf)
            {
                m_context      = context;
                m_matrix       = new Matrix4x4();
                m_renderMatrix = new Matrix4x4();
                m_colorMult    = new UnityEngine.Color();
#if LWF_USE_ADDITIONALCOLOR
                m_colorAdd = new UnityEngine.Color();
#endif
                if (m_context.systemFontRenderer != null)
                {
                    ISystemFontRenderer.Parameter p =
                        context.systemFontRendererParameter;
                    float scale = lwf.scaleByStage;
                    m_context.systemFontRenderer.Init(
                        p.mSize * scale,
                        p.mWidth * scale,
                        p.mHeight * scale,
                        p.mStyle,
                        p.mAlign,
                        p.mVerticalAlign,
                        p.mLineSpacing * scale,
                        p.mLetterSpacing * scale,
                        p.mLeftMargin * scale,
                        p.mRightMargin * scale);
                }
            }
Пример #13
0
	public TextMeshRenderer(LWF lwf, TextContext context) : base(lwf, context)
	{
		m_mesh = new Mesh();
		m_matrix = new Matrix4x4();
		m_renderMatrix = new Matrix4x4();
		m_colorMult = new UnityEngine.Color();
		m_colorAdd = new UnityEngine.Color();
		m_color = new Color32();
	}
Пример #14
0
 public BitmapRenderer(LWF lwf, BitmapContext context) : base(lwf)
 {
     m_context      = context;
     m_property     = new MaterialPropertyBlock();
     m_matrix       = new Matrix4x4();
     m_renderMatrix = new Matrix4x4();
     m_colorMult    = new UnityEngine.Color();
     m_colorAdd     = new UnityEngine.Color();
 }
Пример #15
0
    void enterFrameCallback( LWF.Movie movie )
    {
        if (movie.currentFrame == movie.totalFrames
            || !movie.playing) {

            message += movie.GetFullName() + " is done \n";
            lwf.rootMovie.DetachMovie( movie );
        }
    }
Пример #16
0
 public TextMeshRenderer(LWF lwf, TextContext context) : base(lwf, context)
 {
     m_mesh         = new Mesh();
     m_matrix       = new Matrix4x4();
     m_renderMatrix = new Matrix4x4();
     m_colorMult    = new UnityEngine.Color();
     m_colorAdd     = new UnityEngine.Color();
     m_color        = new Color32();
 }
Пример #17
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;
 }
Пример #18
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;
 }
Пример #19
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_z       = -1;
     m_updated = false;
 }
Пример #20
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;
 }
Пример #21
0
 public BitmapRenderer(LWF lwf, BitmapContext context) : base(lwf)
 {
     m_context           = context;
     m_property          = new MaterialPropertyBlock();
     m_matrix            = new Matrix4x4();
     m_renderMatrix      = new Matrix4x4();
     m_colorMult         = new UnityEngine.Color();
     m_colorAdd          = new UnityEngine.Color();
     m_colorId           = Shader.PropertyToID("_Color");
     m_additionalColorId = Shader.PropertyToID("_AdditionalColor");
 }
Пример #22
0
 public BitmapRenderer(LWF lwf, BitmapContext context) : base(lwf)
 {
     m_context           = context;
     m_property          = new MaterialPropertyBlock();
     m_matrix            = new Matrix4x4();
     m_renderMatrix      = new Matrix4x4();
     m_colorMult         = new UnityEngine.Color();
     m_colorAdd          = new UnityEngine.Color();
     m_blendMode         = (int)Format.Constant.BLEND_MODE_NORMAL;
     m_colorId           = Shader.PropertyToID("_Color");
     m_additionalColorId = Shader.PropertyToID("_AdditionalColor");
 }
Пример #23
0
		public ObjectContainer(
			LWFObject lo, LWF.Object o, int h, int d, int ri, int rc, int ro)
		{
			lwfObject = lo;
			obj = o;
			hierarchy = h;
			depth = d;
			renderingIndex = ri;
			renderingCount = rc;
			renderingOffset = ro;
			objects = new Dictionary<int, ObjectContainer>();
		}
Пример #24
0
        public Text(LWF lwf, Movie p, int objId, int instId = -1)
            : base(lwf, p, Format.Object.Type.TEXT, objId)
        {
            Format.Text text = lwf.data.texts[objId];
            m_dataMatrixId = text.matrixId;

            if (text.nameStringId != -1)
            {
                m_name = lwf.data.strings[text.nameStringId];
            }
            else
            {
                if (instId >= 0 && instId < lwf.data.instanceNames.Length)
                {
                    int stringId = lwf.GetInstanceNameStringId(instId);
                    if (stringId != -1)
                    {
                        m_name = lwf.data.strings[stringId];
                    }
                }
            }

            TextRenderer textRenderer =
                lwf.rendererFactory.ConstructText(lwf, objId, this);

            string t = null;

            if (text.stringId != -1)
            {
                t = lwf.data.strings[text.stringId];
            }

            if (text.nameStringId == -1 && string.IsNullOrEmpty(name))
            {
                if (text.stringId != -1)
                {
                    textRenderer.SetText(t);
                }
            }
            else
            {
#if LWF_USE_LUA
                string lt = lwf.GetTextLua(parent, name);
                if (!System.String.IsNullOrEmpty(lt))
                {
                    t = lt;
                }
#endif
                lwf.SetTextRenderer(p.GetFullName(), name, t, textRenderer);
            }

            m_renderer = textRenderer;
        }
Пример #25
0
            public BitmapRenderer(LWF lwf, BitmapContext context) : base(lwf)
            {
                m_context   = context;
                m_matrix    = new Matrix4x4();
                m_colorMult = new UnityEngine.Color();
                m_colorAdd  = new UnityEngine.Color();
                m_available = false;

                if (m_context != null)
                {
                    m_context.factory.AddBitmap();
                }
            }
Пример #26
0
            public BitmapRenderer(LWF lwf, BitmapContext context) : base(lwf)
            {
                m_context   = context;
                m_matrix    = new Matrix4x4();
                m_colorMult = new UnityEngine.Color();
#if LWF_USE_ADDITIONALCOLOR
                m_colorAdd = new UnityEngine.Color();
#endif

                if (m_context != null)
                {
                    m_context.factory.AddBitmap();
                }
            }
Пример #27
0
	void DrawInfo(ObjectContainer container, LWF.Object obj)
	{
		LWF.Matrix m = obj.matrix;
		EditorGUILayout.LabelField("Matrix", string.Format(
			"(sx:{0}, sy:{1}, k0:{2}, k1:{3}, tx:{4}, ty:{5}) ri:{6} rc:{7}",
			m.scaleX, m.scaleY, m.skew0, m.skew1, m.translateX, m.translateY,
			container.renderingIndex, container.renderingCount));

		LWF.ColorTransform c = obj.colorTransform;
		EditorGUILayout.LabelField("ColorTransform",
			string.Format("multi:(r:{0},g:{1},b:{2},a:{3}) " +
				"add:(r:{4},g:{5},b:{6},a:{7})",
			c.multi.red, c.multi.green, c.multi.blue, c.multi.alpha,
			c.add.red, c.add.green, c.add.blue, c.add.alpha));
	}
Пример #28
0
	public RendererFactoryArguments(LWF.Data d, GameObject gObj, float zOff,
		float zR, int rQOff, bool uAC, Camera cam, string texturePrfx,
		string fontPrfx, TextureLoader textureLdr, TextureUnloader textureUnldr)
	{
		data = d;
		gameObject = gObj;
		zOffset = zOff;
		zRate = zR;
		renderQueueOffset = rQOff;
		useAdditionalColor = uAC;
		camera = cam;
		texturePrefix = texturePrfx;
		fontPrefix = fontPrfx;
		textureLoader = textureLdr;
		textureUnloader = textureUnldr;
	}
Пример #29
0
 public BitmapRenderer(LWF lwf, BitmapContext context, LWFObject lwfObj) : base(lwf)
 {
     m_context      = context;
     m_matrix       = new Matrix4x4();
     m_renderMatrix = new Matrix4x4();
     m_colorMult    = new UnityEngine.Color();
     m_colorAdd     = new UnityEngine.Color();
     m_blendMode    = (int)Format.Constant.BLEND_MODE_NORMAL;
     if (!m_getId)
     {
         m_colorId           = Shader.PropertyToID("_Color");
         m_additionalColorId = Shader.PropertyToID("_AdditionalColor");
         m_getId             = true;
     }
     m_lwfObject = lwfObj;
 }
Пример #30
0
            public Vector3 WorldToLWFPoint(LWF lwf, Vector3 p)
            {
                Matrix4x4 gm = gameObject.transform.worldToLocalMatrix;

                Matrix lm = lwf.rootMovie.matrix;

                matrix.m00 = lm.scaleX;
                matrix.m01 = lm.skew0;
                matrix.m03 = lm.translateX;

                matrix.m10 = lm.skew1;
                matrix.m11 = lm.scaleY;
                matrix.m13 = lm.translateY;

                return(matrix.inverse.MultiplyPoint(gm.MultiplyPoint(p)));
            }
Пример #31
0
    void DrawButton(LWF.Button button, Factory factory)
    {
        Matrix4x4 savedMatrix = GUI.matrix;
        Color savedColor = GUI.color;

        factory.ConvertMatrix(ref matrix, button.matrix, 0, button.height);
        Factory.MultiplyMatrix(ref renderMatrix,
            factory.gameObject.transform.localToWorldMatrix, matrix);
        Camera camera = factory.camera;

        Matrix4x4 m = renderMatrix;
        Vector2 lt = GUIUtility.ScreenToGUIPoint(camera.WorldToScreenPoint(
            m.MultiplyPoint(new Vector3(0, button.height))));
        Vector2 rt = GUIUtility.ScreenToGUIPoint(camera.WorldToScreenPoint(
            m.MultiplyPoint(new Vector3(button.width, button.height))));
        Vector2 ld = GUIUtility.ScreenToGUIPoint(camera.WorldToScreenPoint(
            m.MultiplyPoint(new Vector3(0, 0))));

        float dx = rt.x - lt.x;
        float dy = rt.y - lt.y;
        float w = Mathf.Sqrt(dx * dx + dy * dy);
        dx = ld.x - lt.x;
        dy = ld.y - lt.y;
        float h = Mathf.Sqrt(dx * dx + dy * dy);
        float angle =
            Mathf.Atan2(rt.x - lt.x, rt.y - lt.y) * Mathf.Rad2Deg - 90;
        lt.y = Screen.height - lt.y;
        GUIUtility.RotateAroundPivot(angle, lt);

        GUI.color = button == button.lwf.focus ?
            LWFObjectInspector.focusButtonColor :
                LWFObjectInspector.buttonColor;
        GUI.DrawTexture(new Rect(lt.x, lt.y, w, h), texture);

        GUI.matrix = savedMatrix;
        GUI.color = savedColor;
    }
Пример #32
0
            public UnityTextRenderer(LWF lwf, int objectId) : base(lwf)
            {
                Factory factory = lwf.rendererFactory as Factory;

                m_context = new TextContext(
                    factory, factory.gameObject, lwf.data, objectId);
                m_matrix       = new Matrix4x4();
                m_renderMatrix = new Matrix4x4();
                m_colorMult    = new UnityEngine.Color();
                m_colorAdd     = new UnityEngine.Color();
                if (m_context != null && m_context.systemFontRenderer != null)
                {
                    ISystemFontRenderer.Parameter p =
                        m_context.systemFontRendererParameter;
                    float scale = lwf.scaleByStage;
                    m_context.systemFontRenderer.Init(
                        p.mSize * scale,
                        p.mWidth * scale,
                        p.mHeight * scale,
                        p.mStyle,
                        p.mAlign,
                        p.mVerticalAlign,
                        p.mLineSpacing * scale,
                        p.mLetterSpacing * scale,
                        p.mLeftMargin * scale,
                        p.mRightMargin * scale);
                }

                CombinedMeshRenderer.Factory c =
                    lwf.rendererFactory as CombinedMeshRenderer.Factory;
                if (c != null)
                {
                    m_shouldBeOnTop = true;
                    m_zOffset       = Mathf.Abs(c.zRate);
                }
            }
Пример #33
0
            public BitmapContext(Factory f,
                                 Data d, Format.BitmapEx bitmapEx, int bId)
            {
                m_factory    = f;
                m_data       = d;
                m_bitmapExId = bId;

                Format.TextureFragment fragment =
                    data.textureFragments[bitmapEx.textureFragmentId];
                Format.Texture texture = data.textures[fragment.textureId];

                m_textureName = factory.texturePrefix + texture.filename;
                if (LWF.GetTextureLoadHandler() != null)
                {
                    m_textureName = LWF.GetTextureLoadHandler()(
                        m_textureName, factory.texturePrefix, texture.filename);
                }

                m_premultipliedAlpha = (texture.format ==
                                        (int)Format.Constant.TEXTUREFORMAT_PREMULTIPLIEDALPHA);

                m_material = ResourceCache.SharedInstance().LoadTexture(
                    data.name, m_textureName, texture.format,
                    factory.useAdditionalColor, factory.textureLoader,
                    factory.textureUnloader, factory.shaderName);
                if (factory.renderQueueOffset != 0)
                {
                    m_material.renderQueue += factory.renderQueueOffset;
                }

                MeshContext c = ResourceCache.SharedInstance().LoadMesh(
                    data.name, data, bitmapEx, bitmapExId);

                m_mesh   = c.mesh;
                m_height = c.height;
            }
Пример #34
0
 public virtual void BeginRender(LWF lwf)
 {
 }
Пример #35
0
 public virtual void EndRender(LWF lwf)
 {
 }
Пример #36
0
	static void setBlendMode(LWF.Movie o, string v)
	{
		switch (v.ToLower()) {
		default:
			o.blendMode = (int)LWF.Format.Constant.BLEND_MODE_NORMAL;
			break;
		case "add":
			o.blendMode = (int)LWF.Format.Constant.BLEND_MODE_ADD;
			break;
		case "erase":
			o.blendMode = (int)LWF.Format.Constant.BLEND_MODE_ERASE;
			break;
		case "layer":
			o.blendMode = (int)LWF.Format.Constant.BLEND_MODE_LAYER;
			break;
		case "mask":
			o.blendMode = (int)LWF.Format.Constant.BLEND_MODE_MASK;
			break;
		case "multiply":
			o.blendMode = (int)LWF.Format.Constant.BLEND_MODE_MULTIPLY;
			break;
		case "screen":
			o.blendMode = (int)LWF.Format.Constant.BLEND_MODE_SCREEN;
			break;
		case "subtract":
			o.blendMode = (int)LWF.Format.Constant.BLEND_MODE_SUBTRACT;
			break;
		}
	}
Пример #37
0
	public static void _bind_dtor(LWF.Movie obj)
	{
	}
Пример #38
0
            public override void BeginRender(LWF lwf)
            {
                base.BeginRender(lwf);

                if (buffer.objects == null || buffer.objects.Length != bitmapCount) {
                updated = true;
                updateCount = lwf.updateCount;
                buffer.Alloc(bitmapCount);
                } else {
                buffer.clean = false;
                buffer.changed = false;
                if (updateCount != lwf.updateCount) {
                updated = true;
                updateCount = lwf.updateCount;
                } else {
                updated = false;
                }
                }

                buffer.index = 0;
            }
Пример #39
0
            public override Renderer ConstructBitmapEx(
		LWF lwf, int objectId, BitmapEx bitmapEx)
            {
                return new BitmapRenderer(lwf, m_bitmapExContexts[objectId]);
            }
Пример #40
0
            public override void EndRender(LWF lwf)
            {
                base.EndRender(lwf);

                if (parent != null)
                return;

                if (currentMeshComponent == null) {
                for (int i = 0; i <= usedMeshComponentNo; ++i)
                meshComponents[i].Disable();
                usedMeshComponentNo = -1;
                return;
                }

                for (int i = 0; i <= meshComponentNo; ++i)
                meshComponents[i].UpdateMesh();

                for (int i = meshComponentNo + 1; i <= usedMeshComponentNo; ++i)
                meshComponents[i].Disable();
                usedMeshComponentNo = meshComponentNo;
            }
Пример #41
0
 public override TextRenderer ConstructText(LWF lwf, int objectId, Text text)
 {
     return(new UnityRenderer.UnityTextRenderer(lwf, objectId));
 }
Пример #42
0
 public TextRenderer(LWF lwf, TextContext context)
     : base(lwf)
 {
     m_context = context;
     m_matrix = new Matrix4x4();
     m_renderMatrix = new Matrix4x4();
     m_colorMult = new UnityEngine.Color();
     #if LWF_USE_ADDITIONALCOLOR
     m_colorAdd = new UnityEngine.Color();
     #endif
     if (m_context != null && m_context.systemFontRenderer != null) {
     ISystemFontRenderer.Parameter p =
     context.systemFontRendererParameter;
     float scale = lwf.scaleByStage;
     m_context.systemFontRenderer.Init(
     p.mSize * scale,
     p.mWidth * scale,
     p.mHeight * scale,
     p.mStyle,
     p.mAlign,
     p.mVerticalAlign,
     p.mLineSpacing * scale,
     p.mLetterSpacing * scale,
     p.mLeftMargin * scale,
     p.mRightMargin * scale);
     }
 }
Пример #43
0
 public override Renderer ConstructBitmapEx(
     LWF lwf, int objectId, BitmapEx bitmapEx)
 {
     return(new BitmapRenderer(lwf, m_bitmapExContexts[objectId]));
 }
Пример #44
0
 public virtual void EndRender(LWF lwf)
 {
 }
Пример #45
0
 public virtual void BeginRender(LWF lwf)
 {
 }
Пример #46
0
 public BitmapRenderer(LWF lwf, BitmapContext context)
     : base(lwf)
 {
     m_context = context;
     m_property = new MaterialPropertyBlock();
     m_matrix = new Matrix4x4();
     m_renderMatrix = new Matrix4x4();
     m_colorMult = new UnityEngine.Color();
     #if LWF_USE_ADDITIONALCOLOR
     m_colorAdd = new UnityEngine.Color();
     #endif
 }
Пример #47
0
            public override void BeginRender(LWF lwf)
            {
                base.BeginRender(lwf);

                parent = null;
                var lwfParent = lwf.GetParent();
                if (lwfParent != null)
                parent = lwfParent.rendererFactory as Factory;
                if (parent != null)
                return;

                updateCount = lwf.updateCount;
                meshComponentNo = -1;
                currentMeshComponent = null;
            }
Пример #48
0
 public virtual Renderer ConstructParticle(LWF lwf,
                                           int objectId, Particle particle)
 {
     return(null);
 }
Пример #49
0
 public override TextRenderer ConstructText(LWF lwf, int objectId, Text text)
 {
     return new TextMeshRenderer(lwf, m_textContexts[objectId]);
 }
Пример #50
0
            public virtual Renderer ConstructBitmapEx(LWF lwf,
		int objectId, BitmapEx bitmapEx)
            {
                return null;
            }
Пример #51
0
 public virtual TextRenderer ConstructText(LWF lwf, int objectId, Text text)
 {
     return null;
 }
Пример #52
0
            public virtual Renderer ConstructParticle(LWF lwf,
		int objectId, Particle particle)
            {
                return null;
            }
Пример #53
0
            public override void EndRender(LWF lwf)
            {
                base.EndRender(lwf);

                if (!updated)
                return;

                if (buffer.index == 0) {
                if (mesh.vertices != null && mesh.vertices.Length > 0)
                mesh.Clear(true);
                return;
                }

                if (buffer.changed) {
                mesh.Clear(true);
                mesh.vertices = buffer.vertices;
                mesh.uv = buffer.uv;
                mesh.triangles = buffer.triangles;
                } else {
                mesh.vertices = buffer.vertices;
                }
                mesh.colors32 = buffer.colors32;
                mesh.normals = buffer.additionalColors;
                mesh.RecalculateBounds();
                //mesh.Optimize();
            }
Пример #54
0
            public Vector3 WorldToLWFPoint(LWF lwf, Vector3 p)
            {
                Matrix4x4 gm = gameObject.transform.worldToLocalMatrix;

                Matrix lm = lwf.rootMovie.matrix;

                matrix.m00 = lm.scaleX;
                matrix.m01 = lm.skew0;
                matrix.m03 = lm.translateX;

                matrix.m10 = lm.skew1;
                matrix.m11 = lm.scaleY;
                matrix.m13 = lm.translateY;

                return matrix.inverse.MultiplyPoint(gm.MultiplyPoint(p));
            }
Пример #55
0
 public override TextRenderer ConstructText(LWF lwf, int objectId, Text text)
 {
     return new UnityRenderer.UnityTextRenderer(lwf, objectId);
 }
Пример #56
0
 public virtual void Init(LWF lwf)
 {
     lwf.scaleByStage = Screen.height / lwf.height;
 }
Пример #57
0
 public virtual Renderer ConstructBitmapEx(LWF lwf,
                                           int objectId, BitmapEx bitmapEx)
 {
     return(null);
 }
	public BitmapRenderer(LWF lwf, BitmapContext context) : base(lwf)
	{
		m_context = context;
		m_matrix = new Matrix4x4();
		m_colorMult = new UnityEngine.Color();
		m_colorAdd = new UnityEngine.Color();
		m_available = false;

		if (m_context != null)
			m_context.factory.AddBitmap();
	}
Пример #59
0
 public override Renderer ConstructText(LWF lwf, int objectId, Text text)
 {
     return(new UnityRenderer.TextRenderer(
                lwf, GetTextContext(objectId, text)));
 }
Пример #60
0
 public virtual Renderer ConstructText(LWF lwf, int objectId, Text text)
 {
     return(null);
 }