Skip to content

Instantly share code, notes, and snippets.

@mamontov-cpp
mamontov-cpp / VBOUtils.java
Created April 26, 2018 11:49
VBOUtils.java
package gl;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
import java.util.ArrayList;
import org.lwjgl.BufferUtils;
import org.lwjgl.opengl.ARBVertexBufferObject;
import org.lwjgl.opengl.ContextCapabilities;
import org.lwjgl.opengl.GLContext;
@mamontov-cpp
mamontov-cpp / GeometryBuffer.java
Created April 26, 2018 11:48
GeometryBuffer.java
package gl;
import org.lwjgl.opengl.ARBBufferObject;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
public class GeometryBuffer
{
private final int indexBuffer;
private final int vertexBuffer;
@mamontov-cpp
mamontov-cpp / BufferDataFormatType.java
Created April 26, 2018 11:48
BufferDataFormatType.java
package gl;
public enum BufferDataFormatType
{
VERTICES(3), VERTICES_AND_TEXTURES(5), VERTICES_AND_NORMALS(6), VERTICES_TEXTURES_NORMALS(8);
public final int elementsPerVertex;
private BufferDataFormatType(int elementSize)
{
@mamontov-cpp
mamontov-cpp / GeometryBufferGenerator.java
Created April 26, 2018 11:47
GeometryBufferGenerator.java
package gl;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
import org.lwjgl.BufferUtils;
public class GeometryBufferGenerator
{
public static GeometryBuffer generateGeometryBuffer(BufferDataFormatType dataFormat, float[] vertices, IntBuffer indexes)
{
@mamontov-cpp
mamontov-cpp / BrickLoader.java
Created April 26, 2018 11:37
BrickLoader.java
package brickLoader;
import gl.BufferDataFormatType;
import gl.GeometryBuffer;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.IntBuffer;
<?php
/**
* Очищает БД, подготавливая её к новй распаковке
* Зависит от трех глобалок $mysqlDatabase, $mysqlPassword, $mysqlUser
* @throws \Exception Если не удалось это сделать
*/
function clear_database()
{
global $maxAttempts;
$realClearDatabase = function() {
@mamontov-cpp
mamontov-cpp / trim_text.php
Last active April 20, 2018 13:54
Решение задачи 1
<?php
/**
* Производит обрезку текста, не разрывая слова, так, чтобы он не попадал в длину
* если длина равна 1 или 2, а длина слова больше этой длины, то многоточие так же обрезается
* @param string $string строка
* @param int $length длина строки
* @return новая, преобразованная строка
*/
function trimText(string $string, int $length)
{
void testTextureUploadError()
{
class RecoverableLogTarget: public sad::log::Target
{
public:
RecoverableLogTarget()
{
}
#include <math.h>
#include <cstdio>
#include "timerimpl.h"
struct Mass;
struct Acceleration;
struct Time;
struct Force
{
double m_value;
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="csrf-token" content="{{ csrf_token() }}">