zhong (钟鹏群) 1 ماه پیش
والد
کامیت
baf1313be3
2فایلهای تغییر یافته به همراه20 افزوده شده و 15 حذف شده
  1. BIN
      __pycache__/ball-demo.cpython-310.pyc
  2. 20 15
      ball-demo.py

BIN
__pycache__/ball-demo.cpython-310.pyc


+ 20 - 15
ball-demo.py

@@ -26,6 +26,8 @@ glEnable(GL_DEPTH_TEST)
 
 # 设置背景色
 glClearColor(0.1, 0.1, 0.1, 1.0)
+# 禁用混合,确保完全不透明
+glDisable(GL_BLEND)
 
 # 设置光照
 glEnable(GL_LIGHTING)
@@ -270,28 +272,31 @@ while running:
         if i in blinking_nodes:  # 闪烁节点
             # 计算闪烁因子(正弦波,周期约2秒)
             blink_factor = (math.sin((current_time - blink_start_time) * 0.005) + 1) * 0.5
-            # 颜色在黄色(1,1,0)和红色(1,0,0)之间变化
-            color = [1.0, blink_factor, 0.0, 1.0]
-            ambient = [0.3, blink_factor * 0.3, 0.0, 1.0]
-            specular = [1.0, blink_factor * 0.5, 0.5, 1.0]
+            # 基础颜色 #c31c1f
+            base_r, base_g, base_b = 0.7647, 0.1098, 0.1216
+            # 亮度在0.7到1.0之间变化
+            brightness = 0.7 + 0.3 * blink_factor
+            color = [base_r * brightness, base_g * brightness, base_b * brightness, 1.0]
+            ambient = [base_r * 0.5, base_g * 0.5, base_b * 0.5, 1.0]
+            specular = [base_r * 0.8, base_g * 0.8, base_b * 0.8, 1.0]
         elif i == selected_node_index:  # 选中节点
             color = [1.0, 0.0, 0.0, 1.0]  # 红色
-            ambient = [0.3, 0.0, 0.0, 1.0]
-            specular = [1.0, 0.5, 0.5, 1.0]
+            ambient = [0.5, 0.0, 0.0, 1.0]
+            specular = [0.8, 0.3, 0.3, 1.0]
         elif i == 0:  # 根节点
             color = [1.0, 1.0, 0.0, 1.0]  # 黄色
-            ambient = [0.3, 0.3, 0.0, 1.0]
-            specular = [1.0, 1.0, 0.5, 1.0]
+            ambient = [0.5, 0.5, 0.0, 1.0]
+            specular = [0.8, 0.8, 0.4, 1.0]
         elif is_dir:  # 目录
-            color = [0.0, 0.5, 1.0, 1.0]  # 蓝色
-            ambient = [0.0, 0.2, 0.3, 1.0]
-            specular = [0.5, 0.7, 1.0, 1.0]
+            color = [0.2902, 0.5961, 0.3098, 1.0]  # #4a984f
+            ambient = [0.2, 0.4, 0.2, 1.0]
+            specular = [0.4, 0.8, 0.4, 1.0]
         else:  # 文件
-            color = [0.0, 0.8, 1.0, 1.0]  # 亮蓝色
-            ambient = [0.0, 0.1, 0.2, 1.0]
-            specular = [0.6, 0.9, 1.0, 1.0]
+            color = [0.7059, 0.7176, 0.2549, 1.0]  # #b4b741
+            ambient = [0.4, 0.4, 0.15, 1.0]
+            specular = [0.8, 0.8, 0.4, 1.0]
         
-        shininess = [50.0]
+        shininess = [30.0]
         
         glMaterialfv(GL_FRONT, GL_AMBIENT, ambient)
         glMaterialfv(GL_FRONT, GL_DIFFUSE, color)