.cc
authorhgn <hgodden00@gmail.com>
Thu, 14 Apr 2022 13:40:16 +0000 (14:40 +0100)
committerhgn <hgodden00@gmail.com>
Thu, 14 Apr 2022 13:40:16 +0000 (14:40 +0100)
.gitignore
__init__.py
config.py
nbvtf/librgbcx.cc [new file with mode: 0644]

index 1a9d3587b5e5818884f1f200e9f301792b722d7c..e8c83fa441900bf07d2f6cd27cddb5a9ea1b9c73 100644 (file)
@@ -3,6 +3,9 @@
 
 !.gitignore
 !*.c
+!*.cc
+!*.cpp
+!*.hpp
 !*.h
 !*.py
 
index 53149b6afde21ac6f52a813ea4d5dd7c2f108ab0..c5fb285828b0e881ecb443448687940f9b5887e4 100644 (file)
@@ -89,11 +89,11 @@ def cxr_ui(_,context):
          blf.draw(0,ln[:-1])
          py += 16
 
-   if CXR_PREVIEW_OPERATOR.LASTERR != None:
-      blf.position(0,2,80,0)
-      blf.size(0,50,48)
-      blf.color(0,1.0,0.2,0.2,0.9)
-      blf.draw(0,"This is a stoopid error\nWIthiuawdnaw")
+   #if CXR_PREVIEW_OPERATOR.LASTERR != None:
+   #   blf.position(0,2,80,0)
+   #   blf.size(0,50,48)
+   #   blf.color(0,1.0,0.2,0.2,0.9)
+   #   blf.draw(0,"Invalid geometry")
 
    # Something is off with TIMER,
    # this forces the viewport to redraw before we can continue with our
@@ -1565,6 +1565,11 @@ class CXR_COMPILER_CHAIN(bpy.types.Operator):
          for brush in sceneinfo['geo']:
             for ms in brush['object'].material_slots:
                a_materials.add( ms.material )
+               if ms.material.cxr_data.shader == 'VertexLitGeneric':
+                  errmat = ms.material.name
+                  errnam = brush['object'].name
+                  print( F"Vertex shader {errmat} used on {errnam}")
+                  return {'CANCELLED'}
          
          for ent in sceneinfo['entities']:
             if isinstance(ent['object'],bpy.types.Collection): continue
@@ -1580,6 +1585,13 @@ class CXR_COMPILER_CHAIN(bpy.types.Operator):
             for obj in hero['collection'].objects:
                for ms in obj.material_slots:
                   a_materials.add( ms.material )
+                  if ms.material.cxr_data.shader == 'LightMappedGeneric' or \
+                     ms.material.cxr_data.shader == 'WorldVertexTransition':
+
+                     errmat = ms.material.name
+                     errnam = obj.name
+                     print( F"Lightmapped shader {errmat} used on {errnam}")
+                     return {'CANCELLED'}
          
          # Collect images
          for mat in a_materials:
@@ -1663,16 +1675,17 @@ class CXR_COMPILER_CHAIN(bpy.types.Operator):
                "w": 25,
                "colour": (0.9,0.5,0.5,1.0),
                "exec": "vvis",
-               "jobs": [[settings[F'exe_vvis']] + args],
+               "jobs": [[settings[F'exe_vvis']] + ['-fast'] + args ],
                "cwd": directory
             }]
             
+            vrad_opt = settings.opt_vrad.split()
             static.JOBINFO += [{
                "title": "VRAD",
                "w": 25,
                "colour": (0.9,0.2,0.3,1.0),
                "exec": "vrad",
-               "jobs": [[settings[F'exe_vrad']] + args],
+               "jobs": [[settings[F'exe_vrad']] + vrad_opt + args ],
                "cwd": directory
             }]
 
@@ -1772,6 +1785,7 @@ class CXR_INTERFACE(bpy.types.Panel):
       box.prop(settings, "exe_vbsp")
       box.prop(settings, "exe_vvis")
       box.prop(settings, "exe_vrad")
+      box.prop(settings, "opt_vrad")
 
       box = box.box()
       row = box.row()
index 364363dde1e0770742a4581eab1632bcb291c58e..438c044eab08ef246bd0c4c3363b373d95b716e7 100644 (file)
--- a/config.py
+++ b/config.py
@@ -251,5 +251,10 @@ cxr_entities = \
       {
          "TeamNum": {"type": "int", "default": 0 }
       }
+   },
+   "func_detail":
+   {
+      "allow": ('MESH',),
+      "keyvalues": {}
    }
 }
diff --git a/nbvtf/librgbcx.cc b/nbvtf/librgbcx.cc
new file mode 100644 (file)
index 0000000..ae6e72c
--- /dev/null
@@ -0,0 +1,24 @@
+#include <stdint.h>
+#include <cstring>
+#include <math.h>
+
+#define RGBCX_IMPLEMENTATION
+#include "rgbcx.h"
+
+extern "C"
+{
+       void rgbcx__init(void)
+       {
+               rgbcx::init();
+       }
+
+       void rgbcx__encode_bc1( uint32_t level, void* pDst, const uint8_t* pPixels, int allow_3color, int use_transparent_texels_for_black )
+       {
+               rgbcx::encode_bc1( level, pDst, pPixels, allow_3color, use_transparent_texels_for_black );
+       }
+
+       void rgbcx__encode_bc3( uint32_t level, void* pDst, const uint8_t* pPixels )
+       {
+               rgbcx::encode_bc3( level, pDst, pPixels );
+       }
+}