GL绘制

GL绘制
{
  "examples": [
    {
      "title": "Draw Line",
      "description": "This example demonstrates how to draw a line using OpenGL in Unity.",
      "code": "[csharp]\npublic class GLTest : MonoBehaviour\n{\n\tpublic Shader shader;\n\tpublic Texture2D t2d;\n\tprivate Material mat;\n\n\tvoid Start()\n\t{\n\t\tmat = new Material(shader);\n\t\tmat.mainTexture = t2d;\n\t}\n\n\tvoid OnPostRender()\n\t{\n\t\tif (!mat)\n\t\t{\n\t\t\tDebug.LogError(\"Please Assign a material on the inspector\");\n\t\t\treturn;\n\t\t}\n\t\tGL.PushMatrix();\n\t\tmat.SetPass(0);\n\t\tGL.LoadOrtho();\n\t\tGL.Begin(GL.QUADS);\n\t\tGL.Vertex3(0, 0, 0.1F);\n\t\tGL.Vertex3(1f, 0, 0.1F);\n\t\tGL.Vertex3(1f, 1, 0.1F);\n\t\tGL.Vertex3(0, 1, 0.1F);\n\t\tGL.End();\n\t\tGL.PopMatrix();\n\t}\n}\n\nShader \"Custom/GLDrawLine\"\n{\n\tProperties {\n\t\t_MainTex (\"Base (RGB)\", 2D) = \"white\" {}\n\t}\n\tSubShader\n\t{\n\t\tPass\n\t\t{\n\t\t\tCull off\n\t\t\tBlend DstAlpha zero\n\t\t\tColor(1,1,1,1)\n\t\t}\n\t}\n}"
    },
    {
      "title": "Take Screenshot",
      "description": "This example demonstrates how to take a screenshot of the current frame using Unity's API.",
      "code": "[csharp]\nusing System.IO;\nusing UnityEngine;\nusing System.Collections;\n\nclass ScreenShot : MonoBehaviour\n{\n\tvoid Start()\n\t{\n\t\tStartCoroutine(UploadPNG() );\n\t}\n\n\tIEnumerator UploadPNG()\n\t{\n\t\tyield return new WaitForEndOfFrame();\n\t\tprint (\"yuuuuu\");\n\t\tint width = Screen.width;\n\t\tint height = Screen.height;\n\t\tTexture2D tex = new Texture2D(width, height, TextureFormat.RGB24, false);\n\t\ttex.ReadPixels(new Rect(0, 0, width, height), 0, 0);\n\t\ttex.Apply();\n\t\tbyte[] bytes = tex.EncodeToPNG();\n\t\tFile.WriteAllBytes(Application.dataPath + \"/ss.png\", bytes);\n\t\tUnityEditor.AssetDatabase.Refresh();\n\t}\n}"
    },
    {
      "title": "Show Alpha",
      "description": "This example demonstrates how to render a texture with alpha blending using OpenGL in Unity.",
      "code": "[csharp]\nclass GLTest : MonoBehaviour\n{\n\tpublic Shader shader;\n\tpublic Texture2D t2d;\n\tprivate Material mat;\n\n\tvoid Start()\n\t{\n\t\tmat = new Material(shader);\n\t\tmat.mainTexture = t2d;\n\t}\n\n\tvoid OnPostRender()\n\t{\n\t\tif (!mat)\n\t\t{\n\t\t\tDebug.LogError(\"Please Assign a material on the inspector\");\n\t\t\treturn;\n\t\t}\n\t\tGL.PushMatrix();\n\t\tmat.SetPass(0);\n\t\tGL.LoadOrtho();\n\t\tGL.Begin(GL.QUADS);\n\t\tGL.Vertex3(0, 0, 0.1F);\n\t\tGL.Vertex3(1f, 0, 0.1F);\n\t\tGL.Vertex3(1f, 1, 0.1F);\n\t\tGL.Vertex3(0, 1, 0.1F);\n\t\tGL.End();\n\t\tGL.PopMatrix();\n\t}\n}\n\nShader \"Custom/GLDrawLine\"\n{\n\tProperties {\n\t\t_MainTex (\"Base (RGB)\", 2D) = \"white\" {}\n\t}\n\tSubShader\n\t{\n\t\tPass\n\t\t{\n\t\t\tCull off\n\t\t\tBlend DstAlpha zero\n\t\t\tColor(1,1,1,1)\n\t\t}\n\t}\n}"
    }
  ]
}

Read more

LibreChat 集成 Stripe 支付的奶妈级教程

LibreChat 集成 Stripe 支付的奶妈级教程

我们假设你已经熟悉基本的 React 和 Node.js 开发,并且正在使用 LibreChat 的默认技术栈(React 前端、Node.js 后端、Vite 构建工具,可能还有 Electron 桌面应用)。教程会特别考虑 Electron 环境下的适配问题(例如 macOS 中文路径或路由错误)。“奶妈级”带你从零开始实现支付功能(包括一次性支付和添加高级会员订阅) 教程目标 * 在 LibreChat 中添加支付页面,支持用户通过信用卡付款。 * 实现 Stripe 的一次性支付功能。 * (可选)扩展到订阅功能,管理高级会员状态。 * 解决 Electron 环境下的常见问题(如路由和路径解析)。 * 生成可公开推送的 Markdown 教程,方便社区参考。 前提条件 在开始之前,请确保你已准备好以下内容:

By Ne0inhk
超棒的雅思资源!

超棒的雅思资源!

雅思真题材料地址: https://github.com/zeeklog/IETLS 感谢所有人。材料来自:@shah0150 & @kbtxwer * 超棒的雅思资源 * 雅思简介 * 听力 * 阅读 * 写作 * 口语 * 词汇 * 其他 * YouTube 频道 * [播客] (#podcasts) 雅思简介 * 什么是雅思 - 了解什么是雅思 听力 * 高级听力 * 雅思官方网站 * 考试英语 * 英国广播公司节目 * 乔治梅森大学口音学习网站 - 学习不同的口音 * 英国广播公司播客 * 英国文化协会听力练习 阅读 * 雅思提升阅读 写作 * 雅思提升写作 * 雅思从 6 分到 9 分 * 迷你雅思 口语 * Verbling 提供在线英语家教服务

By Ne0inhk