unity毛笔笔锋

news/2025/2/24 4:44:25/文章来源:https://www.cnblogs.com/huiyunsoft/p/18714903

using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

namespace LastZero.Utility
{
public class Painting : MonoBehaviour
{
public Color mColor = Color.black;//画笔颜色
//[HideInInspector]
public Texture brushTexture;//画笔
[HideInInspector]
public float brushScale = 0.1f;//画笔大小
[HideInInspector]
public bool isEraser = false;//是否使用橡皮擦
private RenderTexture texRender;//接收图的RenderTexture
public Material mat;//材质球
private RawImage rImage;//RawImage,自身
private RectTransform rTransform;//RectTransform

private Vector3 startPosition = Vector3.zero;
private Vector3 endPosition = Vector3.zero;

private Vector2 posOffset;
//
//
[SerializeField]
private Image _defaultColorImage;
#region 毛笔接口
public class tagFPOINT
{
public int x;
public int y;
public double time;
public double time2;
public double time3;
public tagFPOINT()
{
this.x = 0; this.y = 0; this.time = 0; this.time2 = 0; this.time3 = 0;
}
public tagFPOINT(int x, int y, double time, double time2, double time3)
{
this.x = x; this.y = y; this.time = time; this.time2 = time2; this.time3 = time3;
}
}

private List<tagFPOINT> n_list = new List<tagFPOINT>();
private System.Random r_guid;
//
private int pen_width = 10;
private int imgwidth = 40;//90;
private int imgheight = 5;//90;
private int i_mincount = 8;// 24;
private tagFPOINT oldpoint = null;
private double old_width;
private double i_endr = 0.0;
private double i_cwidth = 0.0;
private tagFPOINT nextpoint = null;
private double i_end = 0.0;
private int i_minwidth = 5;
private Color pen_color = Color.black;
private int i_time = 0;
private bool b_down = false;
#endregion

private void Start()
{
init_MyPen();
SetPainting();
posOffset.Set((Screen.width - rTransform.sizeDelta.x * transform.root.localScale.x) / 2 + transform.position.x - transform.root.position.x, (Screen.height - rTransform.sizeDelta.y * transform.root.localScale.y) / 2 + transform.position.y - transform.root.position.y);
}

void Update()
{/*
if (Input.GetMouseButton(0))
{
DragUpdate();
}
if (Input.GetMouseButtonUp(0))
{
DragEnd();
}*/
}

qq:77211022   微信:13762930029

 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.hqwc.cn/news/883616.html

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

.NET 8.0 + Linux 香橙派,实现高效的 IoT 数据采集与控制解决方案

前言 随着物联网(IoT)技术的迅猛发展,智能设备之间的互联互通变得越来越重要。 推荐一套基于 C# 的高效 IoT 系统,该系统运行在 Linux 开发板上,并支持 Modbus RS485 传感器、NPN/PNP 开关等所有符合 485 通讯协议的设备进行数据采集和指令发送。这套系统在为智能家居、智…

DeepSeek 背后的技术:GRPO,基于群组采样的高效大语言模型强化学习训练方法详解

强化学习(Reinforcement Learning, RL)已成为提升大型语言模型(Large Language Models, LLMs)推理能力的重要技术手段,特别是在需要复杂推理的任务中。DeepSeek 团队在 DeepSeek-Math [2] 和 DeepSeek-R1 [3] 模型中的突破性成果,充分展示了强化学习在增强语言模型数学推…

https://avoid.overfit.cn/post/05d4b8fb001b4adeb4e050fb323cd21f

强化学习(Reinforcement Learning, RL)已成为提升大型语言模型(Large Language Models, LLMs)推理能力的重要技术手段,特别是在需要复杂推理的任务中。DeepSeek 团队在 DeepSeek-Math [2] 和 DeepSeek-R1 [3] 模型中的突破性成果,充分展示了强化学习在增强语言模型数学推…

DeepSeek 杀红眼了!GPT-5 宣布免费,百度文心一言宣布免费。。。大快人心!

大家好,我是R哥。 最近的科技圈可谓风起云涌,横空出世的 DeepSeek 自从它发布以来,不但打破了业界的格局,还引发了一系列连锁反应。 如果你还没用过 DeepSeek,清华大学出的《DeepSeek 从入门到精通》推荐你好好看看吧,质量非常高,从原理到应用实践,写得非常好。 DeepSe…

CppQt3D-DataVisualization Simple LorenzSystem By Q3DScatter

环境搭建: Qt 6.7.2 MSVC 2019 64bit CMake latest find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets Core Core5Compat DataVisualization)#executable(...) 之后target_link_libraries(${PROJECT_NAME} PRIVATE Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSI…

Burpsuite基础使用

Burpsuite使用教程 目标靶场 :pikachu 系统 :win11 (一)暴力破解 1.基于表单的暴力破解什么是暴力破解? Burte Force(暴力破解)概述 ​ “暴力破解”是一攻击具手段,在web攻击中,一般会使用这种手段对应用系统的认证信息进行获取。 其过程就是使用…

docker compose容器化部署 sonarqube+jenkins+dingtalk钉钉插件通知+中文插件 代码检测。超详细

docker hub : https://hub.docker.com/_/sonarqube 钉钉插件:https://github.com/xbmlz/sonar-dingtalk-plugin 中文包:https://github.com/xuhuisheng/sonar-l10n-zh/releases/tag/sonar-l10n-zh-plugin-8.9sonar客户端:https://docs.sonarsource.com/sonarqube-server/la…

[AI/GPT] 硅基流动(SiliconFlow) : AI大模型时代的基础设施

概述:硅基流动(SilliconFlow) 简介 🌸硅基流动(SiliconFlow) 是一家专注于人工智能(AI)基础设施的公司,致力于通过技术创新降低大模型(如生成式AI和大语言模型)的部署和推理成本,推动人工通用智能(AGI)的普及。 https://siliconflow.cn/zh-cn/ 以下是关于硅基流动…

010 组件生命周期

每个组件在被创建时都要经过一系列的初始化过程一一例如,需要设置数据监听、编译模板、将实例挂载到DOM并在数据变化时更新DOM等。同时在这个过程中也会运行一些叫做生命周期的钩子函数,这给了用户在不同阶段添加自己的代码的机会为了方便记忆,我们可以将他们分类:创建时:…

03网络基础day02

ip及子网掩码 私有ip地址范围 A类:10.0.0.0-10.255.255.255 子网掩码是8位 B类:172.16.0.0-172.31.255.255 子网掩码是16位 C类:192.168.0.0-192.168.255.255ip不够解决方案 方式一:部分ip划分出来用于内部ip, 一个公网ip可以让上千万设备共享上网 NAT 网络地址…

Jmeter Http request Get 请求的时候 response body 为空

Jmeter response body 为空已知原因: 1、Content encoding 的默认编码对应不上,需要手动设置编码为:UTF-8; 2、请求设置 Header,且设置有请求数据类型为 Content-Type: application/json 注:原因2是GET,如果通过 Nginx 代理处理请求后再到达目标服务器,则可以避免该情况…

c# log4net 日志的使用

C# log4net 日志参考:C# log4net的使用。输出的日志内容添加文件名和行号。_log4net 发布 输出的文件中行号-CSDN博客1.NuGet增加log4net 2.增加log4net.config文件 log4net.config的内容如下,没有的功能可以搜一搜,设置 log4net.config的属性 复制到输出目录 设为始终复制&…