Ejemplo n.º 1
0
        static SCNNode CreateTextNode(string text, UIFont font, UIColor color, UIColor bgColor, float kerning = 0)
        {
            kerning = 1;
            var attrString   = new NSMutableAttributedString(text, font);
            var textGeometry = SCNText.Create(attrString, 0);

            textGeometry.FirstMaterial.Diffuse.Contents     = UIColor.DarkTextColor;
            textGeometry.FirstMaterial.LightingModelName    = SCNLightingModel.Constant;
            textGeometry.FirstMaterial.DoubleSided          = true;
            textGeometry.FirstMaterial.ReadsFromDepthBuffer = false;
            textGeometry.FirstMaterial.WritesToDepthBuffer  = false;
            textGeometry.ChamferRadius = 0f;
            var textNode = new SCNNode
            {
                Geometry = textGeometry
            };

            textNode.Center();
            var container = CreateBackgroundPlaneNode(textNode.Size(), bgColor, 0);

            container.AddChildNode(textNode);
            return(container);
        }