repo_name stringlengths 5 122 | path stringlengths 3 232 | text stringlengths 6 1.05M |
|---|---|---|
danesh-d/do-sort | src/bubble_sort.h | <reponame>danesh-d/do-sort<gh_stars>0
#ifndef BUBBLE_SORT_H
#define BUBBLE_SORT_H
#include "do_sort.h"
using namespace std;
namespace do_sort {
// --- Bubble sort.
template <class T>
class bubble_sort : public sort<T> {
protected:
void specific_do_sort() {
LL n = sort<T>::size();
if ... |
danesh-d/do-sort | src/BST.h | #ifndef BST_H
#define BST_H
#include "do_sort.h"
using namespace std;
namespace do_sort {
// --- Binary Search Tree (BST).
template <class T>
class BST {
private:
ULL num_nodes;
vector<T> intern_vec;
// The structure uses only pointers to the original data in the tree.
// Therefore... |
danesh-d/do-sort | src/strand_sort.h | <gh_stars>0
#ifndef STRAND_SORT_H
#define STRAND_SORT_H
#include "do_sort.h"
using namespace std;
namespace do_sort {
// --- Strand sort implementation.
template <class T>
class strand_sort : public sort<T> {
private:
list<T> sorted_list;
protected:
// Perform the strand sort. This sorting... |
danesh-d/do-sort | src/comb_sort.h | #ifndef COMB_SORT_H
#define COMB_SORT_H
#include "do_sort.h"
using namespace std;
namespace do_sort {
// --- Heap sort.
template <class T>
class comb_sort : public sort<T> {
private:
float shrinkFactor;
int nextGap(int gap) {
gap = (int)(gap / shrinkFactor);
return gap < 1 ? 1 ... |
danesh-d/do-sort | src/merge_sort.h | #ifndef MERGE_SORT_H
#define MERGE_SORT_H
#include "do_sort.h"
using namespace std;
namespace do_sort {
// --- Merge sort.
template <class T>
class merge_sort : public sort<T> {
private:
vector<T> aux;
void recursive_msort(vector<T>& v,
vector<T>& aux,
... |
danesh-d/do-sort | src/gnome_sort.h | #ifndef GNOME_SORT_H
#define GNOME_SORT_H
#include "do_sort.h"
using namespace std;
// Note: This method can be highly ineffective.
namespace do_sort {
// --- Gnome sort.
template <class T>
class gnome_sort : public sort<T> {
private:
void gnome_sort_bounded(LL upper_bound, bool asc) {
LL po... |
DonLakeFlyer/VHFCollarTracker | custom/src/VHFTrackerSettings.h | /****************************************************************************
*
* (c) 2009-2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
*************************************... |
DonLakeFlyer/VHFCollarTracker | custom/src/VHFTrackerQGCPlugin.h | <filename>custom/src/VHFTrackerQGCPlugin.h
#pragma once
#include "QGCCorePlugin.h"
#include "QmlObjectListModel.h"
#include "SettingsFact.h"
#include "VHFTrackerQGCOptions.h"
#include "QGCLoggingCategory.h"
#include <QElapsedTimer>
#include <QGeoCoordinate>
#include <QTimer>
class VHFTrackerSettings;
Q_DECLARE_LOGG... |
iFindTA/PBMultiPackage | Pods/PBKits/NHUtilSetsPro/Utils/UIImage+PBHelper.h | //
// UIImage+PBHelper.h
// NHUtilSetsPro
//
// Created by <NAME> on 16/4/14.
// Copyright © 2016年 <NAME>. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface UIImage (PBHelper)
/**
* @brief load image from content path that not cached in memory
*
* @param name the image's na... |
microsoft/hibernation-setup-tool | hibernation-setup-tool.c | <gh_stars>1-10
// Hibernation Setup Tool
// Sets up a swap area suitable to hibernate a Linux system.
//
// Copyright (c) 2021 Microsoft Corp.
// Licensed under the terms of the MIT license.
#define _GNU_SOURCE
/* sys/mount.h has to be included before linux/fs.h
* https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=89... |
wkoutre/react-native-yunpeng-alipay | ios/AlipayModule/AlipayModule.h | //
// AlipayModule.h
// AlipayModule
//
// Created by <NAME> on 16/5/10.
// Copyright © 2016年 <NAME>. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "React/RCTBridgeModule.h"
@interface AlipayModule : NSObject<RCTBridgeModule>
+(void) handleCallback:(NSURL *)url;
@end
|
Sxlly/SimonSays | commands_ll.h | #ifndef COMMANDS_LL_H
#define COMMANDS_LL_H
void insert_first(int key, int data);
bool is_empty();
#endif
|
Sxlly/SimonSays | file_input.c | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "user_input.h"
int file_reader(char filename[]) {
int status = 0;
FILE *fptr;
if ((fptr = fopen(filename, "r")) == NULL) {
fclose(fptr);
status = 1;
return status;
}
else {
fclose(fptr);
return status;
}
}
|
Sxlly/SimonSays | main.c | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <stdbool.h>
#include <time.h>
#include "main.h"
#include "user_input.h"
#include "data_parser.h"
#include "singleyll.h"
#include "simon.h"
/* onboard main method to create a command which is then added to command list */
/* using... |
Sxlly/SimonSays | singleyll.h | #ifndef SINGLEYLL_H
#define SINGLEYLL_H
/* structure for creating a command */
typedef struct command {
int selection;
} com_t;
/* node structure */
typedef struct comlist_node {
com_t value;
struct comlist_node* next;
}comlist_node_t;
/* linked list structure */
typedef struct comlist {
comlist_node_t* ... |
Sxlly/SimonSays | data_parser.h | #ifndef DATA_PARSER_H
#define DATA_PARSER_H
void data_parse(char filename[256]);
#endif
|
Sxlly/SimonSays | commands_ll.c | <gh_stars>0
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <stdbool.h>
#include "commands_ll.h"
struct command {
int data;
int key;
struct command *next;
};
struct command *head = NULL;
struct command *current = NULL;
void insert_first(int key, int data) {
struct co... |
Sxlly/SimonSays | singleyll.c | #include "singleyll.h"
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include "simon.h"
/* command list creation method */
comlist_t * create_comlist() {
/* using calloc for memory allocation */
/* setting all list nodes to hold NULL value */
comlist_t* new_comlist = (comlist_t*)calloc(1, sizeof(co... |
Sxlly/SimonSays | main.h | #ifndef MAIN_H
#define MAIN_H
void terminal_spacer();
int main(int argc, char* argv[]);
#endif
|
Sxlly/SimonSays | data_parser.c | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "data_parser.h"
#include "singleyll.h"
void data_parse(char filename[256]) {
FILE* fptr = fopen(filename, "r");
char file_line[256];
system("clear");
printf("\t\t\tThe File You Have Choosen Contains The Following: \n");
... |
Sxlly/SimonSays | user_input.h | #ifndef USER_INPUT_H
#define USER_INPUT_H
int file_reader(char filename[]);
#endif
|
Sxlly/SimonSays | simon.c | <reponame>Sxlly/SimonSays<filename>simon.c
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <time.h>
#include "simon.h"
#include "singleyll.h"
#include "main.h"
void simon_rightarm_gen() {
FILE *fptr;
char str[1000];
fptr = fopen("sframebase.txt", "r");
terminal_spacer... |
Sxlly/SimonSays | simon.h | #ifndef SIMON_H
#define SIMON_H
#include "singleyll.h"
void simon_rightarm_gen();
void simon_leftarm_gen();
void simon_handonhead_gen();
void simon_dance_gen();
void simon_ds_gen();
void commands_to_simon(comlist_t *list);
#endif
|
Gazareth/clippy | jni/com.esotericsoftware.clippy.tobii.EyeX.h | <reponame>Gazareth/clippy<gh_stars>100-1000
#include <jni.h>
#ifdef __cplusplus
extern "C" {
#endif
JNIEXPORT jlong JNICALL Java_com_esotericsoftware_clippy_tobii_EyeX__1connect (JNIEnv*, jobject, jstring);
JNIEXPORT jboolean JNICALL Java_com_esotericsoftware_clippy_tobii_EyeX__1disconnect (JNIEnv*, jobject, jlong)... |
Gazareth/clippy | jni/com.esotericsoftware.clippy.tobii.EyeX.c |
#include <com.esotericsoftware.clippy.tobii.EyeX.h>
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include <assert.h>
#include "eyex/EyeX.h"
static JavaVM* jvm = NULL;
static __declspec(thread) JNIEnv* threadEnv = NULL;
typedef struct EyeX {
jobject obj... |
UzxMx/xf_sdk | ext/xf_sdk/qisr.h | <gh_stars>100-1000
/**
* @file qisr.h
* @brief iFLY Speech Recognizer Header File
*
* This file contains the quick application programming interface (API) declarations
* of ISR. Developer can include this file in your project to build applications.
* For more information, please read the developer guide... |
UzxMx/xf_sdk | ext/xf_sdk/xf_sdk.c | <reponame>UzxMx/xf_sdk
#include "xf_sdk.h"
#include "msp_errors.h"
VALUE rb_mXfSdk;
void
Init_xf_sdk(void)
{
rb_mXfSdk = rb_define_module("XfSdk");
VALUE mod = rb_define_module_under(rb_mXfSdk, "Internal");
rb_define_singleton_method(mod, "tts", tts, 3);
rb_define_singleton_method(mod, "success?", is_success... |
UzxMx/xf_sdk | ext/xf_sdk/xf_sdk.h | <gh_stars>0
#ifndef XF_SDK_H
#define XF_SDK_H 1
#include "ruby.h"
VALUE tts(VALUE mod, VALUE text, VALUE dest_path, VALUE params);
VALUE is_success(VALUE mod, VALUE code);
#endif /* XF_SDK_H */
|
xq-120/JKPresentationController | JKPresentationControllerDemo/JKPresentationControllerDemo/JKInterActiveGroupVipUserModel.h | //
// ZAEInterActiveGroupVipUserModel.h
// JKPresentationControllerDemo
//
// Created by xuequan on 2020/10/14.
// Copyright © 2020 xuequan. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface JKInterActiveGroupVipUserModel : NSObject
@property (nonatomic, assign) NSInte... |
xq-120/JKPresentationController | JKPresentationController/JKBaseAlertViewController.h | //
// JKBaseAlertViewController.h
// JKPresentationController
//
// Created by xuequan on 2020/9/13.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface JKBaseAlertViewController : UIViewController
@property (nonatomic, strong) UIColor *backViewBgColor;
/** 默认NO。 */
@property (nonatomic, assign) BOOL ... |
resetius/graphtoys | models/particles.c | <reponame>resetius/graphtoys<filename>models/particles.c
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <render/render.h>
#include <render/pipeline.h>
#include <lib/linmath.h>
#include <models/particles.vert.h>
#include <models/particles.frag.h>
#include <models/particles.comp.h>
#include <models/... |
resetius/graphtoys | vulkan/tools.h | #pragma once
#include "vk.h"
void create_buffer(
VkPhysicalDeviceMemoryProperties props,
VkDevice logicalDevice,
VkDeviceSize size,
VkBufferUsageFlags usage,
VkMemoryPropertyFlags properties,
VkBuffer* buffer,
VkDeviceMemory* bufferMemory);
void copy_buffer(
int graphics_family,
V... |
resetius/graphtoys | models/torus.h | <reponame>resetius/graphtoys
#pragma once
#include <render/render.h>
#include <lib/object.h>
struct Config;
struct Object* CreateTorus(struct Render* r, struct Config* cfg);
|
resetius/graphtoys | models/particles_data.c | <reponame>resetius/graphtoys
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <time.h>
#include <lib/config.h>
#include "particles_data.h"
struct body
{
double x[3];
double v[3];
double mass;
int fixed;
char name[100];
};
void particles_data_init(struct ParticlesData* data, struc... |
resetius/graphtoys | vulkan/renderpass.c | #include <stdio.h>
#include <stdlib.h>
#include "renderpass.h"
void rp_init(struct RenderPass* r, VkDevice logDev, VkFormat swapChainImageFormat, VkFormat depthFormat) {
VkAttachmentDescription colorAttachment = {
.format = swapChainImageFormat,
.samples = VK_SAMPLE_COUNT_1_BIT,
.loadOp = VK_... |
resetius/graphtoys | lib/formats/stl.c | <reponame>resetius/graphtoys<gh_stars>0
#include <stdio.h>
#include <stdlib.h>
#include <lib/verify.h>
#include "stl.h"
struct StlVertex* stl_load(const char* fname, int* nvertices) {
FILE* f = fopen(fname, "rb");
char header[100];
int n_triangles;
int i,j,k;
struct StlVertex* res;
float min_x,... |
resetius/graphtoys | lib/event.h | <gh_stars>0
#pragma once
struct InputEvent {
int key;
int scancode;
int action;
int mods;
double x;
double y;
double dx;
double dy;
unsigned char* mask;
};
struct EventConsumer {
void (*key_event)(struct EventConsumer*, struct InputEvent* ev);
void (*mouse_move_event)(str... |
resetius/graphtoys | vulkan/swapchain.h | <gh_stars>0
#pragma once
#include "vk.h"
struct RenderImpl;
struct SwapChain {
struct RenderImpl* r;
VkSwapchainKHR swapchain;
VkFormat im_format;
VkExtent2D extent;
VkImage* images;
int n_images;
VkImage depth_image;
VkDeviceMemory depth_image_memory;
VkFormat depth_format;
};
vo... |
resetius/graphtoys | glad/gl.h | /**
* Loader generated by glad 2.0.0-beta on Sun Dec 26 19:47:01 2021
*
* Generator: C/C++
* Specification: gl
* Extensions: 3
*
* APIs:
* - gl:compatibility=4.6
*
* Options:
* - ALIAS = False
* - DEBUG = False
* - HEADER_ONLY = True
* - LOADER = False
* - MX = False
* - MX_GLOBAL = False
* - O... |
resetius/graphtoys | opengl/render.c | #include <stdlib.h>
#include <ktx.h>
#define GLFW_INCLUDE_NONE
#include <GLFW/glfw3.h>
#define GLAD_GL_IMPLEMENTATION
#include <glad/gl.h>
#include <render/render.h>
#include <render/char.h>
#include <render/pipeline.h>
#include <ft2build.h>
#include FT_FREETYPE_H
#include <lib/verify.h>
struct Program* prog_open... |
resetius/graphtoys | vulkan/buffer.c | #include <stdlib.h>
#include <assert.h>
#include <string.h>
#include <stdio.h>
#include <render/buffer.h>
#include <render/render.h>
#include "render_impl.h"
#include "buffer.h"
#include "tools.h"
struct BufferManagerImpl {
struct BufferManagerBase base;
struct RenderImpl* r;
};
static int create(
struc... |
resetius/graphtoys | models/particles_data.h | <reponame>resetius/graphtoys
#pragma once
struct ParticlesData {
float* coords;
float* vels;
float* accel;
int* indices;
int n_particles;
};
struct Config;
void particles_data_init(struct ParticlesData* data, struct Config* cfg);
void particles_data_destroy(struct ParticlesData* data);
|
resetius/graphtoys | vulkan/device.c | <gh_stars>0
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "device.h"
void device_new(struct Device* dev, VkPhysicalDevice gpu, const char** enable, int n_enable, const VkDeviceQueueCreateInfo* queue_info, int n_queue_info) {
memset(dev, 0, sizeof(*dev));
vkEnumerateDeviceExtensionPropert... |
resetius/graphtoys | test/config.c | #include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
#include <cmocka.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <lib/config.h>
static void get_config_fname(char* out, int size, const char* dir, const char* config) {
memset(out, 0, size);
strncpy(out, dir, size-256);
strc... |
resetius/graphtoys | models/gltf.c |
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <lib/formats/gltf.h>
#include <lib/object.h>
#include <lib/linmath.h>
#include <lib/camera.h>
#include <lib/config.h>
#include <lib/event.h>
#include <render/pipeline.h>
#include <models/base.frag.h>
#include <models/base.vert.h>
#include <models/bas... |
resetius/graphtoys | vulkan/render_impl.h | #pragma once
#include "vk.h"
#define GLFW_INCLUDE_NONE
#include <GLFW/glfw3.h>
#include <render/render.h>
#include "swapchain.h"
#include "renderpass.h"
#include "rendertarget.h"
#include "commandbuffer.h"
#include "device.h"
#include "frame.h"
struct Texture {
VkImage tex;
VkDeviceMemory memory;
VkImag... |
resetius/graphtoys | vulkan/tools.c | #include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <lib/verify.h>
#include "tools.h"
#include "render_impl.h"
#include <ktxvulkan.h>
static uint32_t findMemoryTypeIndex(VkPhysicalDeviceMemoryProperties* props, uint32_t typeFilter, VkMemoryPropertyFlags flags)
{
for (uint32_t i = 0; i < props->m... |
resetius/graphtoys | models/torus.c |
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <lib/object.h>
#include "torus.h"
#include <render/pipeline.h>
#include <render/buffer.h>
#include <lib/linmath.h>
#include <models/triangle.frag.h>
#include <models/torus.vert.h>
#include <models/triangle.frag.spv.h>
#include <models/torus.vert.spv.h>... |
resetius/graphtoys | lib/formats/base64.c | <gh_stars>0
#include "base64.h"
#include <lib/verify.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
static char enc_table[] = {
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f'... |
resetius/graphtoys | lib/camera.c | <reponame>resetius/graphtoys
#include <stdio.h>
#include "camera.h"
void cam_init(struct Camera* cam) {
vec3 eye = {0.0f, 0.0f, 0.f};
vec3 center = {.0f, .0f, -1.0f};
vec3 up = {.0f, 1.f, .0f};
memcpy(cam->eye, eye, sizeof(eye));
memcpy(cam->center, center, sizeof(center));
memcpy(cam->up, up... |
resetius/graphtoys | lib/formats/base64.h | #pragma once
#include <stdint.h>
char* base64_decode(const char* input, int64_t size, int64_t* output_size);
char* base64_encode(const char* input, int64_t size, int64_t* output_size);
int base64_test(int argc, char** argv);
|
resetius/graphtoys | vulkan/buffer.h | #pragma once
#include <render/buffer.h>
#include "vk.h"
struct BufferImpl {
struct BufferBase base;
VkBuffer buffer[10]; // buffer per swapchain image
VkDeviceMemory memory[10]; // used for uniform buffers
int n_buffers;
VkDeviceSize size;
};
struct Render;
struct BufferManager* buf_mgr_vu... |
resetius/graphtoys | lib/ref.c | <filename>lib/ref.c
#include "ref.h"
void ref(struct Ref* r) {
atomic_fetch_add(&r->counter, 1);
}
void unref(struct Ref* r) {
if (atomic_fetch_sub(&r->counter, 1) == 1) {
r->free(r);
}
}
|
resetius/graphtoys | vulkan/stats.h | <reponame>resetius/graphtoys
#pragma once
struct VkStats;
struct RenderImpl;
struct VkStats* vk_stats_new(struct RenderImpl*);
void vk_stats_free(struct VkStats* );
|
resetius/graphtoys | lib/config.h | #pragma once
struct Config;
struct Config* cfg_new(const char* file, int argc, char** argv);
void cfg_free(struct Config*);
struct Config* cfg_section(struct Config*, const char* section);
long cfg_geti(struct Config*, const char* name);
long cfg_geti_def(struct Config*, const char* name, long def);
double cfg_getf_... |
resetius/graphtoys | lib/config.c | #include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <limits.h>
#include "config.h"
static struct Config* cfg_key_node(struct Config* root, const char* name);
struct Config {
char* section;
char* key;
char* value;
struct Config* next_key;
struct Config* next_sect... |
resetius/graphtoys | vulkan/vk.h | #pragma once
#define VK_NO_PROTOTYPES
#include <vulkan/vulkan.h>
#define DECL_FUNC(name) \
extern PFN_##name name;
#define L0_FUNC(name) DECL_FUNC(name)
#define L1_FUNC(name) DECL_FUNC(name)
#define L2_FUNC(name) DECL_FUNC(name)
#include "symbols.h"
#undef DECL_FUNC
#undef L0_FUNC
#undef L1_FUNC
#undef L2_FUNC... |
resetius/graphtoys | vulkan/pipeline.c | <reponame>resetius/graphtoys<filename>vulkan/pipeline.c
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
#include <render/pipeline.h>
#include <render/render.h>
#include <lib/verify.h>
#include "render_impl.h"
#include "tools.h"
#include "buffer.h"
struct BufferDescriptor {
int str... |
resetius/graphtoys | models/particles2.c | <reponame>resetius/graphtoys<filename>models/particles2.c<gh_stars>0
#include <stdlib.h>
#include <stdio.h>
#include <render/render.h>
#include <render/pipeline.h>
#include <lib/linmath.h>
#include <lib/config.h>
#include <models/particles2.vert.h>
#include <models/particles2.frag.h>
#include <models/particles2.vert... |
resetius/graphtoys | models/triangle.c | #include <stdlib.h>
#include <stdio.h>
#include <render/render.h>
#include <render/pipeline.h>
#include "triangle.h"
#include <lib/linmath.h>
#include <models/triangle.vert.h>
#include <models/triangle.frag.h>
#include <models/triangle.vert.spv.h>
#include <models/triangle.frag.spv.h>
typedef struct Vertex
{
ve... |
resetius/graphtoys | opengl/buffer.c | #include <stdlib.h>
#include <assert.h>
#include <string.h>
#include <stdio.h>
#include <glad/gl.h>
#include <render/buffer.h>
#include <render/render.h>
#include "buffer.h"
struct BufferManagerImpl {
struct BufferManagerBase base;
};
static GLenum buffer_type(enum BufferType type) {
GLenum ret = -1;
s... |
resetius/graphtoys | render/char.h | <filename>render/char.h<gh_stars>0
#pragma once
struct Char {
wchar_t ch;
int w;
int h;
int left;
int top;
int advance;
void* (*texture)(struct Char* ch);
void (*free)(struct Char* ch);
};
|
resetius/graphtoys | vulkan/commandbuffer.c | <reponame>resetius/graphtoys
#include <stdio.h>
#include <stdlib.h>
#include "commandbuffer.h"
#include "render_impl.h"
void cb_init(struct CommandBuffer* d, struct RenderImpl* r) {
VkCommandPoolCreateInfo cpInfo = {
.sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO,
.queueFamilyIndex = r->graph... |
resetius/graphtoys | opengl/program.h | <reponame>resetius/graphtoys<gh_stars>0
#pragma once
#include <lib/linmath.h>
struct Program {
void (*free)(struct Program*);
int (*link)(struct Program*);
int (*use)(struct Program*);
int (*validate)(struct Program*);
// vertex shader
int (*add_vs)(struct Program* p, const char* shader);
... |
resetius/graphtoys | vulkan/char.c | #include <stddef.h>
#include <render/char.h>
#include <ft2build.h>
#include FT_FREETYPE_H
#include "render_impl.h"
#include "tools.h"
struct CharImpl {
struct Char base;
struct RenderImpl* r;
// texture
struct Texture tex;
};
static void* char_texture_(struct Char* ch) {
struct CharImpl* c = (s... |
resetius/graphtoys | render/pipeline.h | <reponame>resetius/graphtoys<gh_stars>0
#pragma once
#include <stdint.h>
#include "render.h"
#include "buffer.h" // TODO: remove
enum GeometryType {
GEOM_TRIANGLES = 0,
GEOM_POINTS
};
enum DataType {
DATA_FLOAT = 0,
DATA_INT
};
enum CullType {
CULL_FRONT = 1,
CULL_BACK = 2,
CULL_BOTH = ... |
resetius/graphtoys | models/mandelbulb.h | <filename>models/mandelbulb.h
#pragma once
#include <render/render.h>
#include <lib/object.h>
struct Config;
struct Object* CreateMandelbulb(struct Render*, struct Config*);
|
resetius/graphtoys | lib/formats/stl.h | <filename>lib/formats/stl.h<gh_stars>0
#pragma once
#include <lib/linmath.h>
struct StlVertex {
vec3 col;
vec3 norm;
vec3 pos;
};
struct StlVertex* stl_load(const char* fname, int* nvertices);
|
resetius/graphtoys | models/particles.h | #pragma once
#include <lib/object.h>
struct Render;
struct Config;
struct Object* CreateParticles(struct Render* r, struct Config* cfg);
|
resetius/graphtoys | vulkan/render.c | #include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "vk.h"
#define GLFW_INCLUDE_NONE
#include <GLFW/glfw3.h>
#include <render/render.h>
#include <lib/config.h>
#include "device.h"
#include "renderpass.h"
#include "swapchain.h"
#include "render_impl.h"
#include "... |
resetius/graphtoys | vulkan/stats.c | <reponame>resetius/graphtoys<filename>vulkan/stats.c
#include <stdio.h>
#include <stdlib.h>
#include "stats.h"
#include "render_impl.h"
struct VkStats {
struct RenderImpl* r;
int has_timestamps;
float timestamp_period;
};
struct VkStats* vk_stats_new(struct RenderImpl* r) {
struct VkStats* v = calloc... |
resetius/graphtoys | vulkan/frame.c | #include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "frame.h"
void frame_init(struct Frame* frame, struct RenderImpl* r) {
memset(frame, 0, sizeof(*frame));
cb_init(&frame->cb, r);
frame->cmd = cb_acquire(&frame->cb);
VkFenceCreateInfo info = {
.sType = VK_STRUCTURE_TYPE_FENCE_C... |
resetius/graphtoys | models/stl.h | #pragma once
#include <render/render.h>
#include <lib/object.h>
#include <lib/config.h>
struct Object* CreateStl(struct Render* r, struct Config* cfg);
|
resetius/graphtoys | vulkan/device.h | #pragma once
#include "vk.h"
struct PhysicalDevice {
VkPhysicalDevice dev;
VkPhysicalDeviceFeatures features;
VkPhysicalDeviceMemoryProperties memory_properties;
VkPhysicalDeviceProperties properties;
};
struct Device {
VkDevice dev;
VkExtensionProperties* extensions;
uint32_t n_extension... |
resetius/graphtoys | models/particles2.h | <reponame>resetius/graphtoys
#pragma once
#include <lib/object.h>
struct Render;
struct Config;
struct Object* CreateParticles2(struct Render* r, struct Config* config);
|
resetius/graphtoys | render/render.h | <filename>render/render.h
#pragma once
#include <stddef.h>
struct Texture;
struct Char;
struct PipelineBuilder;
struct BufferManager;
struct Config;
struct RenderConfig {
const char* api;
// 0 - off
// 1 - on
// 2 - adaptive
int vsync;
int show_fps;
int triple_buffer;
int fullscreen;
... |
resetius/graphtoys | models/mandelbrot.c | <filename>models/mandelbrot.c
#include <stdlib.h>
#include <stdio.h>
#include <render/pipeline.h>
#include "mandelbrot.h"
#include <models/mandelbrot.vert.h>
#include <models/mandelbrot.frag.h>
#include <models/mandelbrot.vert.spv.h>
#include <models/mandelbrot.frag.spv.h>
#include <lib/object.h>
#include <lib/linma... |
resetius/graphtoys | vulkan/rendertarget.c | #include <stdio.h>
#include <stdlib.h>
#include "rendertarget.h"
#include "render_impl.h"
#include "tools.h"
void rt_init(struct RenderTarget* rt, struct RenderImpl* r) {
int i;
rt->n_imageviews = r->sc.n_images;
rt->imageviews = malloc(rt->n_imageviews*sizeof(VkImageView));
for (i = 0; i < rt->n_ima... |
resetius/graphtoys | lib/formats/gltf.h | #pragma once
#include <lib/linmath.h>
#include <stdint.h>
struct GltfAccessor {
char name[256];
int64_t offset;
int view;
int component_type;
int count;
int components;
vec4 max;
vec4 min;
};
struct GltfBuffer {
char* data;
int64_t size;
int buffer;
};
struct GltfView {
... |
resetius/graphtoys | test/base64.c | <reponame>resetius/graphtoys<filename>test/base64.c
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
#include <cmocka.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <lib/formats/base64.h>
static void test_dec(const char* str, const char* dst) {
int64_t size;
char* out = base6... |
resetius/graphtoys | vulkan/loader.c | #define VK_NO_PROTOTYPES
#include <vulkan/vulkan.h>
#define GLFW_INCLUDE_NONE
#include <GLFW/glfw3.h>
#include <assert.h>
#define DECL_FUNC(name) \
PFN_##name name; \
PFN_##name ktx_##name;
#define L0_FUNC(name) DECL_FUNC(name)
#define L1_FUNC(name) DECL_F... |
resetius/graphtoys | lib/object.c | #include <stdlib.h>
#include "object.h"
void ovec_free(struct ObjectVec* v) {
int i;
for (i = 0; i < v->size; i++) {
v->objs[i]->free(v->objs[i]);
}
free(v->objs);
}
void ovec_add(struct ObjectVec* v, struct Object* o) {
if (v->cap <= v->size) {
v->cap = (1+v->cap)*2;
v->ob... |
resetius/graphtoys | models/mandelbulb.c | #include <stdlib.h>
#include <stdio.h>
#include "mandelbulb.h"
#include <models/mandelbulb.vert.h>
#include <models/mandelbulb.frag.h>
#include <models/mandelbulb.vert.spv.h>
#include <models/mandelbulb.frag.spv.h>
#include <lib/object.h>
#include <lib/linmath.h>
#include <render/pipeline.h>
struct UniformBlock {
... |
resetius/graphtoys | render/render.c | <filename>render/render.c<gh_stars>0
#include "render.h"
struct Texture* rend_tex_new(struct Render* r, void* data, enum TexType tex_type) {
return r->tex_new(r, data, tex_type);
}
struct Char* rend_char_new(struct Render* r, wchar_t ch, void* face) {
return r->char_new(r, ch, face);
}
void rend_free(struct ... |
resetius/graphtoys | opengl/pipeline.c | <reponame>resetius/graphtoys
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
#include <render/pipeline.h>
#include <opengl/program.h>
#include <opengl/buffer.h>
#include <lib/verify.h>
struct UniformBlock {
struct BufferImpl base;
int id;
const char* name;
GLuint binding;
GLuint index... |
resetius/graphtoys | lib/formats/gltf.c | #include "gltf.h"
#include "base64.h"
#include <ktx.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <contrib/json/json.h>
#include <lib/verify.h>
#define BACK(vec, cap, count) \
count>=cap ? ( cap=(1+cap)*2, vec = realloc(vec, cap*sizeof(vec[0])), memset(&vec[count], 0, sizeof(vec[count]))... |
resetius/graphtoys | tools/gltfprint.c | #include <stddef.h>
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#include <stdlib.h>
#include <lib/formats/gltf.h>
int main(int argc, char** argv) {
struct Gltf gltf;
if (argc < 2) {
printf("usage: %s filename\n", argv[0]);
return -1;
}
gltf_ctor(&gltf, argv[1]);
f... |
resetius/graphtoys | render/buffer.h | <gh_stars>0
#pragma once
#include <stdint.h>
enum BufferType {
BUFFER_ARRAY, // vao
BUFFER_SHADER_STORAGE,
BUFFER_UNIFORM,
BUFFER_INDEX
};
enum BufferMemoryType {
MEMORY_STATIC,
MEMORY_DYNAMIC,
MEMORY_DYNAMIC_COPY
};
// Создаем все виды буферов (vertex, storage, uniform) ...
// Делаем пр... |
resetius/graphtoys | vulkan/frame.h | <reponame>resetius/graphtoys
#pragma once
#include "vk.h"
#include "commandbuffer.h"
struct RenderImpl;
struct Frame {
struct CommandBuffer cb;
VkCommandBuffer cmd;
VkFence fence;
VkSemaphore acquire_image;
VkSemaphore render_finished;
};
void frame_init(struct Frame* frame, struct RenderImpl* r... |
resetius/graphtoys | lib/ref.h | <filename>lib/ref.h<gh_stars>0
#pragma once
#include <stdatomic.h>
struct Ref {
atomic_int counter;
void (*free)(struct Ref* r);
};
void ref(struct Ref*);
void unref(struct Ref*);
|
resetius/graphtoys | render/buffer.c | <gh_stars>0
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "buffer.h"
#include "render.h"
static struct BufferBase* buffer_acquire_(struct BufferManagerBase* b, int size) {
struct BufferBase* buf = NULL;
if (b->n_buffers >= b->cap) {
int i;
for (i = b->... |
resetius/graphtoys | vulkan/renderpass.h | #pragma once
#include "vk.h"
struct RenderPass {
VkRenderPass rp;
VkDevice dev;
};
void rp_init(struct RenderPass* r, VkDevice logDev, VkFormat swapChainImageFormat, VkFormat depthFormat);
void rp_destroy(struct RenderPass* r);
void rp_begin(
struct RenderPass* r, VkClearValue* values, int n_values, VkC... |
resetius/graphtoys | font/font.h | <filename>font/font.h
#pragma once
#include <stdint.h>
#include <render/render.h>
struct Font;
struct BufferPair;
struct Label {
struct Font* f;
uint32_t* text;
struct BufferPair* buf;
int len;
int cap;
int x;
int y;
int w;
int h;
int id;
int dirty;
};
struct Font* fo... |
resetius/graphtoys | vulkan/swapchain.c | #include <stdio.h>
#include <stdlib.h>
#include "swapchain.h"
#include "render_impl.h"
#include "tools.h"
// TODO
static uint32_t max(uint32_t a, uint32_t b) {
return a>b?a:b;
}
static uint32_t min(uint32_t a, uint32_t b) {
return a<b?a:b;
}
static VkSurfaceFormatKHR choose_format(VkSurfaceFormatKHR* format... |
resetius/graphtoys | models/stl.c | <reponame>resetius/graphtoys<filename>models/stl.c
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <lib/formats/stl.h>
#include <lib/object.h>
#include "stl.h"
#include <render/pipeline.h>
#include <lib/linmath.h>
#include <models/stl.frag.h>
#include <models/stl.vert.h>
#include <models/stl.frag.s... |
resetius/graphtoys | font/font.c | <filename>font/font.c
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include <ctype.h>
#include <ft2build.h>
#include FT_FREETYPE_H
#include <render/pipeline.h>
#include <render/char.h>
#include <render/render.h>
#include <font/font.vert.h>
#include <font/font.frag.h>
#include <font/font.vert.spv.h>
#in... |
resetius/graphtoys | tools/cfgprint.c | #include <stdio.h>
#include <lib/config.h>
int main(int argc, char** argv) {
struct Config* cfg;
if (argc < 2) {
printf("Usage: %s config.ini\n", argv[0]);
return -1;
}
cfg = cfg_new(argv[1], argc, argv);
cfg_print(cfg);
cfg_free(cfg);
return 0;
}
|
resetius/graphtoys | lib/camera.h | #pragma once
#include <lib/linmath.h>
#include <lib/event.h>
// TODO: orthographic camera
struct Camera {
vec3 eye;
vec3 center;
vec3 up;
float fov;
float aspect;
float znear;
float zfar;
};
void cam_init(struct Camera* cam);
void cam_update(mat4x4 v, mat4x4 p, struct Camera* cam);
void... |
resetius/graphtoys | opengl/buffer.h | #pragma once
#include <render/buffer.h>
#include "glad/gl.h"
struct BufferImpl {
struct BufferBase base;
GLuint buffer;
GLenum type;
GLenum mtype;
int size;
};
struct Render;
struct BufferManager* buf_mgr_opengl_new(struct Render* r);
// TODO: BufferManager free
|
resetius/graphtoys | vulkan/symbols.h | #ifndef L0_FUNC
#define L0_FUNC(name)
#endif
L0_FUNC(vkCreateInstance);
L0_FUNC(vkEnumerateInstanceExtensionProperties);
#undef L0_FUNC
#ifndef L1_FUNC
#define L1_FUNC(name)
#endif
L1_FUNC(vkEnumeratePhysicalDevices);
L1_FUNC(vkGetPhysicalDeviceProperties);
L1_FUNC(vkGetPhysicalDeviceFormatProperties);
L1_FUNC(vkG... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.