Unity3D实现指示灯亮灭效果

2023-12-20 17:18

本文主要是介绍Unity3D实现指示灯亮灭效果,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

这周有个需求是实现控制指示灯亮灭的效果。实现起来很简单,但是找到这个方法还费了点时间。
先看效果。
最终效果
原理是利用了标准着色器中的自发光属性,通过开关自发光属性来控制灯的亮灭。
具体看步骤:
1.创建一个自发光的材质球,合理设置主要颜色与自发光颜色,金属度Metallic与平滑度Smoothness自己看需求设置
创建自发光材质球
2.再创建一个无自发光的材质球
无自发光材质球
3.如何用代码控制自发光的开关内?
若不想了解从哪儿找到控制的地方的,这一段可以跳过,直接看工程。
既然在编辑器能够勾选自发光,那一定有一个编辑器脚本可以控制这部分。那么这个编辑器脚本在哪儿呢?你需要从unity官网下载你对应版本的内置着色器源码,下载回来的文件夹中Editor文件夹下的StandardShaderGUI.cs即是标准着色器编辑器的源码。

// Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt)using System;
using UnityEngine;namespace UnityEditor
{internal class StandardShaderGUI : ShaderGUI{private enum WorkflowMode{Specular,Metallic,Dielectric}public enum BlendMode{Opaque,Cutout,Fade,   // Old school alpha-blending mode, fresnel does not affect amount of transparencyTransparent // Physically plausible transparency mode, implemented as alpha pre-multiply}public enum SmoothnessMapChannel{SpecularMetallicAlpha,AlbedoAlpha,}private static class Styles{public static GUIContent uvSetLabel = new GUIContent("UV Set");public static GUIContent albedoText = new GUIContent("Albedo", "Albedo (RGB) and Transparency (A)");public static GUIContent alphaCutoffText = new GUIContent("Alpha Cutoff", "Threshold for alpha cutoff");public static GUIContent specularMapText = new GUIContent("Specular", "Specular (RGB) and Smoothness (A)");public static GUIContent metallicMapText = new GUIContent("Metallic", "Metallic (R) and Smoothness (A)");public static GUIContent smoothnessText = new GUIContent("Smoothness", "Smoothness value");public static GUIContent smoothnessScaleText = new GUIContent("Smoothness", "Smoothness scale factor");public static GUIContent smoothnessMapChannelText = new GUIContent("Source", "Smoothness texture and channel");public static GUIContent highlightsText = new GUIContent("Specular Highlights", "Specular Highlights");public static GUIContent reflectionsText = new GUIContent("Reflections", "Glossy Reflections");public static GUIContent normalMapText = new GUIContent("Normal Map", "Normal Map");public static GUIContent heightMapText = new GUIContent("Height Map", "Height Map (G)");public static GUIContent occlusionText = new GUIContent("Occlusion", "Occlusion (G)");public static GUIContent emissionText = new GUIContent("Color", "Emission (RGB)");public static GUIContent detailMaskText = new GUIContent("Detail Mask", "Mask for Secondary Maps (A)");public static GUIContent detailAlbedoText = new GUIContent("Detail Albedo x2", "Albedo (RGB) multiplied by 2");public static GUIContent detailNormalMapText = new GUIContent("Normal Map", "Normal Map");public static string primaryMapsText = "Main Maps";public static string secondaryMapsText = "Secondary Maps";public static string forwardText = "Forward Rendering Options";public static string renderingMode = "Rendering Mode";public static string advancedText = "Advanced Options";public static GUIContent emissiveWarning = new GUIContent("Emissive value is animated but the material has not been configured to support emissive. Please make sure the material itself has some amount of emissive.");public static readonly string[] blendNames = Enum.GetNames(typeof(BlendMode));}MaterialProperty blendMode = null;MaterialProperty albedoMap = null;MaterialProperty albedoColor = null;MaterialProperty alphaCutoff = null;MaterialProperty specularMap = null;MaterialProperty specularColor = null;MaterialProperty metallicMap = null;MaterialProperty metallic = null;MaterialProperty smoothness = null;MaterialProperty smoothnessScale = null;MaterialProperty smoothnessMapChannel = null;MaterialProperty highlights = null;MaterialProperty reflections = null;MaterialProperty bumpScale = null;MaterialProperty bumpMap = null;MaterialProperty occlusionStrength = null;MaterialProperty occlusionMap = null;MaterialProperty heigtMapScale = null;MaterialProperty heightMap = null;MaterialProperty emissionColorForRendering = null;MaterialProperty emissionMap = null;MaterialProperty detailMask = null;MaterialProperty detailAlbedoMap = null;MaterialProperty detailNormalMapScale = null;MaterialProperty detailNormalMap = null;MaterialProperty uvSetSecondary = null;MaterialEditor m_MaterialEditor;WorkflowMode m_WorkflowMode = WorkflowMode.Specular;ColorPickerHDRConfig m_ColorPickerHDRConfig = new ColorPickerHDRConfig(0f, 99f, 1 / 99f, 3f);bool m_FirstTimeApply = true;public void FindProperties(MaterialProperty[] props){blendMode = FindProperty("_Mode", props);albedoMap = FindProperty("_MainTex", props);albedoColor = FindProperty("_Color", props);alphaCutoff = FindProperty("_Cutoff", props);specularMap = FindProperty("_SpecGlossMap", props, false);specularColor = FindProperty("_SpecColor", props, false);metallicMap = FindProperty("_MetallicGlossMap", props, false);metallic = FindProperty("_Metallic", props, false);if (specularMap != null && specularColor != null)m_WorkflowMode = WorkflowMode.Specular;else if (metallicMap != null && metallic != null)m_WorkflowMode = WorkflowMode.Metallic;elsem_WorkflowMode = WorkflowMode.Dielectric;smoothness = FindProperty("_Glossiness", props);smoothnessScale = FindProperty("_GlossMapScale", props, false);smoothnessMapChannel = FindProperty("_SmoothnessTextureChannel", props, false);highlights = FindProperty("_SpecularHighlights", props, false);reflections = FindProperty("_GlossyReflections", props, false);bumpScale = FindProperty("_BumpScale", props);bumpMap = FindProperty("_BumpMap", props);heigtMapScale = FindProperty("_Parallax", props);heightMap = FindProperty("_ParallaxMap", props);occlusionStrength = FindProperty("_OcclusionStrength", props);occlusionMap = FindProperty("_OcclusionMap", props);emissionColorForRendering = FindProperty("_EmissionColor", props);emissionMap = FindProperty("_EmissionMap", props);detailMask = FindProperty("_DetailMask", props);detailAlbedoMap = FindProperty("_DetailAlbedoMap", props);detailNormalMapScale = FindProperty("_DetailNormalMapScale", props);detailNormalMap = FindProperty("_DetailNormalMap", props);uvSetSecondary = FindProperty("_UVSec", props);}public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] props){FindProperties(props); // MaterialProperties can be animated so we do not cache them but fetch them every event to ensure animated values are updated correctlym_MaterialEditor = materialEditor;Material material = materialEditor.target as Material;// Make sure that needed setup (ie keywords/renderqueue) are set up if we're switching some existing// material to a standard shader.// Do this before any GUI code has been issued to prevent layout issues in subsequent GUILayout statements (case 780071)if (m_FirstTimeApply){MaterialChanged(material, m_WorkflowMode);m_FirstTimeApply = false;}ShaderPropertiesGUI(material);}public void ShaderPropertiesGUI(Material material){// Use default labelWidthEditorGUIUtility.labelWidth = 0f;// Detect any changes to the materialEditorGUI.BeginChangeCheck();{BlendModePopup();// Primary propertiesGUILayout.Label(Styles.primaryMapsText, EditorStyles.boldLabel);DoAlbedoArea(material);DoSpecularMetallicArea();m_MaterialEditor.TexturePropertySingleLine(Styles.normalMapText, bumpMap, bumpMap.textureValue != null ? bumpScale : null);m_MaterialEditor.TexturePropertySingleLine(Styles.heightMapText, heightMap, heightMap.textureValue != null ? heigtMapScale : null);m_MaterialEditor.TexturePropertySingleLine(Styles.occlusionText, occlusionMap, occlusionMap.textureValue != null ? occlusionStrength : null);m_MaterialEditor.TexturePropertySingleLine(Styles.detailMaskText, detailMask);DoEmissionArea(material);EditorGUI.BeginChangeCheck();m_MaterialEditor.TextureScaleOffsetProperty(albedoMap);if (EditorGUI.EndChangeCheck())emissionMap.textureScaleAndOffset = albedoMap.textureScaleAndOffset; // Apply the main texture scale and offset to the emission texture as well, for Enlighten's sakeEditorGUILayout.Space();// Secondary propertiesGUILayout.Label(Styles.secondaryMapsText, EditorStyles.boldLabel);m_MaterialEditor.TexturePropertySingleLine(Styles.detailAlbedoText, detailAlbedoMap);m_MaterialEditor.TexturePropertySingleLine(Styles.detailNormalMapText, detailNormalMap, detailNormalMapScale);m_MaterialEditor.TextureScaleOffsetProperty(detailAlbedoMap);m_MaterialEditor.ShaderProperty(uvSetSecondary, Styles.uvSetLabel.text);// Third propertiesGUILayout.Label(Styles.forwardText, EditorStyles.boldLabel);if (highlights != null)m_MaterialEditor.ShaderProperty(highlights, Styles.highlightsText);if (reflections != null)m_MaterialEditor.ShaderProperty(reflections, Styles.reflectionsText);}if (EditorGUI.EndChangeCheck()){foreach (var obj in blendMode.targets)MaterialChanged((Material)obj, m_WorkflowMode);}EditorGUILayout.Space();GUILayout.Label(Styles.advancedText, EditorStyles.boldLabel);m_MaterialEditor.RenderQueueField();m_MaterialEditor.EnableInstancingField();}internal void DetermineWorkflow(MaterialProperty[] props){if (FindProperty("_SpecGlossMap", props, false) != null && FindProperty("_SpecColor", props, false) != null)m_WorkflowMode = WorkflowMode.Specular;else if (FindProperty("_MetallicGlossMap", props, false) != null && FindProperty("_Metallic", props, false) != null)m_WorkflowMode = WorkflowMode.Metallic;elsem_WorkflowMode = WorkflowMode.Dielectric;}public override void AssignNewShaderToMaterial(Material material, Shader oldShader, Shader newShader){// _Emission property is lost after assigning Standard shader to the material// thus transfer it before assigning the new shaderif (material.HasProperty("_Emission")){material.SetColor("_EmissionColor", material.GetColor("_Emission"));}base.AssignNewShaderToMaterial(material, oldShader, newShader);if (oldShader == null || !oldShader.name.Contains("Legacy Shaders/")){SetupMaterialWithBlendMode(material, (BlendMode)material.GetFloat("_Mode"));return;}BlendMode blendMode = BlendMode.Opaque;if (oldShader.name.Contains("/Transparent/Cutout/")){blendMode = BlendMode.Cutout;}else if (oldShader.name.Contains("/Transparent/")){// NOTE: legacy shaders did not provide physically based transparency// therefore Fade modeblendMode = BlendMode.Fade;}material.SetFloat("_Mode", (float)blendMode);DetermineWorkflow(MaterialEditor.GetMaterialProperties(new Material[] { material }));MaterialChanged(material, m_WorkflowMode);}void BlendModePopup(){EditorGUI.showMixedValue = blendMode.hasMixedValue;var mode = (BlendMode)blendMode.floatValue;EditorGUI.BeginChangeCheck();mode = (BlendMode)EditorGUILayout.Popup(Styles.renderingMode, (int)mode, Styles.blendNames);if (EditorGUI.EndChangeCheck()){m_MaterialEditor.RegisterPropertyChangeUndo("Rendering Mode");blendMode.floatValue = (float)mode;}EditorGUI.showMixedValue = false;}void DoAlbedoArea(Material material){m_MaterialEditor.TexturePropertySingleLine(Styles.albedoText, albedoMap, albedoColor);if (((BlendMode)material.GetFloat("_Mode") == BlendMode.Cutout)){m_MaterialEditor.ShaderProperty(alphaCutoff, Styles.alphaCutoffText.text, MaterialEditor.kMiniTextureFieldLabelIndentLevel + 1);}}void DoEmissionArea(Material material){// Emission for GI?if (m_MaterialEditor.EmissionEnabledProperty()){bool hadEmissionTexture = emissionMap.textureValue != null;// Texture and HDR color controlsm_MaterialEditor.TexturePropertyWithHDRColor(Styles.emissionText, emissionMap, emissionColorForRendering, m_ColorPickerHDRConfig, false);// If texture was assigned and color was black set color to whitefloat brightness = emissionColorForRendering.colorValue.maxColorComponent;if (emissionMap.textureValue != null && !hadEmissionTexture && brightness <= 0f)emissionColorForRendering.colorValue = Color.white;// change the GI flag and fix it up with emissive as black if necessarym_MaterialEditor.LightmapEmissionFlagsProperty(MaterialEditor.kMiniTextureFieldLabelIndentLevel, true);}}void DoSpecularMetallicArea(){bool hasGlossMap = false;if (m_WorkflowMode == WorkflowMode.Specular){hasGlossMap = specularMap.textureValue != null;m_MaterialEditor.TexturePropertySingleLine(Styles.specularMapText, specularMap, hasGlossMap ? null : specularColor);}else if (m_WorkflowMode == WorkflowMode.Metallic){hasGlossMap = metallicMap.textureValue != null;m_MaterialEditor.TexturePropertySingleLine(Styles.metallicMapText, metallicMap, hasGlossMap ? null : metallic);}bool showSmoothnessScale = hasGlossMap;if (smoothnessMapChannel != null){int smoothnessChannel = (int)smoothnessMapChannel.floatValue;if (smoothnessChannel == (int)SmoothnessMapChannel.AlbedoAlpha)showSmoothnessScale = true;}int indentation = 2; // align with labels of texture propertiesm_MaterialEditor.ShaderProperty(showSmoothnessScale ? smoothnessScale : smoothness, showSmoothnessScale ? Styles.smoothnessScaleText : Styles.smoothnessText, indentation);++indentation;if (smoothnessMapChannel != null)m_MaterialEditor.ShaderProperty(smoothnessMapChannel, Styles.smoothnessMapChannelText, indentation);}public static void SetupMaterialWithBlendMode(Material material, BlendMode blendMode){switch (blendMode){case BlendMode.Opaque:material.SetOverrideTag("RenderType", "");material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One);material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.Zero);material.SetInt("_ZWrite", 1);material.DisableKeyword("_ALPHATEST_ON");material.DisableKeyword("_ALPHABLEND_ON");material.DisableKeyword("_ALPHAPREMULTIPLY_ON");material.renderQueue = -1;break;case BlendMode.Cutout:material.SetOverrideTag("RenderType", "TransparentCutout");material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One);material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.Zero);material.SetInt("_ZWrite", 1);material.EnableKeyword("_ALPHATEST_ON");material.DisableKeyword("_ALPHABLEND_ON");material.DisableKeyword("_ALPHAPREMULTIPLY_ON");material.renderQueue = (int)UnityEngine.Rendering.RenderQueue.AlphaTest;break;case BlendMode.Fade:material.SetOverrideTag("RenderType", "Transparent");material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.SrcAlpha);material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha);material.SetInt("_ZWrite", 0);material.DisableKeyword("_ALPHATEST_ON");material.EnableKeyword("_ALPHABLEND_ON");material.DisableKeyword("_ALPHAPREMULTIPLY_ON");material.renderQueue = (int)UnityEngine.Rendering.RenderQueue.Transparent;break;case BlendMode.Transparent:material.SetOverrideTag("RenderType", "Transparent");material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One);material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha);material.SetInt("_ZWrite", 0);material.DisableKeyword("_ALPHATEST_ON");material.DisableKeyword("_ALPHABLEND_ON");material.EnableKeyword("_ALPHAPREMULTIPLY_ON");material.renderQueue = (int)UnityEngine.Rendering.RenderQueue.Transparent;break;}}static SmoothnessMapChannel GetSmoothnessMapChannel(Material material){int ch = (int)material.GetFloat("_SmoothnessTextureChannel");if (ch == (int)SmoothnessMapChannel.AlbedoAlpha)return SmoothnessMapChannel.AlbedoAlpha;elsereturn SmoothnessMapChannel.SpecularMetallicAlpha;}static void SetMaterialKeywords(Material material, WorkflowMode workflowMode){// Note: keywords must be based on Material value not on MaterialProperty due to multi-edit & material animation// (MaterialProperty value might come from renderer material property block)SetKeyword(material, "_NORMALMAP", material.GetTexture("_BumpMap") || material.GetTexture("_DetailNormalMap"));if (workflowMode == WorkflowMode.Specular)SetKeyword(material, "_SPECGLOSSMAP", material.GetTexture("_SpecGlossMap"));else if (workflowMode == WorkflowMode.Metallic)SetKeyword(material, "_METALLICGLOSSMAP", material.GetTexture("_MetallicGlossMap"));SetKeyword(material, "_PARALLAXMAP", material.GetTexture("_ParallaxMap"));SetKeyword(material, "_DETAIL_MULX2", material.GetTexture("_DetailAlbedoMap") || material.GetTexture("_DetailNormalMap"));// A material's GI flag internally keeps track of whether emission is enabled at all, it's enabled but has no effect// or is enabled and may be modified at runtime. This state depends on the values of the current flag and emissive color.// The fixup routine makes sure that the material is in the correct state if/when changes are made to the mode or color.MaterialEditor.FixupEmissiveFlag(material);bool shouldEmissionBeEnabled = (material.globalIlluminationFlags & MaterialGlobalIlluminationFlags.EmissiveIsBlack) == 0;SetKeyword(material, "_EMISSION", shouldEmissionBeEnabled);if (material.HasProperty("_SmoothnessTextureChannel")){SetKeyword(material, "_SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A", GetSmoothnessMapChannel(material) == SmoothnessMapChannel.AlbedoAlpha);}}static void MaterialChanged(Material material, WorkflowMode workflowMode){SetupMaterialWithBlendMode(material, (BlendMode)material.GetFloat("_Mode"));SetMaterialKeywords(material, workflowMode);}static void SetKeyword(Material m, string keyword, bool state){if (state)m.EnableKeyword(keyword);elsem.DisableKeyword(keyword);}}
} // namespace UnityEditor

定位到上述脚本的393行(不同版本的脚本可能不太一样,看具体情况),即是设置自发光是否开启的部分。
在这里插入图片描述
其实就是使用material的EnableKeyword和DisableKeyword来控制_EMISSION属性的开关,知道原理之后写代码就简单了。

using UnityEngine;/// <summary>
/// 指示灯.
/// </summary>
public class HightLED : MonoBehaviour
{private Material mat;private void Awake(){mat = GetComponent<MeshRenderer>().material;}private void Update(){if (Input.GetKeyDown(KeyCode.F1)){SetEmission(mat, true);}if (Input.GetKeyDown(KeyCode.F2)){SetEmission(mat, false);}}private void SetEmission(Material mat, bool emissionOn){if (emissionOn){mat.EnableKeyword("_EMISSION");}else{mat.DisableKeyword("_EMISSION");}}
}

4.建议测试时把场景中内置的天空盒给删除掉,内置天空盒给的光太多,看不出效果。具体步骤见下图。
在这里插入图片描述

在这里插入图片描述
源码上传到GitHub了,见03.HightLight场景。

这篇关于Unity3D实现指示灯亮灭效果的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/516821

相关文章

hdu1043(八数码问题,广搜 + hash(实现状态压缩) )

利用康拓展开将一个排列映射成一个自然数,然后就变成了普通的广搜题。 #include<iostream>#include<algorithm>#include<string>#include<stack>#include<queue>#include<map>#include<stdio.h>#include<stdlib.h>#include<ctype.h>#inclu

【C++】_list常用方法解析及模拟实现

相信自己的力量,只要对自己始终保持信心,尽自己最大努力去完成任何事,就算事情最终结果是失败了,努力了也不留遗憾。💓💓💓 目录   ✨说在前面 🍋知识点一:什么是list? •🌰1.list的定义 •🌰2.list的基本特性 •🌰3.常用接口介绍 🍋知识点二:list常用接口 •🌰1.默认成员函数 🔥构造函数(⭐) 🔥析构函数 •🌰2.list对象

【Prometheus】PromQL向量匹配实现不同标签的向量数据进行运算

✨✨ 欢迎大家来到景天科技苑✨✨ 🎈🎈 养成好习惯,先赞后看哦~🎈🎈 🏆 作者简介:景天科技苑 🏆《头衔》:大厂架构师,华为云开发者社区专家博主,阿里云开发者社区专家博主,CSDN全栈领域优质创作者,掘金优秀博主,51CTO博客专家等。 🏆《博客》:Python全栈,前后端开发,小程序开发,人工智能,js逆向,App逆向,网络系统安全,数据分析,Django,fastapi

让树莓派智能语音助手实现定时提醒功能

最初的时候是想直接在rasa 的chatbot上实现,因为rasa本身是带有remindschedule模块的。不过经过一番折腾后,忽然发现,chatbot上实现的定时,语音助手不一定会有响应。因为,我目前语音助手的代码设置了长时间无应答会结束对话,这样一来,chatbot定时提醒的触发就不会被语音助手获悉。那怎么让语音助手也具有定时提醒功能呢? 我最后选择的方法是用threading.Time

Android实现任意版本设置默认的锁屏壁纸和桌面壁纸(两张壁纸可不一致)

客户有些需求需要设置默认壁纸和锁屏壁纸  在默认情况下 这两个壁纸是相同的  如果需要默认的锁屏壁纸和桌面壁纸不一样 需要额外修改 Android13实现 替换默认桌面壁纸: 将图片文件替换frameworks/base/core/res/res/drawable-nodpi/default_wallpaper.*  (注意不能是bmp格式) 替换默认锁屏壁纸: 将图片资源放入vendo

C#实战|大乐透选号器[6]:实现实时显示已选择的红蓝球数量

哈喽,你好啊,我是雷工。 关于大乐透选号器在前面已经记录了5篇笔记,这是第6篇; 接下来实现实时显示当前选中红球数量,蓝球数量; 以下为练习笔记。 01 效果演示 当选择和取消选择红球或蓝球时,在对应的位置显示实时已选择的红球、蓝球的数量; 02 标签名称 分别设置Label标签名称为:lblRedCount、lblBlueCount

Kubernetes PodSecurityPolicy:PSP能实现的5种主要安全策略

Kubernetes PodSecurityPolicy:PSP能实现的5种主要安全策略 1. 特权模式限制2. 宿主机资源隔离3. 用户和组管理4. 权限提升控制5. SELinux配置 💖The Begin💖点点关注,收藏不迷路💖 Kubernetes的PodSecurityPolicy(PSP)是一个关键的安全特性,它在Pod创建之前实施安全策略,确保P

防近视护眼台灯什么牌子好?五款防近视效果好的护眼台灯推荐

在家里,灯具是属于离不开的家具,每个大大小小的地方都需要的照亮,所以一盏好灯是必不可少的,每个发挥着作用。而护眼台灯就起了一个保护眼睛,预防近视的作用。可以保护我们在学习,阅读的时候提供一个合适的光线环境,保护我们的眼睛。防近视护眼台灯什么牌子好?那我们怎么选择一个优秀的护眼台灯也是很重要,才能起到最大的护眼效果。下面五款防近视效果好的护眼台灯推荐: 一:六个推荐防近视效果好的护眼台灯的

工厂ERP管理系统实现源码(JAVA)

工厂进销存管理系统是一个集采购管理、仓库管理、生产管理和销售管理于一体的综合解决方案。该系统旨在帮助企业优化流程、提高效率、降低成本,并实时掌握各环节的运营状况。 在采购管理方面,系统能够处理采购订单、供应商管理和采购入库等流程,确保采购过程的透明和高效。仓库管理方面,实现库存的精准管理,包括入库、出库、盘点等操作,确保库存数据的准确性和实时性。 生产管理模块则涵盖了生产计划制定、物料需求计划、

C++——stack、queue的实现及deque的介绍

目录 1.stack与queue的实现 1.1stack的实现  1.2 queue的实现 2.重温vector、list、stack、queue的介绍 2.1 STL标准库中stack和queue的底层结构  3.deque的简单介绍 3.1为什么选择deque作为stack和queue的底层默认容器  3.2 STL中对stack与queue的模拟实现 ①stack模拟实现