mirror of
https://github.com/3b1b/manim.git
synced 2025-09-01 00:48:45 +00:00
Have shader_info remember its own id
This commit is contained in:
parent
9d772496dd
commit
1e6eef89ec
1 changed files with 13 additions and 16 deletions
|
@ -46,22 +46,19 @@ def get_shader_info(data=None,
|
||||||
depth_test=False,
|
depth_test=False,
|
||||||
render_primative=moderngl.TRIANGLE_STRIP,
|
render_primative=moderngl.TRIANGLE_STRIP,
|
||||||
):
|
):
|
||||||
return {
|
result = {
|
||||||
key: value
|
"data": data,
|
||||||
for key, value in zip(
|
"vert": vert_file,
|
||||||
SHADER_INFO_KEYS,
|
"geom": geom_file,
|
||||||
[
|
"frag": frag_file,
|
||||||
data,
|
"uniforms": uniforms or dict(),
|
||||||
vert_file,
|
"texture_paths": texture_paths or dict(),
|
||||||
geom_file,
|
"depth_test": depth_test,
|
||||||
frag_file,
|
"render_primative": str(render_primative),
|
||||||
uniforms or dict(),
|
|
||||||
texture_paths or dict(),
|
|
||||||
depth_test,
|
|
||||||
str(render_primative)
|
|
||||||
]
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
# A unique id for a shader
|
||||||
|
result["id"] = "|".join([str(result[key]) for key in SHADER_KEYS_FOR_ID])
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
def is_valid_shader_info(shader_info):
|
def is_valid_shader_info(shader_info):
|
||||||
|
@ -75,7 +72,7 @@ def is_valid_shader_info(shader_info):
|
||||||
|
|
||||||
def shader_info_to_id(shader_info):
|
def shader_info_to_id(shader_info):
|
||||||
# A unique id for a shader
|
# A unique id for a shader
|
||||||
return "|".join([str(shader_info[key]) for key in SHADER_KEYS_FOR_ID])
|
return shader_info["id"]
|
||||||
|
|
||||||
|
|
||||||
def same_shader_type(info1, info2):
|
def same_shader_type(info1, info2):
|
||||||
|
|
Loading…
Add table
Reference in a new issue