Skip to content

Instantly share code, notes, and snippets.

View temurka1's full-sized avatar

Timur Urazalinov temurka1

  • Altium
  • Belgrade, Republic of Serbia
View GitHub Profile
@temurka1
temurka1 / cpp_ci_GA.yml
Created August 20, 2022 16:51
Github Actions CI for C++ libs/apps
name: Compile Spark
on:
workflow_dispatch:
jobs:
windows:
name: run on windows
runs-on: windows-latest
steps:
// Usage:
#define ENABLE_TRACE
#include "trace.h"
TRACE("\n\tx = " << vrt.X() << " y = " << vrt.Y() << " z = " << vrt.Z());

Minimal D3D11 pt2

Follow-up to Minimal D3D11, adding instanced rendering. As before: An uncluttered Direct3D 11 setup & basic rendering primer / API familiarizer. Complete, runnable Windows application contained in a single function and laid out in a linear, step-by-step fashion. No modern C++ / OOP / obscuring cruft.

The main difference here is that the hollow cube is rendered using DrawIndexedInstanced (which saves a lot of vertices compared to the original, so model data is now small enough to be included in the source without being too much in the way), but also all trigonometry and matrix math is moved to the vertex shader, further simplifying the main code.

Each instance is merely this piece of geometry, consisting of 4 triangles:

instanced1

..which is then repeated 24 times, rotated and colored:

@temurka1
temurka1 / README.md
Created August 26, 2020 06:32 — forked from lopspower/README.md
Hexadecimal color code for transparency

Hexadecimal color code for transparency

Twitter

How to set transparency with hex value ?

For example, you want to set 40% alpha transparence to #000000 (black color), you need to add 66 like this #66000000.

Download This sample on Google Play Store

var _libVLC = new LibVLC();
var _mediaPlayer = new MediaPlayer(_libVLC);
VideoView.MediaPlayer = _mediaPlayer;
string url = "https://vip.6.dl.webshare.cz/8125/2871bb5nW2/524288000/eJwlj81KxEAQhN+lD57GSWcyfwksgrAiKPEgEg+5TKZbXDYmMkl2QfHdndVLwQdVRdU3BGhAW6kqWWqUtQYBKzSl8d7arCjglFHABo1F1EbA8sef0KxpYwFTLuh4Wc9zGkk+Y7VHJbv9rbxXVl+_Pt7Jj+Mpt1L2UV3FgNE4E4PnSGSYyBIhuuDrwVp2KrqKL_a8YtrGUUDKwTMPy3tILONXX7wdRu4L5V05DGbqVF_ccEpz2r20D+1T117Nu8uL9L_w5xditD_Q/9bc0cfd54f69cc20afd1a79572d8f1e352bbff2c/Westworld.S03E02.WEB.H264-XLF.mkv";
var media = new Media(_libVLC, url, FromType.FromLocation);
VideoView.MediaPlayer.AddSlave(MediaSlaveType.Subtitle, "file:///D:\\Westworld-S03E02(0000327919).srt", true); //adding subtitles
media.AddOption(":subsdec-encoding=Windows-125");
media.AddOption(":freetype-color=16711680"); // Red
var lines = new List<Line>();
using (doc.LockDocument())
{
using (var tr = db.TransactionManager.StartTransaction())
{
BlockTable bt = (BlockTable)tr.GetObject(db.BlockTableId, OpenMode.ForRead, false);
BlockTableRecord btr = (BlockTableRecord)tr.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForRead, false);
foreach (ObjectId id in btr)
var deltaX = toPoint.X - fromPoint.X;
var deltaY = toPoint.Y - fromPoint.Y;
var chord = Math.Sqrt((deltaX * deltaX) + (deltaY * deltaY));
var halfChord = chord * 0.5d;
var sagitta = Math.Abs(bulge) * halfChord;
var direction = bulge > 0 ? SweepDirection.Counterclockwise : SweepDirection.Clockwise;
namespace Proto.Events
{
using System;
using System.Collections.Concurrent;
using System.Runtime.CompilerServices;
using System.Threading;
public sealed class EventAwaiter<TEventArgs> : INotifyCompletion
{
#region Fields
public struct Foo
{
private int _data;
public Foo(int data)
{
_data = data;
}
}
namespace RandomInvestigations
{
using System;
using System.Threading.Tasks;
public class Program
{
public static void Main(string[] args)
{
ExecuteFooBarAsync().Wait();