update to python3.7, update dependencies and fix obvious update issues
This commit is contained in:
parent
2946de94f6
commit
c5fc590c2a
16 changed files with 52 additions and 46 deletions
|
@ -10,8 +10,8 @@ from django.http import HttpResponse
|
|||
from django.shortcuts import redirect
|
||||
from django.utils.cache import get_conditional_response
|
||||
from django.utils.http import http_date, quote_etag, urlsafe_base64_encode
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.translation import get_language
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from rest_framework.decorators import detail_route, list_route
|
||||
from rest_framework.exceptions import NotFound, ValidationError
|
||||
from rest_framework.mixins import RetrieveModelMixin
|
||||
|
|
|
@ -8,8 +8,8 @@ from django.core.validators import RegexValidator
|
|||
from django.db import models
|
||||
from django.utils.functional import cached_property, lazy
|
||||
from django.utils.text import format_lazy
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.translation import get_language
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from shapely import validation
|
||||
from shapely.geometry import LineString, MultiPolygon, Point, Polygon, mapping, shape
|
||||
from shapely.geometry.base import BaseGeometry
|
||||
|
|
|
@ -4,8 +4,8 @@ from django.conf import settings
|
|||
from django.core.exceptions import ValidationError
|
||||
from django.forms import CharField, ModelForm
|
||||
from django.utils.text import capfirst, format_lazy
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.translation import get_language_info
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from c3nav.mapdata.fields import I18nField
|
||||
|
||||
|
|
|
@ -240,7 +240,7 @@ class AccessPermission(models.Model):
|
|||
|
||||
class AccessRestrictionMixin(SerializableMixin, models.Model):
|
||||
access_restriction = models.ForeignKey(AccessRestriction, null=True, blank=True,
|
||||
verbose_name=_('Access Restriction'))
|
||||
verbose_name=_('Access Restriction'), on_delete=models.PROTECT)
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
|
|
@ -3,8 +3,8 @@ from collections import OrderedDict
|
|||
from django.core.cache import cache
|
||||
from django.db import models
|
||||
from django.db.models import Q
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.translation import get_language, get_language_info
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from c3nav.mapdata.fields import I18nField
|
||||
from c3nav.mapdata.models import MapUpdate
|
||||
|
|
|
@ -5,7 +5,7 @@ from itertools import chain
|
|||
from queue import Queue
|
||||
from typing import Optional
|
||||
|
||||
import ModernGL
|
||||
import moderngl
|
||||
import numpy as np
|
||||
from PIL import Image
|
||||
from shapely.geometry import CAP_STYLE, JOIN_STYLE, Polygon
|
||||
|
@ -25,14 +25,14 @@ class RenderContext(namedtuple('RenderContext', ('width', 'height', 'ctx', 'prog
|
|||
|
||||
@classmethod
|
||||
def create(cls, width, height):
|
||||
ctx = ModernGL.create_standalone_context()
|
||||
ctx = moderngl.create_standalone_context()
|
||||
|
||||
color_rbo = ctx.renderbuffer((width, height), samples=ctx.max_samples)
|
||||
fbo = ctx.framebuffer([color_rbo])
|
||||
fbo.use()
|
||||
|
||||
prog = ctx.program([
|
||||
ctx.vertex_shader('''
|
||||
prog = ctx.program(
|
||||
vertex_shader='''
|
||||
#version 330
|
||||
in vec3 in_vert;
|
||||
in vec4 in_color;
|
||||
|
@ -44,18 +44,18 @@ class RenderContext(namedtuple('RenderContext', ('width', 'height', 'ctx', 'prog
|
|||
gl_Position = mvp * vec4(in_vert, 1.0);
|
||||
v_color = in_color;
|
||||
}
|
||||
'''),
|
||||
ctx.fragment_shader('''
|
||||
''',
|
||||
fragment_shader='''
|
||||
#version 330
|
||||
in vec4 v_color;
|
||||
out vec4 f_color;
|
||||
void main() {
|
||||
f_color = v_color;
|
||||
}
|
||||
'''),
|
||||
])
|
||||
'''
|
||||
)
|
||||
|
||||
ctx.enable(ModernGL.BLEND)
|
||||
ctx.enable(moderngl.BLEND)
|
||||
|
||||
return cls(width, height, ctx, prog, fbo)
|
||||
|
||||
|
@ -115,15 +115,16 @@ class OpenGLWorker(threading.Thread):
|
|||
ctx = self._get_ctx(task.width, task.height)
|
||||
ctx.ctx.clear(*task.background_rgb)
|
||||
|
||||
ctx.prog.uniforms['mvp'].value = task.mvp
|
||||
ctx.prog['mvp'].value = task.mvp
|
||||
|
||||
if task.vertices:
|
||||
vbo = ctx.ctx.buffer(task.vertices)
|
||||
vao = ctx.ctx.simple_vertex_array(ctx.prog, vbo, ['in_vert', 'in_color'])
|
||||
# noinspection PyTypeChecker
|
||||
vao = ctx.ctx.simple_vertex_array(ctx.prog, vbo, 'in_vert', 'in_color')
|
||||
vao.render()
|
||||
|
||||
color_rbo2 = ctx.ctx.renderbuffer((task.width, task.height))
|
||||
fbo2 = ctx.ctx.framebuffer(color_rbo2)
|
||||
fbo2 = ctx.ctx.framebuffer([color_rbo2])
|
||||
ctx.ctx.copy_framebuffer(fbo2, ctx.fbo)
|
||||
|
||||
img = Image.frombytes('RGB', (task.width, task.height), fbo2.read(components=3))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue