quine shader cleanup and shorten to 100x200, 19484B

This commit is contained in:
Crispy 2024-08-13 17:39:42 +02:00
parent 38ae53e9d8
commit 33e97fc07b
4 changed files with 257 additions and 129 deletions

View file

@ -158,7 +158,7 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
type: 3 type: 3
objectId: bab5c804-640f-445c-90c5-fda732b56ca6 objectId: bab5c804-640f-445c-90c5-fda732b56ca6
randomNum: 78440909 randomNum: 87404118
unityVersion: 2021.3.41f1 unityVersion: 2021.3.41f1
cckVersion: 3.10:132 cckVersion: 3.10:132
--- !u!114 &97266995 --- !u!114 &97266995
@ -1367,14 +1367,170 @@ Transform:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1500710831} m_GameObject: {fileID: 1500710831}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 1, z: 0, w: 0}
m_LocalPosition: {x: 0, y: 1, z: -10} m_LocalPosition: {x: 0, y: 0, z: 1}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 0 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 180, z: 0}
--- !u!1 &1557152369
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1557152376}
- component: {fileID: 1557152375}
- component: {fileID: 1557152374}
- component: {fileID: 1557152373}
- component: {fileID: 1557152372}
- component: {fileID: 1557152371}
- component: {fileID: 1557152370}
m_Layer: 0
m_Name: QuineGolfSurface
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1557152370
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1557152369}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 990f6f4efb7f4ec98ad99f6dff1bc6f6, type: 3}
m_Name:
m_EditorClassIdentifier:
type: 3
objectId: bab5c804-640f-445c-90c5-fda732b56ca6
randomNum: 87404118
unityVersion: 2021.3.41f1
cckVersion: 3.10:132
--- !u!114 &1557152371
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1557152369}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a37fd8d654d5c2840a0ab3a5ad65a5ae, type: 3}
m_Name:
m_EditorClassIdentifier:
spawnHeight: 0
useAdditionalValues: 0
syncValues: []
propPrivacy: 1
subSyncs: []
spawnableType: 0
preGeneratedInstanceId:
--- !u!114 &1557152372
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1557152369}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 12974925555b471580cacf5d2d5fa9e3, type: 3}
m_Name:
m_EditorClassIdentifier:
gripType: 1
gripOrigin: {fileID: 0}
disallowTheft: 0
maximumGrabDistance: 0
snappingReferences: []
autoHold: 0
updateWithPhysics: 1
ikReference: {fileID: 0}
--- !u!65 &1557152373
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1557152369}
m_Material: {fileID: 0}
m_IsTrigger: 1
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 1, y: 1, z: 0.05}
m_Center: {x: 0, y: 0, z: 0}
--- !u!23 &1557152374
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1557152369}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: a912cfd0d29b182919c919ffe9311039, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!33 &1557152375
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1557152369}
m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0}
--- !u!4 &1557152376
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1557152369}
m_LocalRotation: {x: 0, y: 1, z: 0, w: 0}
m_LocalPosition: {x: 1, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 11
m_LocalEulerAnglesHint: {x: 0, y: 180, z: 0}
--- !u!1001 &2026983552 --- !u!1001 &2026983552
PrefabInstance: PrefabInstance:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -41,17 +41,17 @@ fn main() {
encoded_text.push(temp); encoded_text.push(temp);
} }
let mut out_string = String::new(); let mut out_string = String::new();
out_string += "\t\t\t\tconst uint text[] = {"; out_string += "\t\tconst uint text[] = {";
for t in &encoded_text { for t in &encoded_text {
out_string += &format!("{t:#010x},"); out_string += &format!("{t:#010x},");
} }
out_string += "};\n"; out_string += "};\n";
out_string += &format!("\t\t\t\tconst uint text_len = {};\n", encoded_text.len()); out_string += &format!("\t\tconst uint text_len = {};\n", encoded_text.len());
out_string += &format!("\t\t\t\tconst uint blob_start = {blob_start};\n"); out_string += &format!("\t\tconst uint blob_start = {blob_start};\n");
// font // font
let img = ImageReader::open("vgafont.png").unwrap().decode().unwrap(); let img = ImageReader::open("vgafont.png").unwrap().decode().unwrap();
let mut out = Vec::new(); let mut encoded_font = Vec::new();
for &c in FULL_CHARSET { for &c in FULL_CHARSET {
let col = c as u32 & 0b1_1111; let col = c as u32 & 0b1_1111;
let row = (c as u32 >> 5) & 0b111; let row = (c as u32 >> 5) & 0b111;
@ -67,16 +67,14 @@ fn main() {
} }
} }
} }
out.push(encoded); encoded_font.push(encoded);
} }
out_string += "\n\t\t\t\tconst uint font_a[48][4] = {"; out_string += &format!("\n\t\tconst uint font[{}][4] = {{", encoded_font.len());
for (i, c) in out.iter().enumerate() { for c in encoded_font {
if i == 48 {
out_string += &format!("}};\n\t\t\t\tconst uint font_b[{}][4] = {{", out.len() - 48);
}
out_string += &format!("{{{},{},{},{}}},", c[0], c[1], c[2], c[3]); out_string += &format!("{{{},{},{},{}}},", c[0], c[1], c[2], c[3]);
} }
out_string.pop();
out_string += "};\n"; out_string += "};\n";
let mut file = File::create("out.h").unwrap(); let mut file = File::create("out.h").unwrap();
file.write_all(out_string.as_bytes()).unwrap(); file.write_all(out_string.as_bytes()).unwrap();
@ -132,7 +130,7 @@ fn golfed() {
// font // font
let img = ImageReader::open("6x6.png").unwrap().decode().unwrap(); let img = ImageReader::open("6x6.png").unwrap().decode().unwrap();
let mut out = Vec::new(); let mut encoded_font = Vec::new();
for c in used_charset { for c in used_charset {
let col = c as u32 & 0b1_1111; let col = c as u32 & 0b1_1111;
let row = (c as u32 >> 5) & 0b111; let row = (c as u32 >> 5) & 0b111;
@ -146,11 +144,11 @@ fn golfed() {
encoded |= pixel << offset; encoded |= pixel << offset;
} }
} }
out.push(encoded); encoded_font.push(encoded);
} }
out_string += "const uint R[]={"; out_string += "const uint R[]={";
for (_i, c) in out.iter().enumerate() { for c in encoded_font {
out_string += &format!("{c},"); out_string += &format!("{c},");
} }
out_string.pop(); out_string.pop();