<commit_before>/*
* Copyright (C) 2014 - <NAME> <<EMAIL>>
*
* This sofware is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this software. If not, see <http://www.gnu.org/licenses/>.
*/

use ooc-math
use ooc-base
use ooc-collections
use ooc-draw
use ooc-draw-gpu

import OpenGLES3/Fbo, OpenGLES3/Quad, OpenGLES3/Texture, OpenGLES3Bgr, OpenGLES3Yuv420Semiplanar, OpenGLES3Yuv420Planar, Map/OpenGLES3Map, OpenGLES3Bgra, OpenGLES3Uv, OpenGLES3Monochrome, OpenGLES3Context

OpenGLES3Canvas: class extends GpuCanvas {
	_renderTarget: Fbo
	context ::= this _context as OpenGLES3Context
	init: func (image: GpuImage, context: GpuContext) {
		super(image, context)
		this reset()
	}
	free: override func {
		this _renderTarget free()
		super()
	}
	_bind: override func { this _renderTarget bind() }
	_unbind: override func { this _renderTarget unbind() }
	onRecycle: func {
		this reset()
		this _renderTarget invalidate()
	}
	draw: func ~packed (image: GpuPacked) {
		map := this _context getMap(this _target, GpuMapType transform) as OpenGLES3MapDefault
		map model = this _createModelTransform(image size, image transform)
		map view = this _view
		map projection = this _projection
		this map = map
		this draw(func {
			image bind(0)
			this context drawQuad()
		})
	}
	draw: func (image: Image) {
		if (image instanceOf?(GpuPacked)) { this draw(image as GpuPacked) }
		else if (image instanceOf?(RasterPacked)) {
			temp := this context createGpuImage(image as RasterPacked)
			this draw(temp as GpuPacked)
			temp free()
		}
		else
			Debug raise("Trying to draw unsupported image format to OpenGLES3Canvas!")<commit_msg>Default map is now standard transform map.<commit_after>/*
* Copyright (C) 2014 - <NAME> <<EMAIL>>
*
* This sofware is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this software. If not, see <http://www.gnu.org/licenses/>.
*/

use ooc-math
use ooc-base
use ooc-collections
use ooc-draw
use ooc-draw-gpu

import OpenGLES3/Fbo, OpenGLES3/Quad, OpenGLES3/Texture, OpenGLES3Bgr, OpenGLES3Yuv420Semiplanar, OpenGLES3Yuv420Planar, Map/OpenGLES3Map, OpenGLES3Bgra, OpenGLES3Uv, OpenGLES3Monochrome, OpenGLES3Context

OpenGLES3Canvas: class extends GpuCanvas {
	_renderTarget: Fbo
	context ::= this _context as OpenGLES3Context
	init: func (image: GpuImage, context: GpuContext) {
		super(image, context)
		this reset()
		this map = context getMap(image, GpuMapType transform)
	}
	free: override func {
		this _renderTarget free()
		super()
	}
	_bind: override func { this _renderTarget bind() }
	_unbind: override func { this _renderTarget unbind() }
	onRecycle: func {
		this reset()
		this _renderTarget invalidate()
	}
	draw: func ~packed (image: GpuPacked) {
		this map model = this _createModelTransform(image size, image transform)
		this map view = this _view
		this map projection = this _projection
		this draw(func {
			image bind(0)
			this context drawQuad()
		})
	}
	draw: func (image: Image) {
		if (image instanceOf?(GpuPacked)) { this draw(image as GpuPacked) }
		else if (image instanceOf?(RasterPacked)) {
			temp := this context createGpuImage(image as RasterPacked)
			this draw(temp as GpuPacked)
			temp free()
		}
		else
			Debug raise("Trying to draw unsupported image format to OpenGLES3Canvas!")
{'fraction_non_alphanumeric': 0.08246225319396051, 'fraction_numerical': 0.012775842044134728, 'mean_word_length': 4.506393861892583, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5925459', 'n_tokens_mistral': 1433, 'n_tokens_neox': 1356, 'n_words': 508}